Hi Herman,

I think you must use your CFreq (global variable) inside your second function. And update the parameter you want inside the loop :

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

    CFreq => lfo.freq;

    }
}

Have fun,

Julien


Le mer. 4 mars 2020 à 20:22, herman verbaeten <hverb54@hotmail.com> a écrit :
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;



_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users