Turn polyphonic MIDI into mono?

For general discussion related FlowStone
Post Reply
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Turn polyphonic MIDI into mono?

Post 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
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Turn polyphonic MIDI into mono?

Post 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.?
"There lies the dog buried" (German saying translated literally)
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Turn polyphonic MIDI into mono?

Post by nix »

It should be last note on,
and last note off.
No retrigging stolen.

Thanks for musing on this!
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Turn polyphonic MIDI into mono?

Post 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?
Attachments
midi_poly_to_mono.fsm
(20.54 KiB) Downloaded 836 times
"There lies the dog buried" (German saying translated literally)
User avatar
nix
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am

Re: Turn polyphonic MIDI into mono?

Post 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.
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Turn polyphonic MIDI into mono?

Post 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.
"There lies the dog buried" (German saying translated literally)
Post Reply