Specifically midi files, made using one of the three main standards: GM (1/2), XG, and GS.
I am not working with any hardware, so all of my information and usage is software based.
If the file was made following the GM1 standard, percussion is always channel 10. Easy peasy.
However, Roland then made the GS format, which expanded on GM. It also allows for a single percussion channel, I assume also on 10.
Yamaha then made their own expanded format, XG. This (when saved as a midi file) allows percussion on any channel.
GM1 Level 2 added support for percussion on channel 11 as well as 10.
I parse a midi file, looking for specific events.
First, I check SYSEX to see if there is a GM reset, a GS reset, or an XG reset in the file.
If there is an XG reset (usually, but not always, preceded by a GM reset), then I know all my processing should be done based on XG standards.
If there is a GS reset (usually found alone with no GM reset), then I know all of my processing should be done based on GS standards.
If there is only a GM reset, or no reset, I assume GM, and process accordingly.
Currently, I assume Channel 10 will be percussion in any mode, and apply percussion naming schemes. This may not always be correct, and I am currently working on improving this.
If in XG mode, I check for a bank select msb of 126 or 127 to tell me that a channel (other than 10) has been set to percussion. XG uses bank msb 126 and 127 for percussion banks.
The majority of my bank naming data comes from various Cakewalk compatible .ins instrument definition files.
Generally, everything is working well up to this point, except that for completeness sake, I need some general midi level 2 formatted files to test percussion on channel 11, so I can examine them and properly detect percussion (plus finish my non-channel 10 percussion implementation. My code was originally based solely on GM1).
These screenshots show the different formats as currently processed in my program. I allow easily changing instruments in a midi file, and because percussion is key/note based rather than program based (program change selects the percussion kit to use in this case), I need to be able to properly determine if a non-10 channel has percussion, because each note-on/off becomes its own "instrument". If I leave it as an "instrument" channel, when it's actually percussion, the program change/kit select on that channel will get flagged as a normal instrument in my program, and so changing it would only change the kit, not the instrument.
So on channel 10, you can change a drum to a cymbal, as they are both shown, and both selectable/changeable. However, if this same percussion track was on another channel, all of the percussion would be lumped under a single program change (standard instrument), so you would not see or be able to individually modify any of the percussion instruments. (Hence the temporary "Oh No! Drum kit!" shown in the XG file. If I changed any of those, they would currently only change the drum kit being used, not the individual drum. You can see that channel 9 uses two kits, 24 and 25 [-1 from instrument number] and channel 11 uses one kit, 25).