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

grigou's icon

Hello,

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. ?

Thanks

bkshepard's icon

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.

grigou's icon

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...

Roman Thilenius's icon

[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.

-110

bkshepard's icon

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.

grigou's icon

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.

bkshepard's icon

How about [mtr] then?

broc's icon

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

grigou's icon

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 :-)

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

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

grigou's icon

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

bkshepard's icon

Have you checked the MIDI tutorials in Max?

grigou's icon

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

NA's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Oops, meant to compress. I hope someone finds this useful! I'd love feedback if there are better ways to do it.