[Portaudio] The 16 bit truncation

Bernt Ronningsbakk bernt.ronningsbakk at lyse.net
Fri Dec 4 21:19:03 EST 2015


Hi Ross,

I did these changes in direct sound and the queryformat function in win mme.


I am not able to evaluate these changes on win xp. I haven't seen one of
those in years. Windows Vista was launched in 2006. That is nearly 10 years
ago.  If xp compatibility is an acceptance criteria, perhaps the best
solution is to test for windows version. AFAIK Vista or later can handle 24
int and 32 float regardless of the sound card. 

Kind regards,

Bernt


Message: 2
Date: Fri, 4 Dec 2015 19:56:13 +1100
From: Ross Bencina <rossb-lists at audiomulch.com>
To: portaudio at lists.columbia.edu
Subject: Re: [Portaudio] The 16 bit truncation
Message-ID: <5661552D.3050308 at audiomulch.com>
Content-Type: text/plain; charset=windows-1252; format=flowed

Hi Bernt,

On 4/12/2015 12:54 PM, Bernt Ronningsbakk wrote:
> The 16 bit truncation is a substantial weakness in PA.

I presume you're talking about PA/DirectSound. I'm not aware of that
limitation in any other host API.


> 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 */
>          //Bernt
>          //PaSampleFormat nativeInputFormats = paInt16;
>          PaSampleFormat nativeInputFormats =
> inputParameters->sampleFormat;//Bernt
>          /* 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.

The "very good reason" is that there is no fallback path if >16-bit fails.

If you can provide good evidence that Windows (XP and later) will always 
accept >16-bit then I agree that we should just go ahead with your 
proposed changes. But otherwise, I think 16-bit truncation is a better 
option than failing.

The correct fix, as has been discussed here in the past, and in the 
tickets, is to retry with 16 bit if a higher bit-depth fails. I'd be 
very happy to accept a patch that does this retry.


> 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.

I'm not sure what you are proposing with the above paragraph.

Thanks,

Ross.





------------------------------

_______________________________________________
Portaudio mailing list
Portaudio at lists.columbia.edu
https://lists.columbia.edu/mailman/listinfo/portaudio

End of Portaudio Digest, Vol 6, Issue 4
***************************************



More information about the Portaudio mailing list