How to change gain with a button in a sampler script
-
Hi, does anyone know how I can modify the gain of a Gain when pressing a button? I tried with
Engine.setAttribute(sampler.Gain, -6);
but it doesn’t work. Thanks.
-
@lijas90 said in How to change gain with a button in a sampler script:
Hi, does anyone know how I can modify the gain of a Gain when pressing a button? I tried with
Engine.setAttribute(sampler.Gain, -6);
but it doesn’t work. Thanks.
you need to set an attribute on the sampler itself - not Engine, so the best way to manage Gain in any "sound generating" back end processor (sampler, synth, loop player etc.) is to add a a simple gain to the FX section, then get a reference to it and set the gain there like this:
const var VoiceGain1 = Synth.getEffect("VoiceGain1"); // now set it in a call back.... inline function onVoiceGainControl(component, value) { VoiceGain1.setAttribute(VoiceGain1.Gain, value); };
can I recommend you to start with Dave's scripting course(s)
-
@Lindon said in How to change gain with a button in a sampler script:
VoiceGain1.setAttribute(VoiceGain1.Gain, value);
It works! Thank you so much.
-
@lijas90 said in How to change gain with a button in a sampler script:
@Lindon said in How to change gain with a button in a sampler script:
VoiceGain1.setAttribute(VoiceGain1.Gain, value);
It works! Thank you so much.
..do the course.