0
votes

I have a heavily "overflowed" WAV file (samples written in float 32-bit format): instead of [-1.0,+1.0], the samples range goes as far as [-5.0,+5.0].

Using SoX to get raw PCM audio samples from WAV file:

sox --bits 32 --channels 1 --encoding floating-point --rate 48000 input.wav output.raw

I get warnings:

sox WARN sox: `input.wav' input clipped 1163400 samples
sox WARN sox: `output.raw' output clipped 605664 samples; decrease volume?

When I look into the output, I see the samples were clipped, and the range is [-1.0,+1.0] now. However, that is not what I want.

I would like to have exactly same output as input, just in different format (RAW instead of WAV). I need to use command line tool for the task. Is there a way to prevent SoX from doing the clipping?

1
looks like sox parm gain -6 will lower amplitude by 6 dBScott Stensland

1 Answers

0
votes

I got the answer from the SoX mailing list.

The required behaviour isn't possible, however, in this specific case there is a workaround. Overriding input sample encoding as 32-bit signed integer instead of float, the values will be copied untouched; since the output is headerless, it doesn't matter what SoX thinks the samples are.

So, this works:
sox --bits 32 --channels 1 --encoding signed-integer --rate 48000 input.wav output.raw