0

I use the Midi Toolkit from Leslie Sanford. I can send midi messages without problems. But I can't receive any message.

When I send a "note on" with sendmidi.exe dev "loopMIDI Port2" ch 13 on 13 42 (tool url: https://github.com/gbevin/SendMIDI)

I can see the message in Midi-OX but with the Midi Toolkit I can't receive it (I close Midi-OX befor I use the port myself).

I open the InDevice with midiIn = new InputDevice(0, true, false); // 0 is for example "loopMIDI Port2"

and install some handler (Channel, sysex, error) - here is the standard MessageReceived:

midiIn.MessageReceived += HandleMessageReceived;

private void HandleMessageReceived(IMidiMessage message) { ... }

I can rule out sending the message to a wrong port.

I saw that midiOpen and midiClose event works (in InputDevice.HandleMessage) if (msg == MIM_OPEN) and if (msg == MIM_CLOSE) ...

I don't understand, why receive doesn't work.

I used NAudio befor but the MIDI_IO_STATUS isn't set that is nessessary for SysEx messages. I can't compile the NAudio project.

Has anyone a tip for me?

hoss
  • 25
  • 3
  • I'm the author of [DryWetMIDI](https://github.com/melanchall/drywetmidi) library and also don't use MIDI_IO_STATUS. I know that the library users successfully send/receive MIDI events via provided API including sys ex events. Also all my unit tests are passed with sys ex events. Why this flag is required? – Maxim Jun 25 '20 at 08:43
  • Thanks for your response. I read this article http://midi.teragonaudio.com/tech/lowmidi.htm and I thought the flag must be set because the author wrote "NOTE: Windows sends an MIM_MOREDATA event only if you specify the MIDI_IO_STATUS flag to midiInOpen().". With NAudio I can't receive SysEx messages. Channel events and Control change events works. – hoss Jun 25 '20 at 22:28
  • But just I see that I misunderstand that. It's only nessessary if I handle the message not fast enaugh. Ok, then I do not understand why I cannot receive SysEx events in NAudio (and in Sanford-Toolkit nothing). – hoss Jun 25 '20 at 22:37
  • Just for test purposes, can you test events receiving with [DryWetMIDI](https://github.com/melanchall/drywetmidi)? If it won't work too, that it seems something wrong with events sending or something not related with libraries. You can find example of events receiving here: https://melanchall.github.io/drywetmidi/articles/devices/Input-device.html. – Maxim Jun 26 '20 at 08:38
  • With DryWetMidi it works. I test NoteOn, Control change and SysEx. Output from DryWetMidi is "Normal SysEx". If I send SysEx from Microsofts Midi example in UWP the message isn't received but that can be an issue in the Midi Send example. – hoss Jun 26 '20 at 17:59
  • Yes, `NormalSysEx` is a type used in DryWetMIDI for sys ex events (there is also `EscapeSysEx` extremely rarely used in MIDI files). Regarding receiving problem in UWP with DryWetMIDI, can you please [open an issue](https://github.com/melanchall/drywetmidi/issues/new) on the library GitHub so we try to solve the problem? – Maxim Jun 27 '20 at 11:36
  • I think it's not a problem in drywetmidi. I tested this with https://github.com/gbevin/ReceiveMIDI. That prog can receive sysex definitly. The Midi-UWP-App has a bug. Maxim, many thanks for the Link to DryWetMidi. I'll use it! – hoss Jun 27 '20 at 20:11

0 Answers0