## How do I generate a 0 dBFS sine-wave in SoX? (output clipped warning)

3

2

I'm trying to generate a 48 kHz, 16-bit 0 dBFS WAV file of a 997 Hz sine wave, where the level is set to the maximum value of 7FFF, but SoX warns me the output was clipped when it finishes. I don't think I hear any clipping, but Audacity's "show clipping" command shows clipping at the peak, and the frequency analysis also shows the level reaches 6.5 dB!

What am I doing wrong, and how can I get exactly the desired 7FFF value?

Here's my command line:

sox -c 2 -D -S -b 16 -r 48k -e signed-integer -n 997Hz_0dBFS.wav synth 30 sine 997 gain 0


1

Check out the hexdump of the file you created.

When you do, you will realise that there are 7FFF values in the file that correspond to your sample peaks.

But, I'm going to say that you also have clipping here.

Why? Because I can see two values of 7FFF directly next to each other. This indicates that there are two identical peak sample values adjacent to each other meaning that the intervening analogue waveform will be above 0dBFS.

Check out True Peak Metering and you will see what I mean.

This will explain why audacity feels that there is clipping and that the peak value is +6.5dBFS.

You might need to tune the gain value iteratively so that you can determine exactly when the true peak hits 7FFF. You should remember that the true peak value will always exceed the sample peak value.

0

Maybe it's related to the double standards of 0 dbfs

Predictable waveforms (eg. sine wave) are used to create a reference of "full-scale", where some interpret the RMS mathematically, where "full-scale" sine wave equals -3 dB, and some argue that "full-scale" sine wave should measure 0 dBFS, and calibrate the measurement by +3dB.

Checkout the Wikipedia references 8,9,10,11,12 in the article http://en.wikipedia.org/wiki/DBFS