[chuck-users] Grains make garbage:(

kurt sobrilliant at gmail.com
Wed Sep 23 16:12:00 EDT 2009


Hello all-
I have been doing some granular synthesis in ChucK and I am trying to create
overlapping grains without having resort to arrays of Ugens or similar
methods to create polyphony.  Although I have seen this technique used
often, the following seems to eat up memory rather quickly (due to
continuously sporking the SndBuf no doubt).

//BEGIN CODE -->
//use your own file here...
Std.getenv("SSDIR")+"/"+"Percussion"+"/"+"snare.wav" => string filename;

fun void voice(){
SndBuf s => Envelope e => dac;
filename => s.read;
 .5 => s.gain;
s.pos(Std.rand2(0, s.samples()));
5::ms => e.duration;
e.keyOn();
45::ms => now;
e.keyOff();
5::ms => now;
}
//spork away and make lots of overlapping SndBufs
while (15::ms => now){
 spork ~ voice();
}
//<--END CODE

I guess I am wondering if there is a way to release Ugen references or do I
need to wait for garbage collection to liberally spork Ugens?
I have looked over these threads...

garbage collection:
https://lists.cs.princeton.edu/pipermail/chuck-users/2009-March/003978.html
https://lists.cs.princeton.edu/pipermail/chuck-users/2009-July/004473.html

granular:
https://lists.cs.princeton.edu/pipermail/chuck-users/2008-May/002917.html

...and they seem to indicate that i should declare a finite number of Ugens
and juggle them somehow (not as cool as my RAM hungry example). The ability
release unreferenced Ugens would facilitate the easy polyphony one gets when
using Csound and really make ChucK awesomer (fingers crossed).
Thanks ahead of time for any input.
Kurt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20090923/4f674f03/attachment.html>


More information about the chuck-users mailing list