[Portaudio] The 16 bit truncation

Bernt Ronningsbakk bernt.ronningsbakk at lyse.net
Thu Dec 3 20:54:44 EST 2015

The 16 bit truncation is a substantial weakness in PA.

In the copy that I'm working on right now, I have removed all code that
changes the word format to 16 bit. And it seems to work without issues on my
PC. I haven't checked wdmks though, since it has other issues.

Here is one of the changes I've done in dsound:

        /* IMPLEMENT ME - establish which  host formats are available */
        //PaSampleFormat nativeInputFormats = paInt16;
        PaSampleFormat nativeInputFormats =
        /* PaSampleFormat nativeFormats = paUInt8 | paInt16 | paInt24 |
paInt32 | paFloat32; */

        hostInputSampleFormat =
            PaUtil_SelectClosestAvailableFormat( nativeInputFormats,
inputParameters->sampleFormat );// Bernt

A handful of these was all it took. I did text a search on 16 and simply
disabled all functionality that changed a stream to 16 bit. Several places
have  "implement me" regarding checking the sound card capability and
choosing the nearest format. I don't think that is needed. 

Unless there's a very good reason for keeping the 16 bit truncation I
suggest that we remove it.

A second best alternative would be to use paInt24 as default. It is good
enough for basically all purposes, and those who don't have a sound card who
supports this probably doesn't care if their win machine does a downsizing
that is a bit less than sota.

Kind regards,


More information about the Portaudio mailing list