| Hello dear CSounders!
I'm writing a tool to convert float-samples to
integers, as a newbie project while I'm learning
C, but now I have a question about how to scale
a stream of floats correctly to fit to the full
integer range?
The problem is the assymetric integer-format,
as the range is from -32768 -> 32767 (16-bit).
What method should I use when scaling?
1. [output stream] = [stream of floats] * (32767/maxfloat)
2. [output stream] = [stream of floats] * (32767.5/maxfloat)-0.5
The second version will have a slight offset, but the resolution
will be better.. In this case I guess that the small offset
won't affext the soundquality at all?
Yes, I know we are talking about *extremly* small
values, that can't possibly be *heard* with even
the best speakers/amplifiers/da-converters!!!
But still! I'm a perfectionist!, and you should
also be able to output 8-bit integers, and there
may the difference be heard..
.--- -- - -
| Anders "Pipe/Nature" Andersson, pipe@algonet.se
| Proud member of the Amiga community, Nature and Mensa Sweden.
: |