play polyphonic midi file

Loren Ludwig's icon

i've got a bunch of 4-voice polyphonic midi files i'm working with. each piece begins like a fugue, with each subsequent voice (assigned channels 1-4) entering after a handful of notes. i'd like to map each voice (channel) to a different cycle~ abstraction, but i'm stuck at the voice allocation stage. neither _detonate_ nor _midiparse_ seem to offer simultaneous data on multiple midi channels--rather, they seem to read the midi information from the midi file in serial ascending channel order (say there's a chord made by 3 of the 4 voices in the file: i'm not getting three notes simultaneously on 3 different channels, but rather I'm getting them in series-- first the note in channel 1, then the note in channel 2, then the note in channel 3, each separated by a specified delay of about 400ms [depending on the tempo]). there must be an obvious object that reads a midi file and then outputs simultaneous events on multiple midi channels (otherwise, how would you play back a polyphonic midi file??)...help?

broc's icon

[detonate] should output the chord notes of different channels one after the other without any notable delay. So there must be something wrong with your patch or the midi files. If you post it here, we can have a look.

Loren Ludwig's icon

ok. hmmm. thanks for looking. i've also included the midi file i'm trying to play back using this patcher.

polyphonic midi playback scratch.maxpat
Max Patch

05-merulo-canzon_quinta-a4--0-score.midi
audio/midi 9.21 KB

Roman Thilenius's icon


max objects read midi notes from different channels only in serial order because there is no such thing as parallel midi notes.

of course the delay should not be 400 ms, it should be 0 milliseconds.

detonate is great but a bit tricky. if you have a file with more than one channel, you must first trigger the next event from the detonate output, i.e. before you are sorting the output in regards of channel number.

broc's icon

On the reference page of [detonate] is an example patch for playback. You just need to add the channel handling which can easily be done with [midiformat].

Max Patch
Copy patch and select New From Clipboard in Max.

Loren Ludwig's icon
Roman Thilenius's icon

note the del object. once you got this, you will be able to control the beast.