Combine Ecasound and SoX for Audio Production

This article provides an overview of how to build an advanced command-line audio production pipeline by combining Ecasound and SoX (Sound eXchange). By chaining these two powerful utilities through UNIX pipes, audio engineers can leverage SoX's extensive format conversion and sample-level signal processing alongside Ecasound’s multitrack routing, real-time effect chains, and LADSPA plugin hosting.

The Roles of Ecasound and SoX

SoX operates as a command-line "Swiss Army knife" for audio. It specializes in quick conversions, trimming, sample rate changes, and algorithmic effects such as dynamic range compression, filtering, and normalization.

Ecasound is a multitrack audio processing tool designed for real-time routing, mixing, recording, and applying complex effect networks. It can host LADSPA plugins, manage multiple independent audio chains, and automate parameters over time.

When used alone, each tool has limitations: SoX lacks multitrack session architecture, and Ecasound has stricter input format requirements and fewer standalone analysis tools. Pairing them combines the strengths of both.

The Pipeline Architecture

Communication between SoX and Ecasound occurs via standard input and output streams (stdout and stdin) passing uncompressed raw PCM (Pulse Code Modulation) data. This eliminates intermediate disk writes, ensuring fast processing and zero generation loss.

Both utilities must agree on the audio format parameters:

Practical Pipeline Examples

1. Pre-Processing with SoX and Multitrack Routing with Ecasound

In this pipeline, SoX decodes a compressed audio file, normalizes it, trims silence, and streams raw PCM directly into Ecasound, where a LADSPA plugin applies time-based processing:

sox input.flac -t raw -r 48000 -c 2 -b 24 -e signed-integer - silence 1 0.1 1% | \
ecasound -i:stdin -f:s24_le,2,48000 -el:tap_reverb,2500,-10,0,1 -o:master.wav

2. Ecasound Multitrack Mixdown to SoX Mastering Chain

In this workflow, Ecasound mixes multiple independent stems with separate gain staging, then pipes the master bus into SoX for final compression and limiting:

ecasound \
  -a:1 -i:drums.wav -ea:90 \
  -a:2 -i:bass.wav  -ea:85 \
  -a:3 -i:lead.wav  -ea:100 \
  -a:all -o:stdout -f:s32_le,2,48000 | \
sox -t raw -r 48000 -c 2 -b 32 -e signed-integer - -t wav final_master.wav \
  compand 0.3,1 6:-70,-60,-20 -5 -90 0.2 \
  gain -n -0.5

Workflow Tips