Creating custom output with MidiOutput?

Hi all,

Relatively new to JUCE and having trouble understanding (or even getting started with) the MidiOutput class.

I’ve got a MacBook and am looking to not use any external midi devices. My goal is to have a virtual MIDI output with a custom name coming from a standalone app to any kind of DAW (starting with ableton and Logic Pro).

I’ve tried adding this code to the private variables for PluginProcessor:

std::unique_ptr<juce::MidiOutput> mVirtualMidiOutput;

And adding this to the constructor to the PluginProcessor:

mVirtualMidiOutput = juce::MidiOutput::createNewDevice("MIDI-Output");

But I’m not sure what other lines need to be added so I can send out midi data. Currently I see that it’s an available option to choose in the settings of the app (once launched) and it’s a midi input for ableton and logic, but I can’t send it data. I naively tried to use the MidiBuffer through the processBlock but that hasn’t worked.

Any help would be appreciated!

Are you trying to create a GUI app or a plugin based app?

In a plugin based project, the implementation goes like this,

In StandalonePluginHolder::StandalonePluginHolder(...) // creation ,

        virtualPort = MidiOutput::createNewDevice("MIDI-Output");
        if (virtualPort)
            virtualPort->startBackgroundThread(); // If you want to use MidiOutput::sendBlockOfMessages()

In StandalonePluginHolder::audioDeviceAboutToStart (...) // sets the midi output,


Please note that you have to do additional coding to get it work along with the “Audio/MIDI Settings” window. The standalone app’s MIDI Output will not show the internally created virtual port.