[flocking] Can I set the envelope values of an existing synth?

aBe abe at hamoid.com
Fri Apr 15 14:38:29 UTC 2016


I can now correctly trigger envelopes, by changing the gate value to 1;
and later to 0, as suggested. I'm happy about that :)

The next problem I encounter is that I can't set the envelope values
after the synth has been created. If I do this:

mySynth.set('ampEnv.levels', [0, 0.2, 0, 0.8, 0.4, 0.8, 0]);

the whole JavaScript program freezes for 10 seconds (I'm setting 6
envelope-arrays with ~15 values each) and then I get an error:

Uncaught RangeError: Invalid string length
out @ flocking-all.js:12131
printImpl @ flocking-all.js:12181
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12160
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
printImpl @ flocking-all.js:12177
fluid.prettyPrintJSON @ flocking-all.js:12200
flock.pathParseError @ flocking-all.js:20769
flock.get @ flocking-all.js:20793
flock.input.setValueForPath @ flocking-all.js:20970
flock.input.set @ flocking-all.js:21010
flock.synth.set @ flocking-all.js:21794
invokeInvoker @ flocking-all.js:13923
Sound.play @ sound.js:84
App.mousedown @ main.js:126
App.handleEvent @ main.js:160

The envelopes run at audio rate, otherwise the sound is very glitchy.

1. Would it help if I disconnect the synth from the audio engine while
setting the new envelopes?

2. Is there an alternative way to change the envelope values one by one,
for instance something like
mySynth.set('ampEnv.levels.3', 0.3);
or
mySynth.set('ampEnv.levels[3]', 0.3);

3. Why does my current attempt to set the values as a new array fail?

Cheers!

aBe


More information about the flocking mailing list