[Portaudio] More on bitdepths

Bjorn Roche bjorn at xowave.com
Wed Dec 9 18:36:51 EST 2009

On Dec 9, 2009, at 6:22 PM, Phil Burk wrote:

> Hello Bjorn,
> Bjorn wrote:
> http://blog.bjornroche.com/2009/12/linearity-and-dynamic-range-in-int.html
> Nice blog.
> But some things are not clear:

It's all in there, but I admit I gloss over it pretty quick. Perhaps  
I'll make another entry summarizing my results.

> You recommend the "asymmetric" method or the "(2^n)" method. Is the
> (2^n) method this one?
>    (integer/0x8000) and float*0x8000

yes, that's (2^n). It passed every test except that it produced  
harmonic distortion with full-scale synthetic signals.

> And which one is the "asymmetric" method. Is it a "non-transparent"
> conversion?

Asymmetric is method 4 from here:


ie, for 16 bits:

int = float>0?float*0x7FFF:float*0x8000

float = integer>0?integer/0x7FFF:integer/0x8000

Which is transparent up to 24-bits when appropriately rounded. It is  
the only conversion method that passed every test I threw at it.

The "non-transparent" method I refer to in this article as the  
"mismatched" method. This article isn't really about transparency,  
since I'm taking dither into account. That conversion is

float = integer / 0x8000
int   = float * 0x7FFF

and it starts to fall apart pretty badly whether you apply dither or  


Bjorn Roche
XO Wave
Digital Audio Production and Post-Production Software

More information about the Portaudio mailing list