ruk·si

ChucK Guide

Updated at 2015-01-16 18:02

ChucK is a concurrent, audio programming language for real-time synthesis.

Concurrency is implemented using shreds. Shreds resemble threads and are automatically synchronized by time. You create new threads by "sporking".

There is not fixed control rate. In addition to audio rate, how many samples is there i second, there is control rate, in how fine rate can you modify individual samples. Programs have control over their own timing.

Impulse i => dac;
while (true)
{
    1.0 => i.next;
    100::ms +=> now;
}
SinOsc s => dac;
while (true)
{
    440 => s.freq;
    0.5::second +=> now;

    880 => s.freq;
    0.5::second +=> now;
}
SinOsc s => dac;
while (true)
{
    Std.rand2f(30, 1000) => s.freq;
    100::ms +=> now;
}

Time stands still until you advance it. now holds the current chuck time

now + 5::second => time later;
while( now < later )
{
    <<<now>>>;
    1::second => now;
}
<<<"success">>>;
while( true )
{
    <<< "tick:", (now / second), "seconds" >>>;
    1::second => now;
}

Duration is a native type. dur can be samp, ms, second, minute, hour, day, week or custom duration.

SinOsc s => dac;
1::second - 750::ms => dur quarter;
while (true)
{
    Std.rand2f(30, 1000) => s.freq;
    1::quarter +=> now;
}

Sources