Tidal sometimes, degradeBy, irand, and rand add controlled randomness to patterns
Tidal provides functions for probabilistic variation. sometimes f applies transformation f to events with ~50% probability; often f uses ~75%. irand N generates a random integer 0..N-1 (e.g. to pick a random sample index). rand generates a random float 0..1 (e.g. for random gain). degradeBy p drops each event with probability p (degrade alone means degradeBy 0.5), and ? after a sample is shorthand for a 50% drop on that element. Tidal’s randomness is deterministic from cycle time, so the same code reproduces the same ‘random’ result.
Examples
d1 $ sometimes (# speed "2") $ sound "drum*8"
d1 $ sound "arpy(3,8)" # n (irand 16)
d1 $ sound "tink*16" # gain rand
d1 $ degradeBy 0.2 $ sound "tink*16"
d1 $ sound "bd sn:2? bd sn?"
Assessment
Apply degradeBy 0.3 to a hi-hat pattern and describe the texture. Use irand 8 for random pitch on a melodic line. What is the difference between sometimes and often?