fbpx
Skip to main content

MIDI Forum

Question about chan...
 
Notifications
Clear all

Question about changing drum kits on the fly

23 Posts
4 Users
0 Reactions
6,432 Views
Jason
Posts: 424
Honorable Member
Topic starter
 

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?

 
Posted : 24/05/2021 8:26 pm
JohnG
Posts: 225
Estimable Member
 

After many years of creating and analysing MIDI files, I've never come across this practice, i.e. switching kits just to implement a single hit or two.
What I have come across, which seems to be the normal way to do things, is to implement, e.g. the standard set on channel 10 and then a second set, e.g. room kit on another channel, usually 11. Using two channels is not uncommon, but I've never seen three channels used this way, although I suppose it's possible.

Take a look at the GM2 specification and it shows you how to do this with the GM2 kits.
But I suspect you already know this.

It's perfectly feasible to switch kits as often as you like in the MIDI file.
The real question is "will the hardware or software that produces the sound be able to keep up?"
After all, it's got to receive and interpret the two Bank Select messages and a Program Change, followed by actually doing the change, however that's done.
Remember, in the guidelines it suggests that the average time (hardware) to implement a GM System On message is 100ms.
It would be considerably less to switch kits, I suggest, but still not zero time, and that will vary from system to system.

Any help?
JohnG

 
Posted : 25/05/2021 1:49 am
Jason
Posts: 424
Honorable Member
Topic starter
 

The real question is "will the hardware or software that produces the sound be able to keep up?"
After all, it's got to receive and interpret the two Bank Select messages and a Program Change, followed by actually doing the change, however that's done.
Remember, in the guidelines it suggests that the average time (hardware) to implement a GM System On message is 100ms.
It would be considerably less to switch kits, I suggest, but still not zero time, and that will vary from system to system.

I guess that's the million dollar question :p

After all of my testing so far using 541 different midi files (of my other functionality, not this particular percussion kit switching), I have found a handful (usually XG) with multiple percussion channels, and I do have one file with three percussion (channels 9, 10, 11). Some of them do in fact have multiple kits per channel, though I have not analyzed them to see how the kits are distributed. See the screenshot for the 3 channel one. Channel 9 has kits 24 and 25 (msb 127), channel 10 has 25 on bank msb 127 (standard drum kits) and 0 and 1 on bank msb 126 (SFX kits). Channel 11 has kit 25 (msb 127). It is also a format 0 midi file, so all of this info is in a single track, but again, I haven't dug in to its internals to see how it is laid out.

 
Posted : 25/05/2021 11:01 am
Jason
Posts: 424
Honorable Member
Topic starter
 

If you want to poke around in a few of these yourself,
https://reasonstation.nl/downloads/yamaha/licensed-midi-files/Yamaha-XG-Midi-Library/

The 3-percussion one is XGTECHNO under the XGSONG folder

 
Posted : 25/05/2021 11:08 am
Geoff
Posts: 1039
Noble Member
 

Hello,

I downloaded the pack of files, although the initial link did not work for me, but with the help of Google I was able to sort something out.

I found the file you specifies, i.e. XGTECHNO.

When I loaded this into SynthFont, it game info rather different to your notes, and pics. Some similarities, but not the same. Bear in mind that the text descriptions for the various Patch/Instrument settings will be dependant on the information available to the software, so the info I was seeing could well be from the SF file I'm using within SynthFont, which is 'Timbres of Heaven'. This has a degree of XG compatibility, but I guess not 100%.

I then got my DOS midi machine running, and loaded the fine into that. To play through my Yamaha MU90r which is 100% XG compatible. The device uses an LCD screen to say what it is receiving/playing, as per it's own instrument settings.

This now seems to be much more like what you were describing, i.e. various drum changes, and drums on Ch 9, 10 and 11.

The most important thing as far as this thread in concerned is that this midi file is actually some sort of demo piece, and there are 4 or 5 different 'songs' one after the other, although the last piece is just a succession of short bursts. The changes to the drum kits are all (I think) during the break/gap between the different sections, i.e. any pause is not heard. Even so, the LCD screen on the MU90r was changing pretty much instantly, so the device would appear to be handling the Kit changes without any problem. The LCD screen was also showing the transition, and the current kit name, without any problem. So no indication of any reason to worry.

