I'm working on a MIDI instrument changer. I released a BETA several weeks ago, but it did not have any bank selection support, which I am currently adding. This lead me to discover that XG midi can have percussion on any channel, not sure about GS (wikipedia just mentions that it has 1 percussion, so I assume channel 10), and that GM2 can have percussion on 10 and 11. With XG files, if there is a bank select for bank 126 or 127 on a channel, that sets it as percussion/sfx. How can you tell by looking at the HEX contents of a GM2 file (or an event list if necessary) if it has percussion on channel 11, rather than standard instrumentation? And, does anyone have some GM2 files that have this setup so I can test them in my program? I have not found any as of yet.
You need to be clear what you're talking about here.
As far as I know, midi files, and by implication midi data, don't know anything about the data being transported, so in effect you can have drums/percussion on any channel, and as many channels, as you like. Midi doesn't know, and doesn't care.
Whatever device is generating the midi data, for example a keyboard, may however allow certain channels ONLY, or a single midi channel, for percussion. The convention is that this is Channel 10 (on a 1-16 basis, this will be Ch 9 as per the midi data 0-15).
Whatever device is receiving the midi data, and making the actual sounds, may also specify certain channels (or a specific channel) for percussion. This may be hard-wired so that the sound generating electronics receives data on that/those channels ONLY.
Different devices may be set to different channels. However it is likely that most current devices will standardise on Ch 10.
You will need to keep an eye on this device by device. And midi file by midi file.
If a midi file has a lot of notes on Ch 10 but no PC (Program Change) command, then this will probably be percussion. XG or GS midi files may well have a large number of percussion banks to choose from, so there could be a number of options, depending on the instrument.
Geoff
To clarify:
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).
This is from the General MIDI 2.0 specification:
"Bank Select 78H/xxH followed by a Program Change will cause the Channel to become a Rhythm Channel, using the Drum Set selected by the Program Change."
So you can send that Bank Select on Channel 11 to switch it to a Rhythm Channel instead of a Melody Channel.
The GM2 specification (Pages 32-34) defines the Program Change numbers for 9 drum sets.
For more details get the GM2 specification here: https://www.midi.org/specifications/midi1-specifications/general-midi-specifications/general-midi-2
Mike.
Chair of MIDI 2.0 Working Group
This is from the General MIDI 2.0 specification:
"Bank Select 78H/xxH followed by a Program Change will cause the Channel to become a Rhythm Channel, using the Drum Set selected by the Program Change."
...
Mike.
Perfect, thanks! Apparently it is not just limited to channel 10/11, though it notes using others may cause compatibility issues.
GS can use two drum maps on arbitrary channels. This is configured by setting the USE FOR RHYTHM PART parameter to 1 or 2 with a SysEx. Its address is 40 1x 15, where x is the block number, which is not always identical with the MIDI channel number.
The attached GM2/GS/XG example files use drum set 17 (Power or Rock) on channel 11.
GS can use two drum maps on arbitrary channels. This is configured by setting the USE FOR RHYTHM PART parameter to 1 or 2 with a SysEx. Its address is 40 1x 15, where x is the block number, which is not always identical with the MIDI channel number.
The attached GM2/GS/XG example files use drum set 17 (Power or Rock) on channel 11.
I can't select two replies as the "answer", but this is also very good information. The more I know, the more complicated things get 😉
Thank you so much for the sample files as well. My program properly flags the XG and GM2 drums on channel 11. So now I just need to add in the proper GS SYSEX check.
The full sample from the SC-88Pro manual
To set the Part Mode using MIDI messages, you need to use
system exclusive messages.
For example if you wish to set the Part Mode of Part 11 to
Drum2, transmit the following message. (p.197)
F0 41 10 42 12 40 1A 15 02 0F F7
10: Device ID (17)
40 1A 15: Address (USE FOR RHYTHM PART of Part 11)
02: Data (Part Mode Drum2)
To select a Drum Set after setting the Part Mode, transmit a
program change to Part 11
In a MIDI file, the command would also include the "length" byte, so
F0 0A 41 10 42 12 40 1A 15 02 0F F7
Can I assume (since it's not easy to google "roland" and "part" and get good results 😛 ) that part numbers are 1-F, with 0=10? In the example, they have 1A with the A being part 11, and on page 197 of the same manual
[code type=markup]
40 1x 15 USE FOR RHYTHM PART
* This parameter sets the Drum Map of the Part used as the Drum Part. This unit can simultaneously (in different Parts) use up
to two Drum Maps (MAP1, MAP2). With the initial settings, Part10 (MIDI CH=10, x=0) is set to MAP1 (1), and other Parts are set to normal instrumental Parts (OFF(0)).
[/code]
In the default configuration, part 0 is channel 10, parts 1…9 are channels 1…9, and parts 10…15 are channels 11…16 (where the part number is counted from 0, and the channel number from 1). You probably do not want to parse the part reassignment SysEx.
Can I assume [...] that part numbers are 1-F, with 0=10? In the example, they have 1A with the A being part 11, and on page 197 of the same manual [...] Part10 (MIDI CH=10, x=0)
Page 196 of the Roland SC-88Pro manual says:
The relation between Part number and Block number is as follows.
x...BLOCK NUMBER (0 - F), Part 1 (default MIDIch = 1) x=1
Part 2 (default MIDIch = 2) x=2
: : :
Part 9 (default MIDIch = 9) x=9
Part10 (default MIDIch = 10) x=0
Part11 (default MIDIch = 11) x=A
Part12 (default MIDIch = 12) x=B
: : :
Part16 (default MIDIch = 16) x=F
In other words, x can be from 0 to F, but Part 10 is moved to the beginning of the order from 0 to F:
Part 10 is x = 0.
Parts 1 to 9 are x = 1 to 9.
Parts 11 to 16 are x = A to F.
GS can use two drum maps on arbitrary channels. This is configured by setting the USE FOR RHYTHM PART parameter to 1 or 2 with a SysEx. Its address is 40 1x 15, where x is the block number, which is not always identical with the MIDI channel number.
The attached GM2/GS/XG example files use drum set 17 (Power or Rock) on channel 11.
I want to give a second big thanks for these sample files. I was able to finish my non-default channel percussion detection/scanning because of these samples. I got GM and XG working, but GS was being problematic. At first I didn't realize the files were all the "same" just in the different formats. But as I worked through my code fine tuning it, I ended up with 3/4 files showing the correct drums, and realized there was an issue with my GS code. After tracing through, I was able to figure out I was doing a check for "1" in a value I set for custom drum channels, when GS sets that same value to either "1" or "2", and once I figured that out, it works great. I have yet to find another GS file with more than just channel 10 percussion, so without these sample files, it would have taken me CONSIDERABLY longer (if ever) to get these sorted out. I still have to finish up adjusting bank/kit display for them, but you can see the preliminary results with each instrument separated out, meaning I can change each individually as intended.
Thanks again! 😀