Question about how tuning works

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about how tuning works

Forrest Cahoon
Some time ago I updated the hooks into Fluidsynth for the ChucK music programming language to support the tuning API. I wrote a sample program which used the
FluidR3_GM.sf2 soundfont. In my test, I mapped notes to MIDI note numbers that were not close to the frequency they represent in the standard mapping; for instance I mapped 6968.8259 cents to MIDI note 0, and this seemed to work fine.

Much later, I tried using these same Fluidsynth calls via ChucK with a different soundfont (Nice-Keys-Ultimate-V2.3.sf2 which is freely available from https://sites.google.com/site/soundfonts4u/) and I had a very different experience: the sound I got out depended on which note I was mapping it to.

When I mapped 6000 cents to note 0, I got no sound at all.
When I mapped 6000 cents to note 20, I got a really thin-sounding piano middle C note.
When I mapped 6000 cents to note 60, I got a normal-sounding piano middle C note.
When I mapped 6000 cents to note 90, I got a rich bell-like middle C note.

My hypothesis is that when fluidsynth maps samples to midi note numbers when tuning, it uses samples near the note number being mapped to, perhaps altering the frequency a lot, to get to the desired tuning. I would have instead expected that samples near the desired tuning were used to generate the note, chosen so as to only have to alter the frequency a minimal amount, and that is triggered by the arbitrary MIDI note number it's mapped to (which should play no role in the choice of samples).

Is my understanding correct? Is there something I can do to get the behavior I expected?

Forrest

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev
Reply | Threaded
Open this post in threaded view
|

Re: Question about how tuning works

Marcus Weseloh
Hi Forrest,

Am Mo., 20. Jan. 2020 um 04:20 Uhr schrieb Forrest Cahoon
<[hidden email]>:
> My hypothesis is that when fluidsynth maps samples to midi note numbers when tuning, it uses samples near the note number being mapped to, perhaps altering the frequency a lot, to get to the desired tuning. I would have instead expected that samples near the desired tuning were used to generate the note, chosen so as to only have to alter the frequency a minimal amount, and that is triggered by the arbitrary MIDI note number it's mapped to (which should play no role in the choice of samples).

Your hypothesis is correct. FluidSynth chooses the sample based on the
MIDI note number and then pitches that sample according to the values
set via the tuning API. As far as I know, there is currently no way to
achieve the behavior you expect, at least not without some external
programming.

You could do this mapping of frequencies to fitting notes (and
therefore samples) yourself, though. Create a lookup table of the
normal MIDI note values to their standard frequencies. Then if you
want to hear a sound at 6kHz, lookup up the closest MIDI note number.
Then issue tuning API call for that note, but make sure it's
non-real-time so it doesn't affect any sounding notes. Then send the
note on.

Cheers
Marcus

_______________________________________________
fluid-dev mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/fluid-dev