melanchall / drywetmidi

.NET library to read, write, process MIDI files and to work with MIDI devices
https://melanchall.github.io/drywetmidi
MIT License
523 stars 73 forks source link

sysEx Message data #208

Closed amritgenius closed 1 year ago

amritgenius commented 1 year ago

Sorry to bother you. this library is great but i need something to read the sysex messages sent over midi. im getting the event but can't able to read the raw message.

melanchall commented 1 year ago

Can you please describe your problem in more detail? Do you receive MIDI events via InputDevice? What do you mean "raw message"? Do you need to get bytes from sys ex event?

amritgenius commented 1 year ago

Hello Sir, let me explain a bit, there is a software called hauptwerk, that software send the data over midi like 39 byte of data or 39 bit, sorry i'm not data structure person hahah, i'm writing a software in c# in which i want to capture the data ( as from input device ) but i need the bytes as you said before.

Thankyou. Singh

On Wed, Aug 10, 2022 at 11:11 PM Maxim Dobroselsky @.***> wrote:

Can you please describe your problem in more detail? Do you receive MIDI events via InputDevice? What do you mean "raw data"? Do you need to get bytes from sys ex event?

— Reply to this email directly, view it on GitHub https://github.com/melanchall/drywetmidi/issues/208#issuecomment-1211278439, or unsubscribe https://github.com/notifications/unsubscribe-auth/APCU5M2NQGZAWFSRDT4DDC3VYQLJDANCNFSM56F5SA4Q . You are receiving this because you authored the thread.Message ID: @.***>

melanchall commented 1 year ago

Hi Singh,

Try this code:

var converter = new MidiEventToBytesConverter();
var bytes = converter.Convert(midiEvent);
amritgenius commented 1 year ago

private void OnEventReceived(object sender, MidiEventReceivedEventArgs e) { var converter = new MidiEventToBytesConverter(); var bytes = converter.Convert(e); string result = Encoding.UTF8.GetString(bytes); Console.WriteLine(result); }

NO, MidiEvent and MidiEventReceivedEventArgs are two different things. Error says its not possible to convert one from the other.

amritgenius commented 1 year ago

Ok,
var bytes = converter.Convert(e.Event);
solved the problem. Thankyou So much for the support. Love From Italy.