I am writing a piece of software to easily change instrumentation in a midi file.
I've come to the point where I am nearing the end, and now an important question comes up: I'm adding in bank switching support, meaning that as long as the playback device supports it, I will allow changing to any available instrument banks or drum kits. This is "easy" if there is only one instrument in a track, it gets more complicated when a track contains multiple instruments.
It gets potentially chaotic when drum kits are involved. Are midi files allowed to rapidly switch drum kits?
For example, let's say I have a GM file using "Standard Set" with a drum, a cymbal, and a side stick. All percussion is in a single track.
Let's then say I change only the cymbal to "Room Set", and only the drum to "Power Set". This will require inserting a kit (program) change before each of the instruments whenever they appear after another instrument, potentially leading to hundreds of kit changes over the course of the song.
Will midi allow this? I imagine it is technically correct. Would it play back properly on hardware? Would it matter if this was done in a GM vs GS vs XG file?