home/ atoms/ sonic-pi-onset-opt

onset: pick in Sonic Pi selects a random transient event from a sample for instant hit variation

The onset: opt accepts an index or pick (random) to select a specific transient event within a sample rather than the whole file. This enables on-the-fly drum hit selection from a loop sample without manual start:/finish: calculations. sample :loop_amen, onset: pick plays a random drum hit from the Amen break. This is the modern idiomatic replacement for manual slice computation in many percussive use cases.

Examples

live_loop :jungle do sample :loop_amen, onset: pick sleep 0.125 end

Assessment

Build a 16-step loop that randomly selects hits from :loop_amen using onset: pick. Compare the feel to the manual start:/finish: slice technique.

“sample :loop_amen, onset: pick”
corpus · sonic-pi-built-in-tutorial · chunk 55