Ecasound Dithering for 24-Bit to 16-Bit Audio

Converting 24-bit studio recordings down to 16-bit CD-standard audio requires quantization, a process that introduces harmonic distortion unless dithering is applied. Ecasound processes audio internally using 32-bit floating-point precision, but its native format converter does not automatically apply dithering when reducing word length. To prevent truncation distortion when mastering for CD, users must actively manage the signal chain within Ecasound using external plugins, backend audio libraries, or specialized dither algorithms.

Internal Processing and Truncation

When Ecasound reads a 24-bit audio file (such as s24_le), it automatically scales and unifies the stream into 32-bit floating-point format (f32_le) for all internal mixing, routing, and effects processing.

When you define an output file with 16-bit resolution using the format option (e.g., -f:s16_le,2,44100), Ecasound must quantize these floating-point samples down to fixed 16-bit integers. By default, Ecasound performs direct sample conversion through simple rounding or bit truncation. This process produces quantization distortion—correlated noise that manifests as harsh, low-level artifacts in quiet passages and reverb tails.

Applying Dither via LADSPA Plugins

Because Ecasound does not feature a built-in, native Triangular Probability Density Function (TPDF) dither switch in its core routing engine, the standard method to achieve professional-grade dithering is through LADSPA (Linux Audio Developer's Simple Plugin API) plugins.

The most common solution is the SWH LADSPA plugin collection by Steve Harris, which includes the dither_1216 plugin. This plugin adds shaped dither or standard TPDF noise before the signal is converted to 16-bit integers.

To apply dithering directly inside an Ecasound command, insert the plugin into the signal chain immediately before the output stage:

ecasound -i:input_24bit.wav -el:dither_1216 -f:s16_le,2,44100 -o:output_16bit.wav

In this chain:

  1. input_24bit.wav is converted to internal 32-bit float.
  2. The -el:dither_1216 effect applies noise-shaped dithering to the float data, preparing the lower bits for quantization.
  3. The -f:s16_le,2,44100 parameter converts the dithered floating-point audio into standard Red Book CD-compatible fixed-point audio without quantization distortion.

Resampling and Quantization Dependencies

If downsampling sample rates (e.g., from 96 kHz to 44.1 kHz) simultaneously with bit depth reduction, order of operations is critical. Sample rate conversion should occur before dithering.

Ecasound can be compiled against libsamplerate (Secret Rabbit Code) for high-quality sample rate conversion. While libsndfile handles the final writing of WAV files and supports internal dithering options in certain environments, specifying a dedicated dither plugin in your Ecasound chain ensures the dither is consistently applied regardless of how the underlying file I/O libraries are configured.