SpotlightKid / python-rtmidi

Python bindings for the cross-platform MIDI I/O library RtMidi
https://spotlightkid.github.io/python-rtmidi/
Other
349 stars 64 forks source link

ALSA incomplete message on Pi #179

Closed peladonian closed 9 months ago

peladonian commented 9 months ago

I am getting the "UserWarning: MidiOutAlsa::sendMessage: incomplete message!" when sending MIDI from a Raspberry Pi.

Here is an example string that causes the error: "f0,43,30,3e,19,b0,62,31,b0,63,26,b0,06,7f,b0,26,7f,f7"

Transmitting this from Windows works fine, but fails when I run it from the Pi. I can send it from the Pi using "amidi -S".

SpotlightKid commented 9 months ago

Here is an example string that causes the error: "f0,43,30,3e,19,b0,62,31,b0,63,26,b0,06,7f,b0,26,7f,f7"

b0 (0xB0) is not a valid byte in a SysEx message. All data bytes between 0xFO (start of exclusive) and 0xF7 (end of exclusive) must not have the high bit set.

peladonian commented 9 months ago

It's not a SysEx message, it's NRPN data to a Yamaha QL5 mixing console. This particular command turns on the EQ for a specific channel. If I send it from my Windows laptop it is transmitted and the console responds correctly. If I send it from the Pi, ALSA tells me it's incomplete.

SpotlightKid commented 9 months ago

If its starts with 0xF0, it is a SysEx message per the spec.

http://www.somascape.org/midi/tech/spec.html#sysexmsgs

If you can show me the manual with the MIDI implementation of the QL5, maybe I can tell you, what the correct message would be. Maybe the data bits need to split into 4-bit nibbles?

peladonian commented 9 months ago

The reference manual is here: https://usa.yamaha.com/files/download/other_assets/5/798485/ql5_1_en_rm_c0.pdf The NRPN data and MIDI specs are near the end under the "Data List" section.

There's also a spreadsheet of parameters in a zip file: https://usa.yamaha.com/files/download/other_assets/7/811827/MIDI_Parameter_Change_specification_for_CL_QL_series.zip

While those where helpful, I ultimately figured out most of it simply by making changes on the console and capturing them with MIDI-OX.

SpotlightKid commented 9 months ago

You probably want your message to comply to Section "Data List - MIDI Data Format - 4.1.1 Format (PARAMETER CHANGE)" of the reference manual. You should be able to learn the needed parameter element and index numbers from capturing a message when "PARAMETER CHANGE Tx" is on and you change the setting on the device.

SpotlightKid commented 9 months ago

BTW, the 3 in the high nibble of the third byte (0x30) of your message indicates that this is a "PARAMETER REQUEST" message, not a "PARAMETER CHANGE". You won't be able to change a parameter with this.

peladonian commented 9 months ago

OK, looking at 4.1.1, it looks like I can simply leave out the b0's. If I do that, I'm transmitting successfully from the Pi to my desktop, where it's captured by MIDI-OX. I will try that on the QL5 and see what I get.

0x30 change vs parameter: I see what you mean. Oddly, it works anyway. Maybe because echo is enabled? I will have to experiment and see.

I appreciate your help, this has given me a promising path to try. I think at this point I'm stuck until I can actually test with the QL5, which won't happen until tomorrow evening. Thanks!

peladonian commented 9 months ago

I was able to spend some time last night after all. The QL doesn't seem to care about 0x30 vs 0x10, both worked the same for me, despite "echo" being off. It worked without the first three 0xb0's, but stopped when I took out the last one. I get the feeling that there's probably a way to "word" my request differently that would be compliant, so I'm going to conclude that it isn't a python-rtmidi issue. Thanks for your help!