Assign to delay bug
-
If I assign a dial to the delay it just hides the entire interface - looks like it throws up some incorrect code.
I'm following the video tutorial, I add the reverb dial, all is well, then I add a delay mix dial and - things just die on me. -
Have you looked at the code it generates in both the
onInit
callback and theonControl
callback?It's supposed to be quite error-prone, but maybe something's messing up the regex processing.
If you paste the code (Right click in the code Editor -> Save Script to Clipboard) here, I'll take a look.
-
Certainly here it is - this is what is generated by using the right click create method, and then the right click assign modulator parameters method.
ON INIT -
Content.makeFrontInterface(500,300);
const var Reverb = Content.addKnob("Reverb", 50, 38);
const var Delay = Content.addKnob("Delay", 187, 36);
const var SimpleReverb = Synth.getEffect("Simple Reverb");
const var Delay = Synth.getEffect("Delay");
-----------------------------------_
ON UI -
function onControl(number, value)
{switch(number) { case Reverb: { SimpleReverb.setAttribute(SimpleReverb.WetLevel, value); break; } case Delay: { Delay.setAttribute(Delay.Mix, value); break; } };
}
-
The knob and the delay effect have the same variable name
Delay
. This is not allowed, so you have to change one of the variable names:Content.makeFrontInterface(500,300); const var Reverb = Content.addKnob("Reverb", 50, 38); const var DelayKnob = Content.addKnob("DelayKnob", 187, 36); const var SimpleReverb = Synth.getEffect("Simple Reverb"); const var Delay = Synth.getEffect("Delay"); function onControl(number, value) { switch(number) { case Reverb: { SimpleReverb.setAttribute(SimpleReverb.WetLevel, value); break; } case DelayKnob: // <= Also change the name here! { Delay.setAttribute(Delay.Mix, value); break; } }; }
I'll add some test code that spits out a warning for this case, but it's pretty important to understand what the auto generated script code does - it is supposed to save you time but not relieve you of the burden of knowing Javascript :)
There's a blog post about this very subject in case you missed it:
http://178.62.82.76:4567/topic/74/how-to-control-modules-with-scripts
-
Thats awesome. Makes perfect sense now that the knowledge is there. : ) as with most things.
Thanks again