The fact that it may be a Type 0 midi file is not really an issue. It does not affect play, the data is still divided up according to channels. Just on one track. If you load this file into many playback systems, you will probably be asked if you want to split the data between tracks dependant on channels, and if you do that, you will also have the option to save the data in the split form.

My the way, the file sounds pretty good on the Yamaha device. Maybe TOO 'techno' for my taste, but so what. I'll have to check out some of the other files in the archive. On the basis of a VERY quick look through the dir listings, there are some of the files that I already have in my collection, but only a few percent of the whole download.

Geoff

 
Posted : 25/05/2021 5:14 pm
Jason
Posts: 424
Honorable Member
Topic starter
 

Bear in mind that the text descriptions for the various Patch/Instrument settings will be dependant on the information available to the software,

I am using two modified Cakewalk Instrument Definition files for my XG names (sw1000xg and 9000Prov100, the first is more complete, the second has nicer names), plus another for my GS names (Roland SC-8850), and a fourth for my GM names (GM1_GM2). I tried to use names from the most recent device file I could find.

I'm not sure where SynthFont pulls it's names from. I also have Timbres Of Heaven as one of the soundfonts in VirtualMIDISynth, and play my midis through Winamp. It doesn't show any names, only a midi mixer with numbers and sliders, but it does play XG decently. None of the midi editors I have seem to have extensive support for XG. They will display everything just using standard GM naming.

In that site I linked, I noticed the author made some mp3s of some of the tracks, and I have to say, they sound really nice coming from a real XG device. Mine plays pretty decent, but don't sound anywhere near as polished. I have the Yamaha XG player along with the S-YXG 100 softsynth installed in a Win 98 virtual machine, I'll have to give it a listen on there to see how it sounds.

 
Posted : 25/05/2021 9:04 pm
JohnG
Posts: 225
Estimable Member
 

If you want to analyse a MIDI file in some detail, one of the best programs available today to do this is one called Sekaiju from the OpenMIDIproject.
Best of all it's a FREEBIE. It can be found here: 'openmidiproject.osdn.jp/index_en.html'

