Andrew H wrote on Thu, 16 February 2006 00:30 |
I have a question about the concept of 'full scale' when using signed integers.
If I have an audio file (say 16 bit WAV), the values describing the amplitude of the waveform can range from -32768 to +32767.
If I had a peak value at +32767, would this be:
20*log10(32767/32767) = 0 dBFS
or
20*log10(32767/32768) = -0.0002651 dBFS
Similarly, does a negative peak value of -32768 give:
20*log10(-32768/-32768) = 0 dBFS ?
Is this a purely mathematical concern (with a simple accepted definition) or should there be some consideration of the way an ADC works if we want to be technically correct?
Thanks,
Andrew
|
It would be
20*log10(32767/32768) = -0.0002651 dBFS
Similarly, does a negative peak value of -32768 give:
20*log10(-32768/-32768) = 0 dBFS
The reason for the lack of symetry is that adding one more quantization level at the positive peak would require adding a bit (17 bit word). Look at a 3 bit binary for example:
decimal 0 is binary 000
decimal 1 is binary 001
decimal 2 is binary 010
decimal 3 is binary 011
decimal 4 is binary 100
decimal 5 is binary 101
decimal 6 is binary 110
decimal 7 is binary 111
if you want decimal 8 it becomes binary 1000 thus 4 bits (not 3)
So now we want to "split" our bianry code into "2 sections", one is for positive and the other is for negative numbers.
There are a couple of ways to do that, beyond the scope of this post. There is a convention for using the MSB as 0 to note positive and 1 no note negative number, but that is not the best from "ease of artithmmetics" standpoint therefore there is a first complement and also one called 2nd complement which is very practical code.
But for any code, given that 2^n is always even, and given that one code value needs to be assigned to zero value, we end up with a lack of symetry of 1 quantization.
Of course, in the case of 3 bits, 1 quantization is huge imbalance, in the case of 16 bits it is relativly tiny, as your calculation shows.
Regards
Dan Lavry
www.lavryengineering.com