fluid-dev
[Top][All Lists]
Advanced

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

[fluid-dev] New "bank offset" feature and selecting sfont/bank/preset...


From: Ken Ellinwood
Subject: [fluid-dev] New "bank offset" feature and selecting sfont/bank/preset...
Date: Thu, 10 Jun 2004 13:35:05 -0700 (PDT)

The attached patch adds the ability to specify a "bank offset" when
loading a sound font.  This patch was developed against the latest
code in the savannah CVS repository, which from all apperances seems
to be fully operational again.

Here's what the patch does:

First, I fixed the handling of a MIDI bank select controller 0, e.g., bank
select MSB (or "coarse" bank select according to my spec).  Prior to
this fix a channel's bank number was only changed upon reception of
MIDI bank select controller 32, e.g, bank select LSB (or "fine"
bank-select according to my spec).

The bank offset is a new argument to the command line "load"
operation.  The bank offset value is added to the soundfont's internal
bank numbers and allows the presets of multiple soundfonts which
internally use the same banks to be accessed via MIDI commands.  For
example, if you have two soundfonts which both contain presets in bank
0, it was previously impossible to select presets from both soundfonts
using MIDI commands.  Now if you load one soundfont with bank offset 0
and the other with bank offset 1, presets from both can be assigned
via MIDI commands using combinations of bank select and program
change.

For example, consider two soundfonts, first.fs2 and second.fs2, which
contain all presets in bank 0.

Load first.fs2 with bank offset 0:

> load /my/soundfonts/first.sf2 1 0
loaded SoundFont has ID 1

Load second.fs2 with bank offset 1:

> load /my/soundfonts/second.fs2 1 1
loaded SoundFont has ID 2

Fluidsynth now assigns soundfont IDs starting with 1 instead of 0.
The soundfont ID value 0 can be used in the revised implementation of the
"select" command to simulate a MIDI bank-select and program change
message sequence for a given channel and should have the same effect
as sending MIDI bank select and program change.  I.e., when using
soundfont ID 0 in "select" the soundfont list is searched for the
first existing specified preset in the given bank.

For example, assign a preset 3 from bank 1 (second.fs2) to channel 5
without using soundfont ID 2:

> select 5 0 1 3

Internally, fluidsynth still manages a list of soundfonts.  Newly
loaded soundfonts are inserted at the head of the soundfont list as
always has been done.  If conflicts exist between soundfonts and
banks/presets, the bank/preset from most recently loaded soundfont
takes precidence.


Enjoy,

Ken


        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

Attachment: bank_offset.patch
Description: bank_offset.patch


reply via email to

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