Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on Windows: "non-sysex message must not be longer than 3 bytes" #156

Open
hintron opened this issue Jun 14, 2024 · 1 comment
Open

Comments

@hintron
Copy link

hintron commented Jun 14, 2024

I'm trying to play out the contents of a MIDI file for a particular song, and it works on MacOS but not Windows. The error I get on Windows is "non-sysex message must not be longer than 3 bytes" and it comes from here, I believe:

if nbytes > 3 {
return Err(SendError::InvalidData(
"non-sysex message must not be longer than 3 bytes",
));
}

The message I'm trying to send to my external instrument is a TrackName meta event that is 83 bytes long. Now that I think about it, though, it probably is pointless to send meta events to an external instrument over a MIDI cable, right?

So either I should just stop sending superfluous Meta events to my external instruments, and the MacOS backend should have a 3-byte check added to it like Windows does, or else the Windows backend should allow sending meta events by removing the check.

@Boddlnagg
Copy link
Owner

Boddlnagg commented Jun 27, 2024

The winmm backend uses midiOutShortMsg unless the message is a sysex message (first byte is 0xF0).
According to https://www.recordingblogs.com/wiki/midi-meta-messages, meta messages are not sysex messages and should not be sent over MIDI ports. Now I'm curious what happens when you do that on macOS? Does it do anything or is that message silently swallowed by the receiver (or the driver)?

In general, midir does not put additional limitations on top of the platform APIs, so the difference here is in what the Windows vs macOS APIs ingest. On Windows we need the check because the API does not allow more than 3 bytes.
Now on the other hand we want to provide some consistency between platforms, so maybe something should be done ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants