Ecasound Sidechain Routing for Dynamic Effects

Ecasound achieves sidechain dynamic processing by combining its modular chain architecture, channel-mapping operators, and multi-channel LADSPA dynamic plugins. By routing a secondary control signal alongside a primary audio signal via inter-chain loop devices or channel multiplexing, users can drive dynamics processors—such as duckers, compressors, and gates—using an external trigger. This article details the structural mechanics of Ecasound's signal flow and demonstrates how to configure external sidechain routing directly from the command line.

The Mechanism: Multi-Channel LADSPA Architecture

Ecasound does not feature a dedicated internal "sidechain" bus in the traditional graphical digital audio workstation (DAW) sense. Instead, it relies on the channel configuration of LADSPA (Linux Audio Developer's Simple Plugin API) plugins that accept sidechain inputs, such as Steve Harris’s SC4 compressor (sc4_1882).

In this model, a sidechain-enabled plugin treats extra audio channels as the control trigger:

To make sidechaining work, Ecasound must aggregate the target audio and the trigger audio into a single multi-channel stream before feeding that stream into the plugin.

Inter-Chain Routing via Loop Devices

Ecasound manages parallel processing through chains (defined by -a:chain_name). To route one signal into another chain as a trigger, Ecasound uses internal real-time loop devices (loop,id).

A typical ducking setup involves three functional chains:

  1. The Program Chain: Carries the audio to be compressed (e.g., background music).
  2. The Control Chain: Carries the trigger audio (e.g., a voiceover microphone) and duplicates it to a loop device.
  3. The Processing Chain: Takes the audio and the loop signal, multiplexes them into a 4-channel stream, processes them with the LADSPA compressor, and strips the trigger channels before outputting to the soundcard or file.

Step-by-Step Sidechain Implementation

To illustrate the signal routing, consider ducking a stereo music track using a mono voiceover track.

1. Defining Chains and Inputs

The inputs are assigned to separate chains:

2. Splitting the Control Signal

The voice signal must be heard in the final mix, but it must also serve as the trigger. The voice chain outputs to both the master mix loop and a sidechain loop:

3. Channel Multiplexing

In the processing chain (comp), the music track and the loopback trigger must be combined into a multi-channel stream. Ecasound's channel-routing operators handle this:

4. Applying the Plugin and Extracting Output

Once aligned into a single chain:

Practical Command-Line Example

The following command demonstrates ducking stereo music (music.wav) against a mono voiceover (voice.wav) using the SC4 compressor plugin:

ecasound \
  -a:music -i:music.wav -o:loop,1 \
  -a:voice -i:voice.wav -o:loop,2 \
  -a:mix_music -i:loop,1 -erc:1,1 -erc:2,2 -o:loop,3 \
  -a:mix_sc -i:loop,2 -erc:1,3 -o:loop,3 \
  -a:process -i:loop,3 \
    -f:s16_le,4,44100 \
    -el:sc4,0,10,0,-24,4,2,0.1,100,0,0,0 \
    -erc:1,1 -erc:2,2 \
    -f:s16_le,2,44100 \
  -a:master -i:loop,3 -a:voice_dry -i:loop,2 -a:master,voice_dry -o:alsa

In this routing configuration: