[chuck-users] Looping

Alberto Alassio alberto.alassio at gmail.com
Thu Sep 27 07:35:47 EDT 2012


I've made it in this way:

SinOsc s1 => g => dac;
220.0 => s1.freq;
spork ~ loop1();

SinOsc s2 => g ;
spork ~ loop2();
0.4 => g.gain ;
0.01 => g.mix;

spork ~ loop3();

<<<"waiting on main shred">>>;
2::minute => now;

fun void loop3()

{
    for (0 => int ca; ca < 10; ca++)
    { 0.2 => g.gain;
    10::second => now;
    0.0 => g.gain;
    1::second => now;
    0.2 => g.gain;
    10::second => now;
    0.0 => g.gain;
    1::second => now;

}
}

fun void loop1()
{
    <<<"sporked loop1">>>;
    for (0 => int i; i < 21; i++)
    {
        Std.rand2f(130.0, 440.0) => s1.freq;
        0.2 => s1.gain;
     0.5::second => now;
        0.0 => s1.gain;
        0.5::second => now;
    }
    <<<"loop1 done">>>;
}

fun void loop2()
{
    <<<"sporked loop2">>>;
    for (0 => int i; i < 21; i++)
    {
        Std.rand2f(130.0, 440.0) => s2.freq;
        0.2 => s2.gain;
        0.5::second => now;
        0.0 => s2.gain;
        0.5::second => now;
    }
}


Is it a good way, or are there other ways more elegant and simpler?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20120927/5b7fe046/attachment.htm>


More information about the chuck-users mailing list