Hi all,

the panning control (CC 10) currently doesn't really work that well with
SoundFonts containing stereo sound (actually with any instrument that has
samples with off-center panning).

When an instrument is made up of two samples, one panned hard left (-50)
and the other hard right (50) and we issue a note on with the panning CC
set to the default 64 (center), the following panning, amp_left and
amp_right values are calculated:

Left sample:
pan: -496.062992
amp_left: 0.999969
amp_right: 0.004708

Right sample:
pan: 503.937008
amp_left: 0.000000
amp_right: 1.000000

That's basically what we would expect. The left sample is only audible on
the left channel, the right sample only on the right channel.

If we change the panning to hard left (CC 0 10 0) then the following values
are calculated:

Left sample:
pan: -1000.000000
amp_left: 1.000000
amp_right: 0.000000

Right sample:
pan: 0.000000
amp_left: 0.706552
amp_right: 0.706552

As you can see, the left sample amp values have remained unchanged (well
nearly... rounding problems), but the right sample has moved to center,
sounding with equal volume on both channels. When listening to it, it does
actually sound a little bit like the position of the sound has moved, but
only a little bit. And the overall volume of the sound has increased a
little bit. So that's probably not really the intended effect.

Now you could argue that panning on stereo samples is wrong to begin with.
We should probably use "balance", not "panning". In other words, simply
control the volume of the individual left and right samples, but have each
side only output to it's natural channel (right sample only to right
channel, left sample only to left channel). MIDI even has a dedicated
balance control for that on CC 8. So I guess moving that balance CC to from
64 to 127 (i.e. move the balance to hard right) should gradually decrease
the volume of the left sample, leaving the right channel untouched. Moving
it from 64 down to 0 (i.e. turn balance to hard left) shoud gradually
decrease the volume of the right sample, leaving the left sample untouched.
I'm going to prepare a pull-request to add support for balance CC 8.

But my questions to you is: what do we do about the panning control on CC
10 for stereo samples? I see three options:

1. We leave it as is, with the weird and in my opinion wrong behaviour
2. We disable panning completely for samples that are panned to -50 or 50
in the SoundFont
3. We implement the balance logic for all samples that are panned to -50 or
50 (or even for samples with non-zero panning?) in the SoundFont and use
the existing panning logic for everything else

I tend to favour option 3, because that is also how most DAWs work: if you
use the panning control knob on a mono track, it acts as a mono to stereo
panning control. If you use the panning control knob on a stereo track, it
acts as a stereo balance control as explained above. We woundn't even need
to detect matching stereo samples in the SoundFont. Special casing for
samples with -50 or 50 panning values (or even non-zero panning?) should be
enough.

What do you think? Is option 3 worth a try?

Cheers,

    Marcus
_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to