Hello everybody, I am new to Juce so there a lot of things I have to discover
I would like to now which are the essentials steps to create a button that sends out a MIDI note to an external MIDI device. I am missing something somehow on the creation of the MIDIoutput and on the actual sending of the note.
thanks.
d
Post your code, then we can see where your problem might be.
What I donāt understand is how I create an Instance of the MidiOutput class,
Or what I have to do once the MidiMessage:: noteOn is ready.
From the docs:
To create one of these, use the static getAvailableDevices() method to find out what outputs are available, and then use the openDevice() method to try to open one.
Calling getAvailableDevices gets you an Array of MidiDeviceInfo. So you need to pick one of those and use its deviceIdentifier
to create a MIDIOutput instance, as a std::unique_ptr
, e.g. to get the first available device:
auto availableOutputDevices = MidiOutput::getAvailableDevices();
if (availableOutputDevices.size() > 0)
{
auto midiOutput = MidiOutput::openDevice (availableOutputDevices[0].deviceIdentifier);
}
A more convoluted example at https://github.com/juce-framework/JUCE/blob/02bbe31c0d2fb59ed32fb725b56ad25536c7ed75/examples/Audio/MidiDemo.h#L418
thanks Adam, I was missing that part.
then another related question, is there a way to do something like this:
sendNote.onClick = [this] {myMidiOutput->sendMessageNow(MidiMessage::noteOn (3, 36, (uint8) 127));};
which now does not work because āmyMidiOutputā cannot be implicitly captured in a lambda
The MIDI output object should be a member variable in your class and then capturing āthisā would allow using it. Do you have the MIDI output as a local variable nowā¦?
yes now, it is Local. I will try again to declare it in the class definition. thanks for the advice.
Hey,
Iām also trying to send out midi but i canāt get it to work, receiving midi is fine but I want to send out and canāt get it to workā¦
When i try to send out: midiOutput->sendMessageNow(mySysEx); I get use of undeclared identifier midiOutput.
Iām also not sure how to open a midiout, preferably i would want to send it out to the daw so the user can select where to send it outā¦
To send MIDI to the DAW, just modify the MidiBuffer that is passed to your pluginās processBlock
.
Hey, tx for your answer, Iām actually doing this but I only receive 5 bytes from this code (but as my plugin is recognized by Ableton as an audio plugin Iām not even sure if it can work)
So first question, how do i change my plugin to be recognized as a midi plugin in my DAW?
This is the code but as said, itās an audio plugin so not sure it can work:
const uint8 rawSysEx[13] = {0x65, 0x16, 0x0, 0x0, 0x0, 0x69, 0x18, 0x16, 0x2, 0x4, 0x4, 0x5, 0x4};
MidiMessage mySysEx = MidiMessage::createSysExMessage(rawSysEx,13);
processedBuffer.clear();
processedBuffer.addEvent(mySysEx, samplePos);
As you said, this isnāt possible in Live, but itās possible to route MIDI from Instrument/FX plugins to other channels.
The code you posted looks like it should work, provided Live doesnāt do any additional filtering/processing of sysex messages.
*Update, ok I just found out AU doesnāt handle Midi I used VST3 now and Iām getting one step closer, ow boy this is gonna take a while
In the youtube tutorial by Eyal Amir he talks about that Logic handles it also different so Iām curious if you know anything about that?
Unlike Live, Logic does let you insert dedicated MIDI FX before an instrument plugin. If you set the āPlugin MIDI Inputā, āPlugin MIDI Outputā, and āMIDI Effect Pluginā options in the Projucer, your AU plugin should be usable in MIDI FX slots in Logic.
Oh ok, that is very usefull! If i set the āMidi effect pluginā option and load it into live (using AU) It doesnāt load the AU plugin. Thatās why i got really confused.
Thank you for clarifying! This gives me hope!
Ok, still stuck, I tested to send altered midi notes through the VST3 and that works but it wonāt pass sysex messages, any thoughts?
Have you tried sending sysex messages from Logicās built-in āScripterā plugin when inserted as a MIDI FX plugin? If that doesnāt work, then youāll probably need to adjust your Logic configuration to allow Sysex output. Or, this may not be possible in Logic at all. Either way, youād need to refer to Logic-specfic documentation/FAQs etc. in order to find out whether this functionality can be enabled.
Iām using Ableton, sysex doesnāt seem to work (regular midi does) I donāt have Logic so canāt test that
This page gives the impression that SysEx is only supported via Max4Live. Itās not clear whether SysEx from VST3s is supported.
Yeah, I think Iām gonna try and create a standalone JUCE app for this, any tips or examples would be highly appreciated.
In the meantime Iāve succesfully sent midi sysex out, Iāve created a standalone app as vstās and DAW all react differently on sysex.