[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MIDI Bank Select proposal (was Re: [fluid-dev] Re: Son of ticket #65

From: David Henningsson
Subject: Re: MIDI Bank Select proposal (was Re: [fluid-dev] Re: Son of ticket #65)
Date: Wed, 04 Aug 2010 22:39:11 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100713 Thunderbird/3.0.6

2010-08-03 22:48, Pedro Lopez-Cabanillas skrev:
> [Sorry, this is a bit long...]

I'm glad you took the time to sort it out!

> MIDI Bank Select messages are Control Change #0 (MSB) and CC#32 (LSB) [4]. Up 
> to FS-1.0.9, the behavior was that when a CC#0 message was received, the 
> value was used as the channel bank number. If a CC#32 was received later, the 
> bank number was recalculated as MSB*128+LSB and the result used as the new 
> channel bank number. The bank number is not immediately used, but reserved 
> until a Program Change message is received, and then applied to select a 
> sound preset from the loaded soundfonts.

I remember finding that inconsistent, i e it mattered in which order MSB
and LSB were received. I think that was one of the reasons for changing it.

> Current behavior in the SVN codebase is that the soundfont bank number is 
> always calculated from MIDI Bank Select messages with the formula = 
> MSB*128+LSB, no matter if only the MSB or LSB values are received, 
> initializing the bank number to 0 for melodic channels and 128 for the 
> percussion channel. This new behavior has a problem when a MIDI song for GS 
> synths is played with a GS soundfont in FluidSynth: the selection of preset 
> sounds may be wrong.
> SF2 (SoundFont) files (like GeneralUser, FluidR3,...) have bank numbers < 127 
> for melodic sounds and 128 for Drum kits, as recommended by the SoundFont 
> specification [5]. It is necessary to map the MIDI Bank Select numbers to the 
> SF2 bank numbers, because they won't always match. The sf2 spec says 
> that "The special case of a General MIDI percussion bank is handled 
> conventionally by a wBank value of 128. If the value in either field is not a 
> valid MIDI value of zero through 127, or 128 for wBank, the preset cannot be 
> played but should be maintained."
> Note that DLS soundfonts are different: they have 14bit bank numbers. But 
> FluidSynth doesn't use DLS files yet!
> There is not an universal behavior for MIDI Bank Select messages, because it 
> depends on several standards: GM, GS, and XG:
> GM (General MIDI) does not define Bank Select messages. The 
> document "gmguide2.pdf" [1] says that Bank Select (CC#0/32) should be 
> completely ignored in GM mode.
> GS (Roland) uses CC#0 as variation number, and CC#32 as a device emulation 
> number. Usually, LSB=0 for the main device mapping, and other numbers for 
> selection of families, or emulated devices [2]. 
> XG (Yamaha) uses CC#32 as the bank number, and CC#0 as a melodic/sfx/drums 
> switch. The XG specification [3] says:
> Bank Select MSB/LSB: 00H/20H
> Cntrl#  Parameter        Data Range
> 0       Bank Select MSB  0:Normal, 64:SFX voice, 126:SFX kit, 127:Drum
> 32      Bank Select LSB  0 to 127. Default: 00 00H
> If multipart parameter “Rcv BANK SELECT” is OFF, the part ignores this 
> message. The new bank selection does not become effective until receipt of 
> the next Program Change message. The Bank Select MSB selects melody voice, 
> SFX voice, or rhythm kit. The MSB allows any channel to be designated for 
> rhythm play. Bank Select MSB values are as follows.
>        00H:             Melody voice
>        01H to 3FH:      not used
>        40H:             SFX voice
>        41H to 7DH:      not used
>        7EH:             SFX kit (SFX voices arranged over keyboard)
>        7FH:             Rhythm kit (Rhythm voices arranged over keyboard)
> So there is no way to strictly follow all the standards at once. But at the 
> same time, the MIDI goal is compatibility, and the same should be the goal 
> for FluidSynth. The current behavior of bank# = MSB*128+LSB may be called 
> a "Strict mode" that works obnly when songs and soundfonts are specially 
> created with the correct numbers, and we can define a "Compatibility mode" 
> with the following rules, if we don't know which standard to follow:
> 1. If MSB is received alone, or with LSB=0, then use MSB as the soundfont 
> bank 
> number. This is probably going to work with most GS songs.
> 2. If LSB is received alone, or with MSB=0, then use LSB as the soundfont 
> bank 
> number. This is probably going to work with most XG songs.
> In any other case, we need to know if the song/player follows the GM, GS or 
> XG 
> standards, either when a SYX message is received, or with a setting.
> The proposal is that this "Compatibility mode" should be the default.

So, how about:

banknum = LSB == 0 ? MSB : MSB*128 + LSB ?

...regardless of order received? That way, 1. and 2. work as you
suggest, and "any other case" works as before - I believe, both as 1.1.0
and 1.0.9 worked, right?

At least until we've got the Sysex/setting stuff for GM/GS/XG.

// David

reply via email to

[Prev in Thread] Current Thread [Next in Thread]