1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

Solved Multi LFO realtime sounding issue

Discussion in 'Scripting Workshop' started by Gabriel Dib, Jun 6, 2018.

  1. Gabriel Dib

    Gabriel Dib NI Product Owner

    Messages:
    88
    Hi!

    Excuse if this is question repeated, I did search google and forums with no luck, so here goes the issue I am facing:

    I created a LFO multi modulator for amp volume and on the kontakt instrument's GUI I created buttons to select the waveform. Simple task, just change the respective waveform's knob on the modulator to represent what is happening, i.e. sine button was turned on the interface, all others should be turned off, then set the sine modulator knob of the LFO multi in kontakt's modulators section to 100 and set all others to 0 (or 500000 in the KSP).

    So far so good.

    Problem is, say I holding one note and I would like to change the waveform while the note is held. Currently I only get the resulting sound ofswitching to different waveform on IF I play a new note. The first note being held will keep having its volume modulated by a whatever wave I have when it was played instead of updating to the new waveform I clicked on the interface.

    Interesting facts for the record:
    1) I did change the knobs in the modulator section of the edit view in order to narrow down the problem and know that it wasn't something I was doing wrong in the script. Same result, If I change the waveform knobs in the LFO Multi Modulator, nothing will update for the played note.
    No matter if retrigger is on or off.
    2) The rhythm does update immediately for the held note, despite the wave form change not working.

    Finally, the question:

    Am I doing something wrong and could I fix it and use Multi LFO for this purpose I want or should I attach all waveform LFOs to the parameter I want to modulate and when the buttons are selected on the interface, I would have to bypass all LFOs but the selected one?

    Thanks in advance,

    gd
     
  2. soundtrax

    soundtrax NI Product Owner

    Messages:
    301
    You are doing nothing wrong, as far as I know Kontakt's LFOs can't be changed while holding a note (it's only possible to change the LFO amount). Envelopes work the same, unfortunately...
     
  3. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Soundtrax is correct. You cannot change LFO waveform while voice is active.
     
  4. Gabriel Dib

    Gabriel Dib NI Product Owner

    Messages:
    88
    Yep, I did not fight the fact any further, instead I choose to add each single LFO modulator on each group and I am juggling the bypasses when selecting the respective waveform buttons on the GUI. Works really nicely and affecting any notes held.

    Thanks for the replies!
     
  5. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    I guess that's one solution but in more elaborate instruments you can quickly run out of internal modulators this way (you can only have them up to 16 per group).
     
  6. Gabriel Dib

    Gabriel Dib NI Product Owner

    Messages:
    88
    Aha the day I run out of modulators has become Mr. Dragon.
    I am duplicating a few LFOs in order to be able to have a "Retrigger" button on the interface. Only because I could not find on the documentation how to access the retrigger button of LFOs via script.

    Impossible at the moment?
     
  7. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Impossible at the moment. :(
     
  8. Gabriel Dib

    Gabriel Dib NI Product Owner

    Messages:
    88
    We can change a distortion from mono to stereo and can't change that... duh.
     
  9. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Yeah, I know. There's a number of engine parameters that are just not accessible to KSP. I made NI aware of them quite some time ago. :)
     
  10. Gabriel Dib

    Gabriel Dib NI Product Owner

    Messages:
    88
    I guess the long way is scripting my own LFOs... right?
     
  11. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Those can't be polyphonic (which you'd get with Retrigger being on).
     
  12. soundtrax

    soundtrax NI Product Owner

    Messages:
    301
    They really should add new master-LFOs and Envelopes so they could modulate the whole instrument and not the bloody groups (maybe those new Modulators could simply be added as new instrument insert effects).

    Having to use tons of LFOs for one instrument is really insane when one simple LFO could do the same job… (and it would sound so much better than Kontakt’s constantly out-of-phase multiple group LFOs).
    You could even change LFO and ENV settings while holding notes - like on any other synth.

    EvilDragon: do you think there are any chances we’ll see the Modulation stuff properly implemented in a future Kontakt update? Are the devs even aware of this wrong design of the synth engine?
     
  13. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Modulation in Kontakt is a really, really tricky subject. I would of course love to see more stuff there, but it's hard to guess if we'll see something new there any time soon. It's one of the oldest parts of Kontakt codebase (so, 17 years), I wouldn't expect any sort of overhaul because that is a huge risk that would break too many things.

    Not being able to change env parameters on the fly is a CPU optimization - envelopes are precalculated at note on. As for LFO, at least the rate is changeable in realtime (and amount, via modulation), which is arguably the most important parameter. You won't get much by changing phase or fade in in realtime because they are one-time settings only applied at note-on.

    I would say devs are aware of pretty much everything, but time vs effort vs outcome and work prioritization is what usually happens in bigger companies.
     
  14. Reid115

    Reid115 NI Product Owner

    Messages:
    40
    Can you speak a little more to how this works? If you're saying an array is populated with all of the values of the envelope in the NCB and then later accessed in a listener of some sort, wouldn't that be a huge array? I would think a listener running at 10 ms would mean you would need a 6500 integer array: ( 15000 (attack cap) + 25000 (decay cap) + 25000 (release cap) ) / 10 = 6500. Regardless, the number of calculations remains the same whether you're calculating the envelope value on the fly in the listener or all at once in the NCB. It would make sense for an LFO because that's just repeating the same cycle of values. I must be misunderstanding how it's done for envelopes. I guess if you're aren't continuously modulating the envelope then the values will just be the same each trigger. I just ask because I'm writing my own custom envelopes/LFOs and I want to make sure I'm doing it as efficiently as possible.

    On that subject, how exactly are modulators in general iteratively applied to targets? If I modulate something with a sine LFO and slowly increase the frequency to max, it sounds very continuous, like I'm actually hearing the curves up and down (i.e., the listener is running much faster than 10 ms). Is this just an auditory illusion? At 213 hz, an entire period is 4.69 ms, so you would need to update the target at fractions of a single millisecond.

    Also, this is no longer true with the addition of "from script", correct?
     
    Last edited: Dec 9, 2021
  15. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Kontakt internally processes things in chunks of 32 samples at a time (regardless of your audio interface sample rate). This is a CPU optimization. So any modulation is processed at this rate - once every 32 samples. So the whole block is precalculated in advance then shoveled out. The difference is, do you also apply any sort of modulation while the note event lasts, and this obviously adds overhead based on how many voices are playing. So for AHDSR envelope, modulation is taken out of the equation except at note on (and since 6.6, note off).

    A completely dynamic envelope that is updated all the time and is processed per sample is the flexible envelope module. Hence it also requires more CPU.

    Yep!
     
    • Like Like x 1