[linux-audio-user] RAW to [other format] audio coverter questions

Paul Davis paul at linuxaudiosystems.com
Wed Nov 22 16:15:33 EST 2006

On Wed, 2006-11-22 at 18:56 +0100, Leonard "paniq" Ritter wrote:
> paul,
> we recently ported the buzzhost to linux ( = aldrin). a default
> convention in this program is to mix into float buffers in the -32768 to
> 32767 range. only recently we changed all the code to keep to -1 .. 1.
> it has been claimed numerous times that buzz' sound quality was worse
> than what you are used to. i couldn't hear that and i blame it on lack
> of talent and mastering skills on the artists side, but i'm still
> curious whether an implementation such as above can significantly impact
> on the dynamic quality of digital music.
> what do you say?

the truly precise range is limited to the width of the mantissa: N bits,
where N is fixed depending on whether its a 32 bit float or an 80 bit
double. you can use those N bits anyway you want: you've got a signal
that varies between zero and the maximum voltage handled by a given D/A
converter, and you've got 2^N (plus or minus 1) values to represent them
with. you've got choices about how you use them:

    a) just use 16 bits of the mantissa, and fix the exponent bits
    b) use all 24 bits of the mantissa, and fix the exponent bits
           (-2^24 ... + 2^24 - 1)
    c) use all 24 bits of the mantissa, and vary the exponent bits
           (-2^24 ... + 2^24 - 1) * 10^{0...7}
    d) use a normal floating point representation 
    e) use all 24 bits of the mantissa but with normalized values, 
         which implies varying the exponent

there are more.

(a) is similar to the case you were describing, and it has only 16 bits
of resolution for the non-summing mixer situation. kind of a waste of 8
bits, no? its only benefit over 16 bit values is that if you sum them
and the answer > 2^16 - 1, you don't clip, you just get the potential
for a small amount of distortion.

the way to get this into your head, or at least the way i got it into
mine, was to forget the idea of associating specific numbers with bit
patterns in the floating point representation. just think of there being
a set of 2^24 - 1 ordered bit patterns, each one of them representing
some analog signal level. depending on what you do with the exponent
bits, these bit patterns could be thought of as representing integer
values between 0 and 2^24, or between -2^24..+2^24-1, or floating point
values between -1 and +1, or many other ranges, or nothing at all.  


More information about the linux-audio-user mailing list