Re: 32 bit float truncated to 24 bit int with no parameters

Måns Rullgård <[email protected]> Mon, 14 Nov 2022 13:59:42 +0000
Newsgroups gmane.comp.audio.sox
Message-ID <[email protected]>
Sergei Steshenko via Sox-users <[email protected]> writes:

> On 09/11/2022 16:54, Måns Rullgård wrote:
>> Sean Hurley <[email protected]> writes:
>>
>>> Heya,
>>>
>>> I'm a newbie to sox, and I've recently been using it to trim, append, and
>>> normalize PCM audio.  Those functions work fine (I have removed those
>>> specific parameters in the command below since my issue persists without
>>> them).
>>>
>>> However, when I try to save my file as 32 bit float, the audio is truncated
>>> to 24 bit int.  Even if I have no parameters and just input output a 32f
>>> file, the audio is truncated to 24 bit int.  Here's the command, where
>>> in.wav is a 32 bit float file with content more precise than 24 bit int:
>>>
>>> sox "in.wav" "out.wav"
>>>
>>> To be clear, the output file IS a 32 bit float file, but the audio is
>>> truncated to 24 bit.  I also tried specifying 32 bit float in the command,
>>> but no change.
>> SoX uses integer representation of samples internally regardless of what
>> the source format was.  If a floating-point input contains sample values
>> that can't be represented as integers, they will be clipped or rounded.
>>
>> See this bug entry: https://sourceforge.net/p/sox/bugs/317/
>>
> Just curious - SoX has various filtering capabilities - including biquads,
> FIR, etc - see e.g. here: https://www.mankier.com/1/sox . So, when filters
> are applied, what kind of arithmetic is used - integer 32 bits, floating
> point 32 bits, floating point 64 bits, something else ?

Most of them use floating-point, but it varies.

-- 
Måns Rullgård