[chuck-users] Array of SndBufs at different rates

Matthew.Noone Matthew.Noone at ul.ie
Fri Jan 10 07:28:27 EST 2020

Hi all,
I'm trying to figure out the easiest way to setup an array of the same SndBuf playing at different rates.

I'm using a Gong sample.  Playing that back at different rates to make basic melodic patterns.

I can make a random function but I don't know who I can set an array of rates which I can then randomise.

Any ideas?

Here is my existing code with random function. (I tried writing an array at the start but not sure how to call that?)

Sorry for such an easy question...


//4 => int gongs;

//[.25, 0.5, 1.0, .25] @=> float rates[];//array of possible rates (changing will change harmony)


SndBuf mySound => Delay d => JCRev rev => Gain g => dac;

0.8 => rev.mix;

//delay and rev setup

d => Gain feedback => d;

while (true)


    .02 => g.gain;

    me.dir()+"Samples/MotherGong.wav" =>mySound.read;

    0 =>mySound.pos;

    Math.random2f ( 20.1, 22.01 ) => mySound.rate;

    Math.random2f( 0.3, 0.5) ::second => d.max;

    Math.random2( 30, 70) ::ms =>d.delay;

    Math.random2f( 0.3, .8) => feedback.gain;

    0.50 ::second => now;


Dr. Matthew James Noone
Sarode Artist & Irish Research Council Postdoctoral Fellow
Irish World Academy of Music and Dance
University of Limerick

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200110/9ae1aac8/attachment.html>

More information about the chuck-users mailing list