Our old friend Tidal has a function I quite like - degrade
Tidal is a pattern based language and degrade simply drops an event from a pattern 50% of the time.
input: [1,1,1,1,1,1,1,1]
-> degrade(input)
output: [1,0,1,1,0,0,0,1]
Now SonicPi isn't a pattern or event based system so this is a bit tricky. I feel like you could achieve the same effect though using the code below.
It relies on the current_bpm being set to match whatever you're trying to slice. That way, a time value like 0.25 can stand in as an event at the current bpm.
Other settings are:
the probability with which an event is likely to get dropped - 0.0 drops everything, 1.0 drops nothing. the high volume and the low volume - whether it drops the sound completely or just accents some slices
This is woefully inefficient but I'm not sure how to implement it as a synthdef.
Also whilst I'm on the idea train, another way to achieve the same thing would be to have a
degrade
method with a block that would redefine the behaviour of the methodsplay
,synth
andsample
to have an automaticif rand < p
added to themCould potentially use the technique described here: http://www.dan-manges.com/blog/ruby-dsls-instance-eval-with-delegation