Bug in midi processing


#1

Hi, I’ve noticed a couple of bugs in Juce when creating midi plugins.

First when creating a midi effect plugin the producer doesn’t correctly override AudioProcessor::isMidiEffect in the code it auto generates so this needs to be done manually.

Secondly and more importantly there appears to be a timing error in the way Juce processes the midi buffer passed to AudioProcessor::processBlock. It’s easy to recreate by creating a new midi effect plugin project using the producer and leave the code untouched (except for overriding the isMidiEffect function as described above) so that the midi buffer is simply passed through without being touched. Build the dll and load it into your DAW. Create two tracks with a sampler in each playing a short sample such as a hi-hat every 16th note and on one of the tracks insert the midi effect plugin you just built. If you play this a listen carefully you’ll hear that the timing of the track with the midi effect shifts around compared to the other. The shift isn’t constant but appears to increase for a duration then resets periodically. You can see this more clearly if you render out the audio from each track and compare them.

The following screen grab shows the issue. The top waveform is the track without the midi effect, and the bottom is the track with the midi effect. Observe how the bottom one drifts around compared to the top one:

Does anyone know of a way to fix this?


#2

Are you saying this happens in every DAW and every plugin format, on both OSX and Windows?

…because if not, then telling us some of those basic facts about where you’ve seen this actually happen would be a good start!


#3

Clearly I’m not am I since that would be unreasonable. You only had to ask. I’m running a PC under windows 10 and I’m using Bitwig for my DAW. Since you asked I also tried to test this using the trial version of Ableton Live 9 I have at the moment but I was unable to setup the test since the plugin wasn’t detected as a midi effect. Dragging an instance into the timeline creates an audio track rather than a midi track. I have all of Plugin Midi Input, Plugin Midi Output, and Midi Effect Plugin enabled in producer.


#4

Thanks, so it’s clearly not an AU or AAX but is it a VST2 or VST3? Every combination of plugin type/DAW/OS uses a very different rendering codepath, so we need to narrow this kind of thing down before someone here spends time investigating!


#5

I’m building it as VST2. Here’s the jucer file xml in case there’s anything else you need to know:

MidiTest.txt (3.9 KB)