Accurate Timing for Parameter Reads in Block-based Processing

My plugin incorporates a feature for real-time preset switching, aimed at supporting rhythmically timed preset changes. Generally, the function performs well, however, I’m running into issues when the switching rate increases - for example, every 16th note.

The problem arises when the parameter change is invoked in the middle of a block. Due to block-based processing, the parameter change isn’t registered until the next block begins, effectively delaying the change until the following cycle. In the context of an audio processor, this might not be a noticeable issue. However, my plugin is a MIDI processor, meaning any delayed preset change would result in incorrect MIDI output until the change is eventually processed.

My goal is to ensure that this function works efficiently with parameters, although I’m considering using CC message reads within the block as a possible workaround. However, I’m uncertain about whether this would be compatible with VST3 MIDI, as well as AU/AAX.

An optimal solution for me would be to use MIDI program changes to facilitate this, but my attempts at implementing this approach have been unsuccessful so far - the changes didn’t seem to get received in VST3.

I’m looking for advice or suggestions on how to better manage the timing of preset changes within my block-based processing system, to ensure accurate MIDI output even with rapid rhythmic preset switching. Any insights would be appreciated.

You need to internally split your processBlock to smaller sizes whenever a change message happens via MIDI.

You can look at juce::Synthesiser and juce::MPESynthesiser for inspiration as they do the same thing (for example, to make sure a MIDI CC message arrives to all voices at the right place in the block).

1 Like

from memory, preset changes from the DAW are NOT sample-accurate in VST.
we did something similar in this product (sample-accurate program changes) to achieve the stutter effect…

But the rhythmic program change was managed completely internally to the plugin (the DAW wasn’t involved).

2 Likes

JUCE VST3 can receive MIDI program change messsages?
I was only able to see Bank Select and Sub Bank (which come over CC)
To add to the confusion I understand VST3 also has a type of program change that may not be the same thing?