I need to diagnose a weird symptom where spurious MIDI messages might be sent to a specific piece of MIDI hardware which is connected via USB. I don't know about software which allows monitoring MIDI output straight away, and because the external hardware is connected via USB MIDI, I cannot wire the physical output to anywhere else.

Is there a (possibly not so obvious) way of sniffing outbound MIDI traffic?

It's okay if "programming" is needed (Python is my friend).

  • What software sends these messages? How can its output port be configured? – CL. Apr 1 '20 at 20:06
  • The point is that I'm not aware of any software sending messages to the output. I've not connected anything to the output. So if anything is sent, it's happening "under the grass". That's why I'd like to see what is being sent to the output, or make sure that there's indeed nothing sent. – Alpi Murányi Apr 5 '20 at 18:19
  • Use lsof /dev/snd/* to check what programs have opened a MIDI or sequencer device. – CL. Apr 5 '20 at 20:25
  • Thanks @CL. for the idea. Only Pulseaudio was listed. I killed it, and none of the devices were reported as opened any more. Still, MIDI hardware misbehaves unless the input from it is connected to QMidiRoute. – Alpi Murányi Apr 7 '20 at 16:39
  • I guess this device misbehaves if the messages are not actually read by the PC. – CL. Apr 7 '20 at 19:38

Maybe midisnoop is helpful:

sudo apt-get install midisnoop

I was also surprised after many websearches, that while inbound MIDI is easy to monitor in Linux, outbound isn't.

You mentioned your MIDI is transported over USB. I just very successfully used Wireshark USB capture to reverse engineer MIDI device comms (manufacturer-specific SYSEX messages). You can use filters to only show MIDI events (or even more specific MIDI packet types)

WARNING: plug the USB device in AFTER you've started the capture in Wireshark, because Wireshark needs to see the USB "handshake" (USB descriptor messages) to be able to dissect the messages, otherwise it's just opaque USB data whose protocol Wireshark doesn't know about.

edit: here's a blog post of mine describing things in greater detail

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.