I have been trying to do something like this: trigger from a midi pad and play a pattern through an arbitrary number of times. I have seen the solutions based on cApply, which work well to engage a pattern relative to the current cycle. I have tried using "once" which is close to what I'd like to do, but I'd like to assign a pattern to an arbitrary stream so that it is interruptible. I believe once always plays through... And I would like this to be triggered with a midi controller Something like this:
let b = (fmap (\x -> if x > 0 then True else False)) (discretise 1 $ cF 0 "24" )
if b then (d1 $ trigger 1 $ playFor 0 0.2 $ n "[1 0]*16" # s "808") else s ""
But this fails because is a Pattern Bool rather than a Bool. That makes sense to me, but is there any convenient way to work around this?
After digging through the code and reading the posts here, I see how non-trivial it is to access the triggering code in the way I was suggesting. Checking out the Atom line eval method now. Should be able to do what I wanted that way. Thanks mrreason!
Well, there's possible and then there's possible in the interval between now and the heat death of the universe. There's a nice capply function for patterning by mrreason (#2168). But since the triggering condition is tested within the "every" conditional of a pattern, the logic is inverted from what would be necessary to reset the pattern. Hacked on this for a couple of days and it seems a larger issue than I'd like to tackle. Maybe Alex sees an easy path, but I'm finally punting and trying the atom/eval line triggering (also implemented by mrreason I think).
I think there's a tidal-api now that allows to send code to the interpreter vía osc. So using supercollider as a bridge it should be easy. Haven't tried it though and keen to know how stable/easy to use it is.
I've been using a plugin I wrote for neovim combined with some shell tools to send and receive midi. Kinda hacky though, but it works
Yes, there's a tidal api that's great for manipulating controls of patterns, but doesn't actually trigger patterns (as far as I could tell). That was my specific use case. The atom-eval functionality by mr reason with a Pure Data interface is a good work around for me.