question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to send raw MIDI messages

See original GitHub issue

Is there any way to send raw MIDI messages using SendEvent() in the form of a byte[] and bypass the object wrappers? Because sometimes the user needs to be able to send a non-predetermined or ambiguous MIDI command, including ones not defined in the standard MIDI spec.

For example the managed-midi library allows you to do this as such: outputDevice.Send(new byte [] {0x90, 0x40, 0x70}, 0, 3, 0);

I was hoping that drywetmidi has an equivalent function. Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
melanchallcommented, Dec 19, 2019

I decided to keep current signature of SendEvent. BUT it’s obviously useful to have ability to get events from bytes. So I’ve added two classes:

  • BytesToMidiEventConverter which takes bytes array and returns MidiEvent read from the bytes;
  • MidiEventToBytesConverter which takes MidiEvent and returns byte array representing the event.

Both classes implement IDisposable so don’t forget to use these classes inside using block or call Dispose manually.

So you can use BytesToMidiEventConverter to get MidiEvent and then pass that event to SendEvent method of OutputDevice.

Although it looks a bit complicated, in my opinion this way is much more flexible since it’s basic. New classes can be used for different scenarios, not for MIDI events sending only, providing the same API.

New classes are in develop branch so if you want to use them right now, please build the library from sources.

0reactions
melanchallcommented, Jan 31, 2020

@clarkx86, I received notification about your comment but unfortunately I don’t see it on GitHub 😦 You’re interested in when I’ll release new version of the library including changes regarding this issue. I can’t say exact date but I’ll try to make release in the beginning of February.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SendMIDI and ReceiveMIDI
SendMIDI and ReceiveMIDI are multi-platform command-line tools that make it very easy to quickly send, receive and monitor MIDI messages ...
Read more >
App to send raw midi to a device
Are there any simple apps that allow you to send a custom stream of midi info to a device? Not Sysex formatted, but...
Read more >
Monitoring Raw MIDI data
What I would like to see is the ability to display the raw data bytes that are received at the MIDI input without...
Read more >
MIDI tutorial for programmers
The MIDI messages are sent as a time sequence of one or more bytes (8 bits). The first byte is a STATUS byte,...
Read more >
Midi SysEx Messages - Support, Help & Resources - in_thread
I looked into the various methods of sending raw midi described here, and they all worked for me with the limitations mentioned. (E.g....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found