Provide the ability to ignore irrelevant events when converting from Bytes to MIDI #192
Replies: 6 comments 18 replies
-
Can you please explain this in more detail? DWM should be able to read all MIDI events allowed by MIDI spec. I suppose your device sends sys ex events, but DWM should successfully read them. Please show your code, exceptions and all data that can be useful to understand your issue and what's going on. |
Beta Was this translation helpful? Give feedback.
-
Please find below a sample of MIDI messages from the Yamaha Workstation that throws UnexpectedRunningStatusException. byte[] data = Convert.FromBase64String("ATEA91Ej7J0vGgEAGgEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="); |
Beta Was this translation helpful? Give feedback.
-
I am attaching a log of messages that leads to the UnexpectedRunningStatusException exception. |
Beta Was this translation helpful? Give feedback.
-
@joaodarocha1 Thanks for the last log. Well, it's my fault, I forgot a small thing –
And that's why DryWetMIDI tries to read sys ex event length although there is no length there since the data got from a device, not from MIDI file. Right now there is no way to convert sys ex bytes without length with But as for last data
It's strange anyway. It looks like it's the end of previous sys ex
But why last bytes are sent seperately along with |
Beta Was this translation helpful? Give feedback.
-
🚀 6.1.2 version is released now! Prerelease NuGet packages will be unlisted soon, so please update the package references to the new version. Thanks for using the library! |
Beta Was this translation helpful? Give feedback.
-
Sorry for the late reply. I was not working on this project for a while. It is working now. I've added a video of the app working connect to the Yamaha keyboard. VID-20240229-WA0003.mp4 |
Beta Was this translation helpful? Give feedback.
-
Method: BytesToMidiEventConverter.ConvertMultiple(byte[] bytes, int offset, int length)
When converting a stream of device messages to Melanchall.DryWetMidi.Core.MidiEvent we need the ability to select only the relevant events. A device such as a Yamaha Genos will send too many irrelevant system messages. DryWetMidi will fail to read them and throw too many exceptions.
It would be great to get only the relevant messages types such as EventStatusBytes.Channel.NoteOn and EventStatusBytes.Channel.NoteOff. Once we have the statusByte we could skip the event and move on to the next one.
Beta Was this translation helpful? Give feedback.
All reactions