Tidal
Tidal copied to clipboard
Backport fastgap fix
fastgap got bugfixed in 2.0 https://github.com/tidalcycles/Tidal/blob/2263c2e348579519cf3589965889faed7c88dffe/src/Sound/Tidal/Signal/Base.hs#L462-L482
Originally posted by @yaxu in #1076
As noticed by Claude: https://discord.com/channels/779427371270275082/779743442288377876/1347507824145731616
this is the version I patched my local copy with, not sure if it is correct....
_fastGap :: Time -> Pattern a -> Pattern a
_fastGap 0 _ = empty
_fastGap r p = splitQueries $ p {query = map mungeResult . f}
where
r' = max r 1
-- zero width queries of the next sam should return zero in this case..
f st@(State a _)
| start a' == nextSam (start a) = []
| otherwise = query p st {arc = a'}
where
mungeQuery t = sam t + min 1 (r' * cyclePos t)
a' = (\(Arc s e) -> Arc (mungeQuery s) (mungeQuery e)) a
mungeResult e = e
{ whole = fmap (mungeArc (part e)) (whole e)
, part = mungeArc (part e) (part e)
}
mungeArc (Arc s0 e0) (Arc s e) = Arc
(sam s0 + ((s - sam s0) / r'))
(sam s0 + ((e - sam s0) / r'))