Midi timing inconsistencies on midi efect plugin with Juce

Hi,

I am working on a midi effect plugin, which works fine on AU and VST2, only if the track of the plugin is being selected during its operation. When I select a different track on the DAW and let it run, timing inconsistencies do happen. I could not bring any explanation yet and leaving that aside for now and decided to try the midi Arpeggiator demo of Juce.

As you see on the attached video , two instances of this plugin never sound in sync on identical tracks. Then I have tried the same with the Logic Arpeggiator and it sounds perfect.

What is your experience on this matter ? Anything to take care of on Juce to solve this ? I hope to not freak out while digging this.

thanks

MidiIssues.mov.zip (1.9 MB)

Does this also happen when you don’t start playback right at the beginning, but - let’s say - at the second bar ?

Yes, see attached video. I could not see any flaw on the logic of its code. Both plugins should receive the midi note at the same moment, this is what the DAW is doing and should do. However the audible time delays are amazing. And again the same setup works perfect with Logic’s own arpeggiator.

I should emphasize that this is a serious issue. So any comment from JUCE developers are welcome.
midiissue2.mp4.zip (1.5 MB)

and while we are on it, I want to share the behavior of my midi effect plugin. Please see attached video.

While its track is being selected, it performs as it should be, however when another track is selected, the regular intervals collapse. The plugin works precise only when its track is being selected, it can even generate granular level event sequences with precision timing.

Any useful explanations are welcome.

midiissue3.mp4.zip (1.3 MB)

Hi,

I have made some improvement on the code of Juce Midi ArpeggiatorPlugin demo. Hence;

The processblock was processing this time value;

time = (time + numSamples) % noteDuration;

which was only set to 0 at prepareplay method.

So I have resetted it during a note-on event as well as such;

for (const auto metadata : midi)
        {
            const auto msg = metadata.getMessage();
            if      (msg.isNoteOn()) {
                time = 0;
            notes.add (msg.getNoteNumber());
                
            }
            else if (msg.isNoteOff()) notes.removeValue (msg.getNoteNumber());
        }

However see the attached video. Now it plays correct when I start from the zero locator position, but still there is an issue if I start a bit later. So this code is useful and should be there, however does not solve the situation entirely.

midiissue4.mp4.zip (1.0 MB)

Hi, that’s not what I meant. Set the playback cursor further into the arrangement so that the playback doesn’t start right at the beginning when you hit the space bar.

image

see futher videos !