home/ atoms/ strudel-degrade-sometimes-random-thinning

degradeBy removes events by probability; sometimesBy applies a function by probability

Strudel has two families of probabilistic operators. degradeBy(p) removes each event with probability p (0 = keep all, 1 = remove all); degrade is shorthand for degradeBy(0.5). sometimesBy(p, fn) applies fn to each event with probability p, with named shortcuts sometimes (0.5), and the analogous often/rarely. The parallel someCyclesBy(p, fn) makes the decision per whole cycle (all-or-nothing) rather than per event, so someCycles(rev) reverses an entire cycle or leaves it untouched. All use Strudel’s deterministic time-keyed PRNG, so output is reproducible across runs.

Examples

s(“hh*8”).degradeBy(0.3) // ~30% of hats silenced note(“c3 e3 g3”).sometimes(rev) // ~50% of events reversed note(“c3 e3 g3”).someCycles(rev) // whole cycle reversed or not, 50%

Assessment

Explain the audible difference between s("hh*8").degradeBy(0.5) and s("hh*8").someCycles(x => silence), then write a version that applies fast(2) roughly 25% of the time.

“Randomly removes events from the pattern by a given amount. 0 = 0% chance of removal 1 = 100% chance of removal”