[chuck-users] chuck~ for PD

Stephen Sinclair radarsat1 at gmail.com
Mon Mar 12 10:41:56 EDT 2007

> Do you mind sending over a copy of the ChucK files that failed
> to work? From your experience with PD CVS, it seems
> there is definitely some changes to make for this.

Here's the "test.ck" file:

<<<"here test">>>;
SinOsc s => dac;
150 => s.freq;
1::second => now;

The "more complicated" example was actually across a couple of files.

I've been building a little library of drum-machine synths.
I started with this "kick.ck" file I have:

public class Kick
    300.0 => float freq;
    0.0 => float endfreq;
    1.0 => float gain;
    300::ms => dur length;
    3000.0 => float drop; /// TODO

    fun void play()
        SinOsc s => dac;
        freq => s.freq;

        // Ramp up for 1 ms
        now => time begin;
        now + 1::ms => time end;
        while (now < end)
            (now - begin) / 1::ms * gain => s.gain;
            1::samp => now;

        // Play w/ decending frequency
        now + length - 1::ms => end;
        while (now < end)
            1::samp => now;
            s.freq() - ((s.freq() - endfreq)/drop) => s.freq;
            (end - now) / length * gain => s.gain;

    fun void trigger()
        spork ~ play();

I found that if I put the following after this class definition:
Kick k;

It works.  However, this can only play it once.  The idea is to have
the Kick class available to more complicated scripts (i.e.,
sequences), but when I tried the above two lines in a separate file,
"kicktest.ck", it didn't play.

(That is, I click the message "add kick.ck" and then "add kicktest.ck"
and it didn't play anything.)
Maybe it's related to the other problem of not starting other chuck
scripts after the first one.

> Thanks for trying chuck~ out!

No problem!


More information about the chuck-users mailing list