SuperCollider Routines and Tasks are coroutines that yield time to the clock between musical events
In SuperCollider, a Routine is a function that can pause and resume using .yield or .wait. When scheduled on a clock (SystemClock, TempoClock, AppClock), each call to N.wait suspends the Routine for N seconds of clock time then resumes. This enables writing musical sequences as straight-line code with explicit timing. Task is a restartable Routine that can be paused and resumed interactively — useful for live performance. .fork is shorthand for wrapping a block in a Routine and scheduling it immediately. A nil.yield creates a fermata (waits until .play is called again).
Examples
r = Routine({ x = Synth(\default, [freq: 76.midicps]); 1.wait; x.release(0.1); y = Synth(\default, [freq: 73.midicps]); nil.yield; // fermata y.release; }); r.play;
Assessment
Write a Routine that plays three pitches at tempo 120 BPM, includes one fermata, and cleans up all synths on completion. Explain the difference between SystemClock and TempoClock scheduling.