This particular program, in its List View, allows you to select exactly what you want to see and not see by leaving ticked/unticking the boxes on the RHS to leave, e.g., just MSB, LSB, PC checked.
And I can confirm what Geoff says, the changes are executed between the various "songs" (I'm not keen on Techno either ;-)) not many of them with little time between them.
Having said that, I suspect that most software and hardware that can respond to Program Changes (many VST sample players can't) will be able to switch 'on the fly' providing you leave a millisecond or so between the PC and the next Note On message.

I tried the file using the Yamaha SOL2 program and the Yamaha S-YXG50 soft synth and it worked perfectly.
Most of these files will render perfectly except where they are designed to use a specific synthesiser/PLG card, e.g. DX, AN, VL.
I must dig out my old MU1000 with its three synth cards (as above) and try them again.
They are stunning quality.

JohnG.

 
Posted : 26/05/2021 2:45 am
Geoff
Posts: 1039
Noble Member
 

Hello Jason,

Regarding your note re the text names, I've just checked my installation. In the dir containing the big SF file for Timbres there are two support files.

timbres.txt contains the text info, with the patch number/reference (bank and patch), this is plain text and can be edited.
Timbres_of_Heaven.mlb is substantially binary info, but also contains the patch names, and is grouped in instrument types, a bit like GS patches are structured. The info must be coming from one of these.

Geoff

 
Posted : 26/05/2021 6:30 am
Jason
Posts: 424
Honorable Member
Topic starter
 

Once I add in the functionality (on a trial basis), I'll try messing with a file, and if one of you fine folks could test it out on hardware with its rapid kit switching and tell me the results, that would be swell 🙂 I'll post it (or maybe a few for completeness) on here when they are at that point. I'l probably do at least one file in each format (GM, XG, GS).

I still have to work on the actual insertion code. Adjusting the track length and timing will be tricky. The first tests will essentially be brute force kit/bank switch insertion (ie, where is the note? jam in a change, add to track length). If it's somewhat successful, I will optimize it.

 
Posted : 27/05/2021 10:57 am
Jason
Posts: 424
Honorable Member
Topic starter
 

Oooooh, I just thought of something...

On instrument channels it will be easier because a program change always happens for a new instrument, so I just do the bank select, then the program change.

If a bank select is sent on a percussion channel, does it ALSO require a program change to have the percussion play from the new bank/kit? Or will it play them from the new bank without specifically sending a program change? I'm thinking it might need it, in which case that's going to get really bloated quickly.

 
Posted : 27/05/2021 11:05 am
Geoff
Posts: 1039
Noble Member
 

I'll be quite happy to play any files you upload, and report. XG or GM (and GS ?). No problem.

Regarding th setting process, I note from my Yamaha manual for the MU90r than the different drum kits require a MSB and a Prog Change number. If the last Bank Select ## was correct for the new Bank, then I believe that just the Prog Change will do the job, i.e. things stay in the currently selected Bank. But that should be checked?

With regard to the timing question, you should note something not mentioned before. Certainly in the case of the MU90r, although each bank contains a full set of instruments, many of them will be the same as in other kits. Some kits contain merely a handful of 'different' instruments. I don't know how the change is implemented in RAM within the MU, but it may well need to do anything with ONLY the note numbers that need a change, and may not have to do anything with the others. I don't think that any kit requires EVERY item to be changed.

Geoff

 
Posted : 27/05/2021 11:35 am
JohnG
Posts: 225
Estimable Member
 

[quotePost id=9137]Oooooh, I just thought of something...

On instrument channels it will be easier because a program change always happens for a new instrument, so I just do the bank select, then the program change.

If a bank select is sent on a percussion channel, does it ALSO require a program change to have the percussion play from the new bank/kit? Or will it play them from the new bank without specifically sending a program change? I'm thinking it might need it, in which case that's going to get really bloated quickly.[/quotePost]

As far as I'm aware no change will happen without the Program Change command, it's that instruction that makes the hardware/software change instrument or drum kit.

JohnG.

 
Posted : 28/05/2021 1:46 am
Jason
Posts: 424
Honorable Member
Topic starter
 

[quotePost id=9138]MU, but it may well need to do anything with ONLY the note numbers that need a change, and may not have to do anything with the others. I don't think that any kit requires EVERY item to be changed[/quotePost]
Unfortunately, to make my program flexible, users will be able to do it if they want :p In theory anyway. We'll see how it goes when I get there. Since I am not actually dealing with the hardware, and I only have as much bank information as I have knowledge of, there can/will be instances (perhaps custom drum kits or whatnot, or simply something I was not aware of) where a user will have something perfectly valid that does not flag properly in my program, yet they will still be able to make bank adjustments as wanted.

So I will try to make some "worst case scenario" files for testing, to see how much chaos I can cause 😉

 
Posted : 28/05/2021 5:18 pm
Jason
Posts: 424
Honorable Member
Topic starter
 

I think I'm going to have to ponder this for a while and see if I should actually do it.

Witness this screenshot of the byte locations of all the percussion/program changes in one file. Each number shown is an occurrence of that instrument, either via a program change (instrument) or note on/off (percussion).

Regular channels are fine, a bank change could happen easily before the first note.

Percussion, because each note is a different instrument, *cough* ... The amount of bank selects even to change a single one to a different kit becomes astronomical... If each one was in its own section of the file, it wouldn't be so bad, but as you can see, they are definitely interspersed.

 
Posted : 29/05/2021 11:19 am
Jason
Posts: 424
Honorable Member
Topic starter
 

* Not only would I need to change the bank for each occurrence of the percussion instrument, but I would then need to change the bank back to the original for the next percussion instrument that has not been set to the new bank.

 
Posted : 29/05/2021 11:22 am
Page 1 / 2
Share: