Re: [chuck-users] Global Variables (herman asked)
You script got scrubbed for some reason, but I suspect that you’re shadowing the global somehow locally (if you use the same name as an argument or a local within a function, it masks the global version). Here’s a simple example of using a global: 1000 => float freqGlob; // global frequency variable SinOsc s => dac; // note that this osc is treated globally as well spork ~ sweep(); while (true) { // main loop randomly (re)sets freq Std.rand2f(500.0,3000.0) => freqGlob => s.freq; Std.rand2f(0.3,1.0)::second => now; } // this shred sweeps the frequency exponentially down fun void sweep() { while (true) { (0.999*=> freqGlob) => s.freq; ms => now; } }
Thanks for your answer Perry,
Do you happen to know something about SndBuf and the members .loop and .interp and how to use them.
Not many chuck users know about them....
thanks in advance!
Kind regards,
herman
________________________________
Van: chuck-users-bounces@lists.cs.princeton.edu
participants (2)
-
herman verbaeten
-
Perry Cook