[Top][All Lists]

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

Re: [fluid-dev] Soundfont banks

From: David Henningsson
Subject: Re: [fluid-dev] Soundfont banks
Date: Tue, 10 Jul 2012 05:33:07 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

On 07/09/2012 05:39 PM, jimmy wrote:

--- On Mon, 7/9/12, David Henningsson <address@hidden> wrote:

From: David Henningsson <address@hidden>
Subject: Soundfont banks (was: Re: [fluid-dev] OSC support)
To: "FluidSynth mailing list" <address@hidden>
Cc: "jimmy" <address@hidden>
Date: Monday, July 9, 2012, 6:55 AM
On 07/09/2012 03:07 PM, jimmy wrote:
     "SoundBlaster soundfont specs
only allow 128 banks of 128 instruments"  --
That's what I get from Pedro and David.
When ask about MIDI specs support for MSB (128
selections) and LSB (128 selections) for sound banks, they
didn't have an answer.

As for following specs or not, I'm pragmatic about it. I'd
like to follow the specs whenever possible, but if something
else proves useful to a lot of people, and does not break it
for other people, I'm okay with merging such patches.

As for soundfonts, I remember having discussions on how to
best map CC0 and CC32 to the SoundFont's wBank value in
different GM/GS/XG/GM2 modes, which was not trivial to
answer. Therefore we have the "synth.midi-bank-select"
option that uses different mappings depending the mode you
select. Isn't that option working for you?

My patch specifically allows XG-soundbankd and XG-drumbank selections, and only 
in XG-mode.  XG-drumbanks can be at various MSB bank values of 120, 126, 127... 
in combination with various LSB bank values for different XG hardwares.

Again, my patch only affects XG-mode.  It allows Drumbanks to be used by any 
channel, not just channel 9 (10 with 1-starting-index).  It also allows 
multiple drum channels at the same time, with is used by various XG hardwares 
and XG-MIDI files.

Sadly, my patch never made it to the SVN code base, so the XG-mode soundbank 
selection and drumbank selection never worked in the official FluidSynth code 

You do have a bank selection patch merged, see:

Did you not see this, are you referring to another patch, or was the patch changed (before commit) in a way that broke it, or...?

As for the soundfont spec, it both says:

"MIDI CC0 Bank Select - When received, the following program
change should select the MIDI program
in this bank value instead of the default bank of 0

MIDI CC32 Bank Select LSB - When received, may behave in
conjunction with CC0 Bank Select to provide a total of 16384
possible MIDI banks of programs."

It means, by default, the value of CC0 and CC32 is assumed to be 0 (zero).  Let 
me use 0-starting-index number here.  Some instruments use 1 ss starting index, 
so adjust those numbers accordingly.

Some earlier hardwares only use MSB, only send MSB (CC0), never send LSB (CC32).  That's 
what ["MIDI CC32 Bank Select LSB - When received,"] tries to clarify.

CC0 and CC32 each has 7-bits (0-127 in decimal values).  So each is capable ot 
128 values, putting them side-by-side, that's a 14-bit binary number that is 
0-16383, or 16384 distinct numbers.

Some vendors (including, but not just Roland and Yamaha) went about 
implementing it for their MIDI hardwares.  It should not really matter if they 
follow the 14-bit numbering for calculating any of 16384 distinct banks.  I 
look at it as MSB (Most Significant Bits) means higher-order bits like the 
hundreds or thousands, and LSB (Least Significant Bits) means the first few 
numbers when we start counting.

Although, some people took short-cut, especially in Softwares, emulating Roland 
GS soundbank selection.  For example, some earlier Roland GS hardware and 
software modules only use MSB (CC0), and assume LSB (CC32) to be 0.  In other 
words, they simply ignored LSB (CC32) in those hardware and software GS-mode 
modules.  So, some third-party hardware and software emulation of GS-mode 
simply use 7-bits of MSB for the soundbanks switching, completely ignore the 
LSB (CC32).  If those third-party folks had use the 14-bit number from the 
beginning, simply zero-ing out the LSB (CC3) for bank selection, it would be 
simple to move forward.

Here's a description of how Roland GS hardwares do (changes with successive 
hardware releases):


    Typically, cc#32 (Bank Select LSB) was used to select a family (i.e. 1 - 
SC-55, 100 - MT-32 etc.) then cc#0 (Bank Select MSB) was used to set a 
particular variation bank.

In other words, it should have been the other way around.  But, they use LSB 
for the different hardwares ID.  Each hardware uses MSB for the maximum of 128 
soundbanks of 128 instruments per bank.  That's the [128 banks] x [128 
instruments] limit per family of hardware, designated by the Hardware ID used 
by LSB (CC32).

In other words, GS-mode hardwares only use 128 banks of 128 instruments for any 
particular "hardware family".  That's a limitation of using only MSB (7-bit 
number) for limiting bank selection.

Yamaha XG hardwares, on the other hand use the more logical ordering of bits in 
the 14-bits numbers.  They use combination of MSB and LSB to signify specific 
banks, including drum banks.  Which allows for addressing fuller range of 
[16384 banks] x [128 instruments].  Of course, some numbers may have already 
been used by older hardware, and for backward compatibilities, some of those 
numbers may be avoided for the time being.  But still, much more number of 
banks can be used in XG-mode.

Not only that, MIDI-2 instruments of more recent years, all use the combination 
of MSB and LSB for bank selection.

and also says:

"The special case of a General MIDI percussion bank is
handled conventionally by a wBank value of 128. If the value
in either [wBank or wPreset] field is not a valid MIDI value
of zero through 127, or 128 for wBank, the preset cannot be
played but should be maintained."

Kind of confusing in itself, IMO.

Sorry for ripping the above out of context. The wBank number in the text above, specifically refers to the saved number in the soundfont file, rather than a calculation based on bank MSB and bank LSB.

The wBank number is 128 (that is 128 zero based, i e 10000000 in binary) for percussion, which gives up to 128 different kits given different wPresets. I have also verified, with Swami, that that's how the big fluid-soundfont-gm and fluid-soundfont-gs soundfonts are constructed.

Do you have other soundfonts that work differently?

So, the question of how to map the 14-bit number used in XG (and MIDI-2?) modes, to the Soundfont's wBank number, is still the tricky issue here. That is, with your patch in, I thought we had come up with something that worked reasonably well.

// David

reply via email to

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