home/ atoms/ chuck-strongly-timed

ChucK is strongly-timed: advancing 'now' drives synthesis with sample-accurate control

ChucK is a strongly-timed language: time is embedded in the language itself rather than handled by an external scheduler, and the programmer must advance time explicitly in the code. The keyword now holds the current ChucK time when read; assigning a duration to it (1::second => now) advances time and suspends the current shred until that point is reached, computing audio in between. Two native types carry timing: time (an absolute point from the start of ChucK time) and dur (a duration, e.g. 1::second, 500::ms, built from units like samp, ms, second). Because the programmer states exactly when to compute, send, and wait, timing is sample-accurate — critical for musical precision — at the cost of treating time as a first-class concept managed directly. The common misconception is that now is a clock you read; it is the clock you drive — audio only advances when your code advances now.

Examples

SinOsc s => dac;   // patch oscillator to output
440 => s.freq;
1::second => now;   // audio computed for 1 s
880 => s.freq;
0.5::second => now; // then 0.5 s more

Assessment

Explain what happens to ChucK’s audio engine during 100::ms => now, then write a loop that plays a rising scale advancing now one beat per note. Contrast this explicit time advancement with a language where timing is implicit, and explain why sample-accurate timing matters for musical work.

“ChucK is a strongly-timed language, meaning that time is fundamentally embedded in the language.”
“**ChucK**, created by **Ge Wang** and **Perry Cook** at Princeton in 2002, introduced the idea of "strongly timed" programming, where time advances explicitly in the code itself, giving performers sample-accurate control over musical timing.”
corpus · the-history-of-live-coding-from-bell-labs-to-the-algorave-so · chunk 1