fluid-dev
[Top][All Lists]
Advanced

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

[fluid-dev] Why not use fixed point ?


From: Joost
Subject: [fluid-dev] Why not use fixed point ?
Date: Thu, 8 Jul 2004 15:59:48 +0200 (CEST)

Hi list,

I wanted to turn an old computer into a sampler, and I thought about using
fluidsynth, but my computer (333 Mhz) was to slow for it.
Which I think is a little strange, because I remember mod-players doing
kind of the same things 10 years ago.

So I looked around the code a bit, and now I'm wondering:

Why are all samples processed as floating point numbers ?
All Open-Source samplers appear to do this!
It seems like a bit of an overkill to me.
Some creative printf usage taught me that typical values used are:
0 < dsp_amp < 1 , usualy << 0.3
|dsp_data| < 32768

So why not use normal integers ?

For example one could use 16 bit instrument sample data, multiply by a 12
bit dsp_amp value (giving 0-4095 volume levels), producing a 32 bit
output sample, without any loss of quality.
This 32 bit sample still has 4 spare bits, so when the samples are mixed
with other voices, there is headroom for at least 16 voices at max volume.
Afterwards the 32 bits samples can be shifted to the right to produce a 16
bit output sample.

This method should be far more efficient than using floats, and is also
easy to optimize further using assembler.

So, what am I missing?
Even if there is a small loss of quality, would it be audible?
What made you decide to use floating point samples?

Thanks,
Joost




reply via email to

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