AI disclosure: Sonari Studio generated this tutorial with AI and checked the results against local FFmpeg renders. The signal is synthetic, not a recorder or DAW test.

If your export pipeline accepts float samples, turning down the input to the integer encoder and turning down its output are different operations. An over-range float can still contain the original sample. An integer conversion that saturated the sample has already lost it. This is easy to miss if a test only asserts that the final file peaks below 0 dBFS.

Reproduce the two paths

Use Python 3 and FFmpeg in an empty scratch folder. The script generates one second of mono 48 kHz audio with a 1 kHz sine and a deliberately hot peak of 1.5. It writes that same source to a float WAV and a signed 16-bit WAV, then applies a gain of 0.5 when re-exporting both. Don't play the two untrimmed fixtures at unchanged gain.

import math, struct, subprocess rate = 48000 source = [1.5 * math.sin(2 * math.pi * 1000 * i / rate) for i in range(rate)] raw = struct.pack(f'<{rate}f', *source) def ff(*args, data=None): return subprocess.run( ['ffmpeg', '-nostdin', '-v', 'error', '-n', *args], input=data, stdout=subprocess.PIPE, check=True, ).stdout for label, codec in [('float', 'pcm_f32le'), ('integer', 'pcm_s16le')]: ff('-f', 'f32le', '-ar', str(rate), '-ac', '1', '-i', 'pipe:0', '-c:a', codec, f'{label}-hot.wav', data=raw) ff('-i', f'{label}-hot.wav', '-af', 'volume=0.5', '-c:a', 'pcm_s16le', f'{label}-trim.wav') def decode(path): data = ff('-i', path, '-f', 'f32le', 'pipe:1') return struct.unpack(f'<{len(data)//4}f', data) float_trim = decode('float-trim.wav') int_trim = decode('integer-trim.wav') assert len(float_trim) == len(int_trim) == rate assert max(map(abs, float_trim)) == 0.75 assert max(map(abs, int_trim)) == 0.5 assert max(abs(got - want * 0.5) for got, want in zip(float_trim, source)) < 1 / 32768 assert max(abs(got - want * 0.5) for got, want in zip(int_trim, source)) >= 0.25 

A quieter file can be the broken one

First WAV encoding Peak after the same trim Expected half-level shape
32-bit float 0.75 (−2.50 dBFS sample peak) Rounded; error below one 16-bit quantization step
16-bit integer 0.50 (−6.02 dBFS sample peak) Flat; sample error at the peak is at least 0.25

The integer-first path is quieter by sample peak, but it isn't cleaner. A projection of the steady-state samples onto the 3 kHz sine and cosine gives a third harmonic about 16.5 dB below the 1 kHz fundamental in that path. That number describes this fixture only. It isn't a clipping test for arbitrary music, and dBFS above is based on sample peaks, not true peaks.

Put the regression check at the format boundary

If your exporter promises to preserve a float mix until the final write, test it with a controlled over-range input followed by attenuation. Decode the output and compare it to the reference after applying the intended gain, with tolerance for quantization or configured dither. In real material, a limiter, intentional saturation, or a clipped microphone input changes the comparison; float storage won't undo a nonlinearity earlier in the pipeline. If the clipped file is all you have, a de-clip effect can estimate a curve, not recover the original samples.

Sources: Audacity's digital audio reference, Clip Fix, and the FFmpeg volume filter.