# MidiOutput::createNewDevice not creating MIDI device

**URL:** <https://forum.juce.com/t/midioutput-createnewdevice-not-creating-midi-device/47759>\
**Category:** General JUCE discussion\
**Created:** [September 10, 2021, 7:10am UTC](https://forum.juce.com/t/midioutput-createnewdevice-not-creating-midi-device/47759 "2021-09-10T07:10:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucian303](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lucian303/32/11762_2.png) [@lucian303](https://forum.juce.com/u/lucian303)\
**Post date:** [September 10, 2021, 7:10am UTC](https://forum.juce.com/t/midioutput-createnewdevice-not-creating-midi-device/47759/1 "2021-09-10T07:10:28Z")

</div>

I’m modifying the MidiDemo and I have the below code, trying to create a new MIDI device on macos 11.5.2. The code compiles and runs, and seems to send the message, but the MIDI port is not actually available in the OS (standalone) or the DAW (VST3) so I’m not sure what is happening or how to create a virtual midi device. I can create a virtual midi device using the receivemidi CLI utility and in that case it works and MidiDemo sees it, but with the call below, it does not see it. Listing the available devices also does not list it. Manually adding the output to the list and trying to use it in the MidiDemo doesn’t work. I can use the one I create with the cli tool, however. Not sure what else I have to call or do to get the new virtual MIDI device to actually show up in the system/DAW. My use case is a sequencer that can run standalone and as a VST.

```auto
        auto newDevice = juce::MidiOutput::createNewDevice("Test2");
        if (newDevice) {
            newDevice->startBackgroundThread();
            MidiMessage message = MidiMessage::noteOn( 1, 64, 1.0f );
            newDevice->sendMessageNow( message );
        }

```

listing devices doesn’t show it and it doesn’t actually work despite returning back an object that seems to work:

```auto
            auto idevices = juce::MidiInput::getAvailableDevices();
            for (auto device : idevices) {
                juce::Logger::writeToLog(device.name);
            }

            auto odevices = juce::MidiOutput::getAvailableDevices();
            for (auto device : odevices) {
                juce::Logger::writeToLog(device.name);
            }

```

---

<div class="post-metadata">

**Author:** ![bcsuganthan](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@bcsuganthan](https://forum.juce.com/u/bcsuganthan)\
**Post date:** [December 19, 2021, 4:26am UTC](https://forum.juce.com/t/midioutput-createnewdevice-not-creating-midi-device/47759/2 "2021-12-19T04:26:06Z")

</div>

From [MidiTest example: Virtual MIDI Output device listed as Input (OSX) · Issue #223 · juce-framework/JUCE · GitHub](https://github.com/juce-framework/JUCE/issues/223),

When we create a MidiOutput device `newMidiOut = MidiOutput::createNewDevice("My App")` , that will appear for other apps in their MidiInput list. What we need is to send MIDI output to that. However like you mentioned, it is not available in the `MidiOutput::getAvailableDevices()`.

So how do we send MIDI to the device we just created?

In my case, I’m having a custom standalone of a plugin. In `StandalonePluginHolder::audioDeviceAboutToStart(...)`, if I set `player.setMidiOutput(newMidiOut.get())`, the MIDI is now sent to the newly created virtual MIDI output.
