Only Note On/Off messages are being outputted in plugin format

Hi everyone, I’ve been building a plugin that takes in audio and outputs midi events based on the incoming audio. I am trying to send note on, off and pitch bend messages. Everything works fine when running the standalone build and routing the midi to the IAC. For some reason though, when running the plugin inside of a host only on and off messages are sent.

This is the code I am running.

if (note.frequency != -1 && m_isNoteOn == false)
    {
        m_isNoteOn = true;
        m_lastNote = note;

        auto pitchBendVal = chroma::Midi::getPitchBend(chroma::Midi::distanceInCents(m_lastNote, note));
            
        int msb = (pitchBendVal >> 7) & 0x7F;
        int lsb = pitchBendVal & 0x7F;

        juce::MidiMessage pitchBend(0xE1, lsb, msb);
        juce::MidiMessage noteOn(0x91, note.note, 100);

        midiMessages.addEvent(pitchBend, 0);
        midiMessages.addEvent(noteOn, 0);
    }
    
    else if (note.frequency == -1 && m_isNoteOn == true)
    {
        m_isNoteOn = false;
        juce::MidiMessage noteOff(0x81, m_lastNote.note, 100);
        midiMessages.addEvent(noteOff, 0);
    }

    else if (m_isNoteOn)
    {
        auto pitchBendVal = chroma::Midi::getPitchBend(chroma::Midi::distanceInCents(m_lastNote, note));
            
        int msb = (pitchBendVal >> 7) & 0x7F;
        int lsb = pitchBendVal & 0x7F;

        juce::MidiMessage pitchBend(0xE1, lsb, msb);
        midiMessages.addEvent(pitchBend, 0);
    }

I am wondering if this is a plugin format limit of some kind.
Thanks in advance for your help.

It would be helpful to know the host and plugin format that you are testing.

I’ve tried hosting in Max/MSP and Ableton Live and have tried AU and VST3. Running on Mac OS.

Ok, just tested it again and it actually seems that only the VST3 is not working.

This is probably due to a limitation of VST3 itself. VST3 doesn’t natively handle MIDI messages. It has its own event types, and each host must correctly implement conversions between MIDI and VST3 events. It could be that Live and Max aren’t correctly converting these messages.

2 Likes

I can confirm that I ran into the same problem trying to pass MIDI CC data to the output midi buffer in a VST3 plugin. Only Note On/Off events would go through. This was still a problem after updating to JUCE 7 and trying every possible configuration of the plugin attributes.

1 Like

I had the same issue. I ended up removing the VST3 MDI effect of my plugin for this reason. Luckily I have a VST2 license…