[chuck-users] using global variables as arguments in sporking functions

herman verbaeten hverb54 at hotmail.com
Wed Mar 4 14:22:39 EST 2020


Hi,

I'm having a problem passing a changing parameter(by an LFO in another function) to a function i'm sporking . Maybe this isn't possible :-( but i'd like your opinion) This is part of my script. Let me tell you this: When i give float Cfreq an initial value of 0.3  LFO does change gain of SinOsc c. If i don't give it an initial value and have LFOtochangeCfreq change it  -> no sound.


 SinOsc m => SinOsc c => Pan2 p => dac;
2 => c.sync;
float Cfreq;   //if i replace this line by: .3 => float Cfreq;

spork ~ LFOtochangeCfreq(.1);
spork ~ LFO(Cfreq);



fun void LFOtochangeCfreq(float variation) {
    SinOsc lfo => blackhole;
    variation => lfo.freq;
    while( true )
    {
    1000::samp => now;
    <<<lfo.last() => Cfreq>>>;
    }
 }

fun void LFO(float LFOfreq) {
    SinOsc lfo => blackhole;
    LFOfreq => lfo.freq;
    while( true )
    {
    1::samp => now;
    lfo.last() => c.gain ;
    }
}

while (1) 10::ms=> now;



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200304/5e994d19/attachment-0001.html>


More information about the chuck-users mailing list