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

May 22, 2011 at 2:01pm

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


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 at 7:10pm

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 at 8:00pm

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 at 8:07pm

[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 at 8:08pm

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 at 8:55pm

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 at 9:08pm

How about [mtr] then?

May 22, 2011 at 10:29pm

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 at 10:44pm

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 at 10:46pm

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

May 22, 2011 at 11:16pm

Have you checked the MIDI tutorials in Max?

May 23, 2011 at 10:05am

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


You must be logged in to reply to this topic.