Forums > MaxMSP

How to know which program changes are used in a midi file ?

May 22, 2011 | 2:01 pm


After loading a midi file (type 1) in max, I want to know the program change number used for each track. I tried detonate, but he gives no info for the program change…

For example, in a midi file with 3 instruments, how can I know that one instrument use program change 0 for a piano sound, another one use program change 32 for a bass, etc. ?


May 22, 2011 | 7:10 pm

If your question is about knowing what program change messages are contained in the file, you can use [pgmin] to track the messages. On the other hand, if your question is about which instrument produces a piano sound for a given patch number, that’s often not standardized–unless they are using General MIDI–but a function of the synth itself.

May 22, 2011 | 8:00 pm

Thanks for your answer.
Indeed, my question is about knowing what program change messages are contained in a midi file.

I’ve looked to the pgmin but I don’t understand at all how it works. In patch help and reference page it’s always used with the input connected to nothing (!?), so how did it receives MIDI information ? And from where ?

In my case, I have a midi files which is played by a detonate object. So I have to connect one of the output of detonate object to the input of pgmin ?

Thanks again for your help, I’m totally lost with this…

May 22, 2011 | 8:07 pm

[detonate] should be able to output controller 0, but you could also use
[filein], read at word, and search for the hex string for controller 0.


May 22, 2011 | 8:08 pm

What if you used [seq] instead of [detonate]? If all you need to do is play MIDI sequences, would that work? You could then connect the [pgmin] object to the left outlet of [seq]. Check out the helpfile for [seq] for instructions on loading and playing MIDI files.

May 22, 2011 | 8:55 pm

Thanks both for the tips.

In fact, I use detonate because I have to deal with midi file type 1.

To explain a little more, I have to load a midi file (type 1) and played each track with different vst sounds. For example, if my midi file have 3 tracks : Acoustic Grand Piano / Acoustic Guitar (nylon) / Slap Bass 1, I have to send the piano track to a vst~ object and use program change 0 to play it, then the program change 24 for the guitar on another vst and the program change 36 for the bass on a third vst.

So that’s why I’m trying to automatically get the program change of each track to assign the track to the right vst preset.

May 22, 2011 | 9:08 pm

How about [mtr] then?

May 22, 2011 | 10:29 pm

Unfortunately there is no Max object for playing (or analyzing) universal midi files.
But you could try the external ‘ajm.midi2coll’ from Adam Murray.

May 22, 2011 | 10:44 pm

I tried with seq and pgmin doesn’t work. But I think I’m doing mistakes.
It’s the first time I use MIDI in max so I discover a new (complex) world :-)

I’m looking at [mtr] but I don’t understand yet how it works.

— Pasted Max Patch, click to expand. —
May 22, 2011 | 10:46 pm

Oh I didn’t saw your answer broc.
Thank you, I’ll take a look at this object.

May 22, 2011 | 11:16 pm

Have you checked the MIDI tutorials in Max?

May 23, 2011 | 10:05 am

Yep I’ve checked the MIDI tutorials, but I have to spend more time to understand all objects.

Viewing 12 posts - 1 through 12 (of 12 total)

Forums > MaxMSP