home/ atoms/ tidal-wchoose

Tidal's wchoose picks from a list with weighted probabilities, unlike choose which weights all options equally

choose picks uniformly at random from a list of values; wchoose takes (value, weight) pairs so each item’s selection probability is proportional to its weight. Weights are relative and need not sum to 1 — TidalCycles normalises them internally (a change in v1.0.0; older code required summing to 1), so [("bd", 8), ("snare", 1)] makes bd eight times as likely as snare. Both return continuous streams, so they must be discretized with segment or struct (or attached to a discrete structure) to produce events. Related variants: chooseBy/wchooseBy replace the internal random source with an explicit pattern for deterministic or signal-driven selection; cycleChoose picks one value per cycle rather than per event; and wrandcat applies the same weighting to whole patterns in a randcat-style selection.

Examples

d1 $ sound (segment 8 $ wchoose [("bd",8),("snare",0.5),("clap",1)])  -- mostly kick, rare snare
d1 $ sound (segment 8 $ choose ["bd","arpy","snare"])                  -- 8 events/cycle, uniform
d1 $ sound "drum ~ drum drum" # n (cycleChoose [0,2,3])               -- one note held per cycle

Assessment

Write a pattern that plays mostly kick (60%), occasional hi-hat (30%), and rare clap (10%) on a 16th-note grid. State the weight tuples, explain why the weights need not sum to 1, and explain why choose/wchoose won’t produce events without segment or struct.

“The 'wchoose' function is like 'choose', but you can give”
corpus · tidalcycles-course-1-structured-4-week-course · chunk 13
“`wchoose` is similar to `choose`, but allows you to 'weight' the choices, so some are more likely to be chosen than others.”
corpus · tidalcycles-randomness-reference-probability-perlin-weighted · chunk 1