[chuck-users] Array of SndBufs at different rates

Matthew.Noone Matthew.Noone at ul.ie
Fri Jan 10 16:16:12 EST 2020


Thanks Mario.
That is really helpful.
I'm very new to coding so still getting my head around basics like arrays and functions.

I've tweaked the code and I get some pretty interesting noises but its not quite what I expected.  Can you see what I've done wrong here?



//Sndbuf



[25.1, 1.2, 30.2, 25.2] @=> float rates[];//array of possible rates (changing will change harmony)




<<< "GET VALUES\n---------" >>>;

// get values from the array

for(0 => int c; c < rates.size(); c++)

{

    <<< rates[c] >>>;

}


<<< "\nSET VALUES\n---------" >>>;

// set values

for(0 => int c; c < rates.size(); c++)

{

    Math.random2f(-1, 1) => rates[c];

    <<< rates[c] >>>;



//program

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


while (true)

{


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



   0 =>mySound.pos;



//delay and rev setup


d => Gain feedback => d;

2::second =>d.max;

0.1 => rev.mix;

 .02 => g.gain;






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

Math.random2( 3, 7) ::ms =>d.delay;


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



    5::second => now;







}

}


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


________________________________
From: Mario Buoninfante <mario.buoninfante at gmail.com>
Sent: Friday 10 January 2020 18:51
To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu>
Subject: Re: [chuck-users] Array of SndBufs at different rates

you can also find more info here: https://en.flossmanuals.net/chuck/_full/#arrays

On Fri, 10 Jan 2020 at 12:28, Matthew.Noone <Matthew.Noone at ul.ie<mailto:Matthew.Noone at ul.ie>> wrote:
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...
MJ


//Sndbuf


//4 => int gongs;

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


//program

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

_______________________________________________
chuck-users mailing list
chuck-users at lists.cs.princeton.edu<mailto:chuck-users at lists.cs.princeton.edu>
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200110/f2b466a1/attachment-0001.html>


More information about the chuck-users mailing list