[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: Pedro Lopez-Cabanillas
Subject: Re: MIDI Bank Select proposal (was Re: [fluid-dev] Re: Son of ticket #65)
Date: Wed, 4 Aug 2010 23:31:52 +0200
User-agent: KMail/1.9.6 (enterprise 20070904.708012)

On Wednesday, August 4, 2010, David Henningsson wrote:
> 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.

No, MSB and LSB are CC messages that come in any order. The restriction is 
that the CCs must be received before the Program Change, and are only applied 
at that moment. In other words: sending bank select messages without a 
Program Change has no effect, in any of my MIDI hardware instruments. 
FluidSynth should behave the same.

> > 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."

I want to remark the above quotation from the SF2 specification. SF2 bank 
numbers for melodic channels are numbers in the range 0 to 127, 7 bits.

> > "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 ?

banknum can be a number from 0 thru 16383 from that formula, 14 bits.
The bank number from standard compliant SF2 files is a number from 0 to 127, 7 
bits. You can't match SF2 bank numbers with your banknum.

If you want to be compatible with most SF2 files, you need to avoid the 
formula (MSB*128 + LSB) completely.

> ...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?

1.1.0 was totally broken for bank select messages.


reply via email to

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