--- On Mon, 7/9/12, David Henningsson <di...@ubuntu.com> wrote: > From: David Henningsson <di...@ubuntu.com> > Subject: Soundfont banks (was: Re: [fluid-dev] OSC support) > To: "FluidSynth mailing list" <fluid-dev@nongnu.org> > Cc: "jimmy" <wg20...@yahoo.com> > 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 base. > 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): https://en.wikipedia.org/wiki/Roland_GS 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. > > // David Here's my take on that "General MIDI percussion bank". Assuming using the combination of MSB and LSB as in the numerical numbering 1111111 (MSB binary) on the lef, 1111111 (LSB on the right), where 'x' is the MIDI continuation flag for the MIDI full-byte. x1111111 x1111111 Assuming the defalt value of MSB=0, LSB=0 for the default, most basic MIDI hardware x0000000 x0000000 that is the default MIDI bank 0 (0-index). For bank 127 (128 for indexing from 1), that would be: x0000000 x1111111 for "wBank value of 128" (1-starting-index). But GS-mode only use MSB for the banks, and LSB for specifying hardware compatibility mode, so the "wBank value of 128" would be: x1111111 x??????? where x??????? is the LSB specifying a particular GS hardware family, which should only affect GS-mode in FluidSynth. The later part of that paragraph you quoted simply says that if a particular value is not in the 0-127 (or 1-128) range, it is invalid, to be ignored, no changes to be made in the current bank selection. It maybe applicable for hardwares and softwares using more than 8-bits to emulate the 8-bit values of MIDI specs, when the highest-order-bit is used for the MIDI continuation flag instead of the 8-th bit of a 8-bit automata. I think that was clarifying the specs with the introduction of 10-bit, 12-bit, 16-bit computer chips in the years following the original MIDI specs. Jimmy _______________________________________________ fluid-dev mailing list fluid-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/fluid-dev