hi everyone, I have this noob problem, I’m trying to interface a midi controller with SuperCollider and I’m trying this example of managing MIDI notes; everything works, but what I’m noticing is that the number of UGens in the server keeps growing and the UGens they seem not to be released;
can you help me? thank you
(
SynthDef(\moog, {arg freq=440, amp=0.1, gate=1;
var signal, env;
signal = VarSaw.ar([freq, freq+2], 0, XLine.ar(0.7, 0.9, 0.13));
env = EnvGen.ar(Env.adsr(0.001,1,0,0.5), gate, doneAction:2);
Out.ar(0, signal*env);
}).add;
)
(
a = Array.fill(127, { nil });
MIDIdef.noteOn(\myOndef, {arg vel, key, channel, device;
a[key] = Synth(\moog, [\freq, key.midicps, \amp, vel/127]);
[key, vel].postln;
});
MIDIdef.noteOff(\myOffdef, {arg vel, key, channel, device;
a[key].release;
[key, vel].postln;
});
)
this is my status bar after some time i’m playing with the midi keyboard :
38,4 |< % 1e+01% 819u 91s [sclang]