While Loops on Release Callbacks (and CC64) Problem
So I have some polyphonic variables that modulate stuff (like tremolo and vibrato) and which speed is dependent upon a $counter variable in a while loop. Something like this :
on init declare polyphonic $counter end on on release while (1 > 0) $counter := $counter + 1 message($counter) wait(10000) end while end on
The only problem is: if I play a note with the sustain pedal on, release the note and then release the sustain pedal, the counter will increase twice as fast, because Kontakt triggers 2 release callbacks with the same $EVENT_ID : one for the Note Off event and another for the sustain pedal release. Therefore, my tremolo and vibrato speed go twice as fast.
Is there any way I can get around this without having to change the CC64 parameters in the Instrument options? I want to still be able to use my sustain pedal for sustaining sounds and for other purposes as well.
Maybe something with the listener callback? I'm still unsure as to how I would do it though...
first question is
why are you using polyphonic variables for this?
second question is
why are you using a loop with
1 > 0condition?
it seems there are other ways to achieve what you ware trying to do, but you need to reformulate your question.
maybe the approach you are using is not the best or even the right one.0
I'm using polyphonic variables because I want the tremolo and vibrato to be polyphonic.
My script is huge and includes all sorts of effects, which is why I didn't include it here because it would take a long time to be able to figure what's going on, which is why I'm reducing the problem to its simplest form. I can always join the script if you want to take a look at it though...
Btw, I'm not a programmer, so I might not have the best programming skill and work method, but so far the script has been working well except for this.
Obviously the while loop condition was just for the example, in the script the while loop continues until the release time is met.0
What do you mean by the tremolo and vibrato to be polyphonic?
If you are coding your own tremolo or vibrato, you don't need polyphonic variables for that, even if you apply different settings of either to each voice in Kontakt.
Polyphonic variables are used for something else.
No problem not being a programmer. It is common to get caught in much harder ways to do things than they need to be.
About the while condition: always write exactly what your code is doing, even if you want to write "pseudo-code". There's no way other people will guess what you are trying to do.
Onto the problem:
If you want to create the tremolo effect, I believe you know that it is nothing but a volume modulation.
You can apply that into the entire instrument (via main bus + scripting your own modulators), you can apply to the insert effect path (same way as the main bus), to the busses themselves, to the group level with the added help of pre-built LFOs and sequencer modulators to act on the group volume or into an insert output volume or you could even apply it to each specific event.
Vibratos are a little more specific, since they involve pitch modulation. That could be achieved on the group level, modulating the tune engine parameter or it could be done modulating the events themselves.
Each way has a different method to achieve your desired results.0
If you want polyphonic tremolo and vibrato, the easiest way is to use Kontakt's LFOs to do that.0
Thank you both for your replies and apologies for the delay.
Yes, I'm aware that using Kontakt's modulation parameters might be easier, but the idea behind my script was to create one script that would incorporate all the different effects/modulations that I frequently use and have the set-up all ready simply by adding the script to the instrument (so I don't have to open my instruments and adjust all parameters every time I come up with an idea). Everything works fine with it, except for this one little bug, so I was hoping that something could be done to resolve it.
Isn't there any line of code that can be written to not make the release pedal trigger the release callback twice and make the counter variable in the while loop increment twice as fast?0
- 10.6K All Categories
- 20 Welcome
- 442 Hangout
- 58 NI News
- 206 Tech Talks
- 1K Native Access
- 4.9K Komplete
- 614 Komplete General
- 1.1K Komplete Kontrol
- 1.8K Kontakt
- 483 Reaktor
- 151 Battery 4
- 268 Guitar Rig & FX
- 204 Massive X & Synths
- 211 Other Software & Hardware
- 2.2K Maschine
- 14 Sampling Room
- 2.6K Traktor
- 2.4K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators