Tidal
Tidal copied to clipboard
using event parts as sample cuts
While thinking about the relationship between event parts and sample triggers, I made something which turns event parts into sample slices.
cleave :: ControlPattern -> ControlPattern
cleave = withEvent f
where f ev = ev {whole = Just $ part ev,value = add ev}
d ev = wholeStop ev - wholeStart ev
b ev = fromRational $ (eventPartStart ev - wholeStart ev) / d ev
e ev = fromRational $ 1 - ((wholeStop ev - eventPartStop ev) / d ev)
add ev = Map.insert "begin" (VF $ b ev) $ Map.insert "end" (VF $ e ev) $ Map.insert "unit" (VS "c") $ Map.insert "speed" (VF $ fromRational $ 1/(d ev)) $ value ev
So cleave $ sound "bd cp/2"
plays a kick, then half of cp, then another kick, and the other half of cp.
This would be a lot of fun, a more direct version of splice
.. But the problem is that this function will in addition chop at tidal's framerate. I'm not sure how to get around this.
Somehow it doesn't even spread the events over two cycles.. In d1 $ cleave $ sound "bd sax/2"
the sax is silent in the second cycle.
I don't think you actually want unit "c"
; if you want to play the second half of the sample it's just begin 0.5
in the "normal" units.
I could be wrong but I think unit "c"
only changes the units for speed
and not begin
/end