Skip to content

Commit

Permalink
Merge pull request #1106 from tidalcycles/fix-striateby
Browse files Browse the repository at this point in the history
Fix off-by-one error in striateBy. This fix will change the behaviour of existing patterns.
  • Loading branch information
yaxu authored Jan 18, 2025
2 parents 069fe47 + 85ff62b commit 4a39773
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Sound/Tidal/Control.hs
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ striate' :: Pattern Int -> Pattern Double -> ControlPattern -> ControlPattern
striate' = striateBy

_striateBy :: Int -> Double -> ControlPattern -> ControlPattern
_striateBy n f p = fastcat $ map (offset . fromIntegral) [0 .. n-1]
where offset i = p # P.begin (pure (slot * i) :: Pattern Double) # P.end (pure ((slot * i) + f) :: Pattern Double)
slot = (1 - f) / fromIntegral n
_striateBy n f p = keepTactus (withTactus (* toRational n) p) $ fastcat $ map (offset . fromIntegral) [0 .. n-1]
where offset i = mergePlayRange (slot*i, (slot*i)+f) <$> p
slot = (1 - f) / fromIntegral (n-1)


{- | `gap` is similar to `chop` in that it granualizes every sample in place as it is played,
Expand Down

0 comments on commit 4a39773

Please sign in to comment.