Page 1 of 1
MIDI I/O - Editing channel data
Posted: Thu May 05, 2016 5:53 pm
by Father
Hi
I was trying to read from midi split and change a certain note to another one, but when changing the notes value, it seems some notes get stuck while playing 2 or more notes.
I'm guessing note off messages get mixed up somehow?
Do we need to hold playing notes in an array manually, or something?

- midievent.jpg (27.44 KiB) Viewed 12846 times
Any thoughts on this?
Re: MIDI I/O - Editing channel data
Posted: Thu May 05, 2016 8:03 pm
by Walter Sommerfeld
Hi,
look at the ruby 'reading/creating Midi Objects' Part in the User Guide!
should work fine 4 ur needs!
Re: MIDI I/O - Editing channel data
Posted: Thu May 05, 2016 8:22 pm
by Father
[quote="Walter Sommerfeld"look at the ruby 'reading/creating Midi Objects' Part in the User Guide! should work fine 4 ur needs![/quote]
I'm actually doing it with ruby. Something like this:
Code: Select all
midi_out = Midi.new @original_state,@original_channel,@replaced_note,@original_velo
But i was looking for more information about it how things are working, and how to handle multiple notes.
Re: MIDI I/O - Editing channel data
Posted: Thu May 05, 2016 8:50 pm
by tulamide
There's quite a lot info here on the forums about simultanous/overlapping midi notes. Short summarize:
-You need a midi buffer, which simply is an array.
-For every note on event you store the midi note in the array, for every not off event you drop it from the array.
-In case of emergency, you can just send out a note off for each note in the array while deleting them from the array (="all notes off")
If you're completely replacing midi notes, you may want to work with two arrays, one holding the original data, the other one holding the altered midi events (and both managed exactly the same regarding adding and deleting items), so that you can send out the correct note off, and keep track of all events.
Re: MIDI I/O - Editing channel data
Posted: Fri May 06, 2016 1:50 am
by Father
tulamide wrote:summarize:
-You need a midi buffer, which simply is an array.
-For every note on event you store the midi note in the array, for every not off event you drop it from the array.
-In case of emergency, you can just send out a note off for each note in the array while deleting them from the array (="all notes off")
That makes sense. I was hoping for a shortcut, but looks like we have to do it this way for a solid solution. But how about limiting the array size and number of notes we can store? I have to get back and try it first.