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

Glitch-free audio / snapshot changes when purging groups

Discussion in 'Scripting Workshop' started by Rob Jackson, Sep 15, 2021.

  1. Rob Jackson

    Rob Jackson New Member

    Messages:
    15
    So, I'm working on one of these big snapshot-based instruments where each different sound is in a different group. Changing a snapshot will often require changing the corresponding group so I'm doing the usual thing of purging / un-purging groups when a new snapshot is selected.

    AOK so far?

    I've had some feedback on the instrument about noticeable pops / clicks etc., when (presumably) changing snapshots. It's more noticeable if you've got long release times and / or delay / reverb tails ringing out while you're scrolling through snapshots. Basically the audio output is choking as you purge the group.

    I had kinda figured this was normal / expected / acceptable (?) but it also got me wondering about anything that's do-able in the script to reduce or minimise these audio glitches - reducing output volume / fade in / out, that sort of thing?

    I looked at some NI libraries and they seem to "suffer" from the same thing, but still...

    Wondering if anyone here had looked at this before, and if they're willing to share what they came up with? Thanks!
     
    Last edited: Sep 15, 2021
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    IIRC you don't need to purge/unpurge on snapshot load, zone purge state is already saved in snapshots.
     
  3. Rob Jackson

    Rob Jackson New Member

    Messages:
    15
    Thanks ED, I found and removed some redundant code that was checking the purge state so it wasn't really doing anything. Still get "glitches" when changing snapshots though if the note has a long decay etc. I guess the question is really whether that's expected / normal / acceptable.

    I'm guessing the "audio glitching" (still waiting on clarification on this) is due to:

    Loading a snapshot always resets KONTAKT's audio engine, i.e. audio is stopped and all active events are deleted.

    From KSP reference.
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Yeah so you may try fade_out($ALL_EVENTS, 1000) at the beginning of "on persistence_changed", but if that doesn't help, it's just how it is.
     
  5. Rob Jackson

    Rob Jackson New Member

    Messages:
    15
    Thanks ED, yeah... I tried a fade_out() call as you suggest, and I couldn't hear any difference. Maybe the audio engine has already been bounced by the time persistence_changed gets invoked. It was worth a try though!