On 09/19/2011 11:20 PM, Michael Geis wrote:
Greetings,
I posted a question on using fluidsynth to extract .sf2 sounds to .wav
files a few weeks ago. The answers I received indicated I had to get a
better grasp of the subject matter and as a consequence I had to think
over what I am doing.
Sorry if this post is perhaps only marginally related to fluidsynth. I
am trying to develop a better grasp on soundfonts and fluidsynth may or
may not be what I will need to use in my project (which I currently have
a hard time telling because of my limited understanding of the subject
matter).
I am hoping quite a few people here are familiar with the nitty gritty
of the soundfont standard (since fluidsynth implements it) and might be
able to help me get a better grasp on what the soundfont standard
entails and how to work with it.
So, my original project was to look for ways to extract soundfont
samples so friends could use it in a sampler they are writing in
supercollider. What that sampler does is essentially loop over the
samples and apply envelopes.
I dug into the soundfont spec, which illustrates the synthesis model of
soundfonts very roughly as follows:
A wave table oscillator loops over the wavetables, its output is sent
through a dynamic low-pass filter. The result is modified by an envelope
amplifier (DAHDSR) and then sent to effects units that control pan,
reverb and chorus. The modulation engine feeds output of vibrato and
modulation LFOs as well as modulation envelopes into various stages of
the pipeline above.
We were under the (probably naive) impression that all a sampler needs
to do is loop over wave tables and apply envelopes. Seeing that the
soundfont specification actually allows for greater complexity makes us
wonder whether in order to play soundfonts, the sampler needs to be able
to do all the things in the synthesis model. Unless there is a
discrepancy between what the specification allows for and what most
soundfonts look like in the wild. If a substantial fraction of
soundfonts just loop over wave tables and apply envelopes, the sampler
might still be useful for that subset of soundfonts if it just grabbed
their wave tables and envelope parameters. The answer must be trivial
for someone who has used soundfonts for a bit, I must admit it is not
clear to me.
Otherwise (i.e. if soundfont generally make full use of all the parts of
the synthesis engine laid out in the spec), I see 2 options:
1.Implement the entirety of the synthesis model and use the parsed
soundfont parameters as input (That sounds like reimplementing a lot of
what fluidsynth already does).
2.Play the soundfonts via fluidsynth and record the output. The sampler
then loops over that output and applies envelopes. Does 2. even make
sense or is it likely to mangle the sounds?If it is reasonable, how
many notes should I have for each pitch? One per pitch or one per
envelope phase (i.e. 5 for the DAHDSR envelopes since delay doesn't make
a sound) per pitch?
I guess this might be related to how many wave tables are usually used
for a given instrument in the soundfont format. One per pitch? One for
every envelope phase of every pitch?
Also note that the strength of the note-on often affects the output, e g
on a piano sound, a weak note has less treble than a strong one.
My apologies if I am somewhat lacking coherence here, I am still trying
to get a decent grasp on the subject matter.
I'm not exactly sure what would be considered a part of your project or
not, but have you considered actually having FluidSynth as your sampler
(i e calling it in real-time from Supercollider), and if you want to
apply some extra envelopes, modify the FluidSynth code in relevant places?
That would probably be the simplest method if you want to accurately
play back soundfonts. If you just want to get something easy to play
with, you can use either method 1 or 2, and implement as much as you want.
// David
_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev