home/ atoms/ sc-pdef-live-pattern-update

Wrapping a Pbind in Pdef allows live re-evaluation of patterns without stopping the stream

Pdef gives a Pbind a named identity. Re-evaluating the Pdef replaces the internal pattern, but the running EventStreamPlayer continues without interruption — the change takes effect on the next event. This is the primary mechanism for live-coded pattern performance in SuperCollider. Quantization via .play(quant:seconds) or .quant_(seconds) ensures changes snap to a rhythmic grid (e.g., the start of the next measure), maintaining groove consistency even when re-evaluating mid-phrase.

Examples

Pdef(\rhythm, Pbind(\dur, Pseq([1/16], inf), ...)).play(quant:1.875); // later, re-evaluate to change pattern — changes take effect at next bar

Assessment

What is the difference between Pbind.play and Pdef(\name, Pbind(…)).play for live performance? What does quant:1.875 do and when would you use it?

“Once playing, we can simply change the contents of the Pbind, re-evaluate, and the changes take effect without disrupting the event stream.”
corpus · supercollider-tutorials-full-transcripts-and-code-eli-fields · chunk 27