Tidal icon indicating copy to clipboard operation
Tidal copied to clipboard

using event parts as sample cuts

Open yaxu opened this issue 5 years ago • 3 comments

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.

yaxu avatar Nov 14 '19 11:11 yaxu

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.

yaxu avatar Nov 12 '21 10:11 yaxu

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.

bgold-cosmos avatar Nov 12 '21 14:11 bgold-cosmos

I could be wrong but I think unit "c" only changes the units for speed and not begin/end

yaxu avatar Nov 12 '21 15:11 yaxu