On Friday, August 6, 2010, Elimar Green wrote: > > 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. > > That is only for General MIDI (GM) compatibility though.
No. General MIDI (GM) doesn't use banks, CC#0 and CC#32 are ignored in GM mode by all standards compliant devices. > If I > remember correctly, the actual quantity in a SoundFont file is a 16 > bit number for bank. So theoretically you could assign any 16 bit > quantity as a bank number in a SoundFont file, though I would guess it > only really makes sense to limit it to a 14 bit quantity if you want > to actually be able to select it using standard MIDI messages. Yes, the SF2 PHDR sub-chunk has this header structure: struct sfPresetHeader { CHAR achPresetName[20]; WORD wPreset; WORD wBank; WORD wPresetBagNdx; DWORD dwLibrary; DWORD dwGenre; DWORD dwMorphology; }; Where wBank is a 16bit field, like wPreset. But the specification states the range from 0 thru 127 for both the wBank and wPreset. Please read carefully in the document "sfspec21.pdf", page 27: "The WORD wPreset contains the MIDI Preset Number and the WORD wBank contains the MIDI Bank Number which apply to this preset. Note that the presets are not ordered within the SoundFont compatible bank. Presets should have a unique set of wPreset and wBank numbers. However, if two presets have identical values of both wPreset and wBank, the first occurring preset in the PHDR chunk is the active preset, but any others with the same wBank and wPreset values should be maintained so that they can be renumbered and used at a later time. 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 think it actually needs to work a bit differently from what you both > described. It should be done as it was in 1.0.9. There was a bit of > overhauling for 1.1.0 and I think the bank behavior got > unintentionally changed, by yours truly. > > The previous behavior worked as so (from examining the 1.0.9 code base): > - Each channel keeps track of the last MSB value and the current BANK value > - If an MSB is received: MSB = value and BANK = value > - If an LSB is received: BANK = MSB * 128 + LSB > > That should do the trick and work in most MIDI modes, minus the GM > mode where bank selection should be ignored. In FS-1.0.9 and in your proposal above, XG mode is not handled correctly: MSB should be ignored. And for GS mode, when LSB is received the value should be ignored as well. Regards, Pedro _______________________________________________ fluid-dev mailing list fluid-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/fluid-dev