Page 1 of 1
Turn polyphonic MIDI into mono?
Posted: Sat Oct 24, 2015 1:15 am
by nix
Heya,
How's it going?
I am working on my guitar to MIDI converter,
and would now like to turn the polyphonic(max 6 voice) MIDI into monophonic MIDI.
I assume there is a neat way in Ruby, and I am hacking around with MIDI Split, MIDI Event and MIDI Mono.
Split and Mono both give just the last note played, which seems helpful, but how do I trigger just monophonically?
Mono gives number of voices playing.
Cheers and wishing your puzzles solved
Re: Turn polyphonic MIDI into mono?
Posted: Tue Oct 27, 2015 8:44 pm
by tulamide
Could you elaborate on this? Turning poly into mono midi would need some rules. What about chords? Which note should get through, what about overlapping notes, etc.?
Re: Turn polyphonic MIDI into mono?
Posted: Wed Oct 28, 2015 4:25 am
by nix
It should be last note on,
and last note off.
No retrigging stolen.
Thanks for musing on this!
Re: Turn polyphonic MIDI into mono?
Posted: Wed Oct 28, 2015 10:22 am
by tulamide
Does this work good enough for you? I might not have fully understood the task, but I think I'm close to it?
Re: Turn polyphonic MIDI into mono?
Posted: Wed Oct 28, 2015 1:53 pm
by nix
Perfect mate!
Thanks a bundle
I'll try and comprehend the code further,
although it is a little like mine with pushing and deleting.
Re: Turn polyphonic MIDI into mono?
Posted: Wed Oct 28, 2015 4:41 pm
by tulamide
nix wrote:I'll try and comprehend the code further,
although it is a little like mine with pushing and deleting.
I like that you don't just want a solution but actually understand the code, too. It isn't very complicated.
Each Note On event's key is stored in the buffer. As soon as the buffer has 2 entries, the oldest one (stored at index 0) is turned into a Note Off, deleted from the buffer and sent to the output. After that the NoteOn event of the new note is sent to the output as well.
Each Note Off event's key is deleted from the buffer. If the buffer is empty it means there is no older note and the current Note Off is sent to the output.