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:
- Channels 1 and 2 represent the primary program audio (left and right).
- Channels 3 and 4 (or channel 3 in a mono trigger setup) represent the sidechain control signal (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:
- The Program Chain: Carries the audio to be compressed (e.g., background music).
- The Control Chain: Carries the trigger audio (e.g., a voiceover microphone) and duplicates it to a loop device.
- 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:
- Chain
musicreads the stereo background track:-a:music -i:music.wav - Chain
voicereads the microphone or voice track:-a:voice -i:voice.wav
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:
-a:voice -o:loop,voice_out-a:voice_sc -i:loop,voice_out -o:loop,sc_trigger
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:
-a:comp -i:loop,music_in- Combine with the sidechain loop using
-a:comp -i:loop,sc_trigger - Use the channel routing operator
-erc:src,destor channel-mixing operators to ensure Channels 1–2 hold the music, and Channel 3 holds the voice trigger.
4. Applying the Plugin and Extracting Output
Once aligned into a single chain:
- Load the dynamic plugin with
-el:plugin_name,parameters... - The plugin monitors Channel 3 to attenuate Channels 1 and 2.
- Remove or mute Channel 3 before the signal reaches the master output
using the channel-select or route copy operator (
-erc), ensuring only the processed stereo program is sent downstream.
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:alsaIn this routing configuration:
- The dynamic effect (
sc4) evaluates the amplitude threshold strictly against the routed sidechain input on channel 3. - When amplitude on channel 3 exceeds the defined threshold, gain reduction applies automatically to channels 1 and 2.
- The downstream pipeline discards the sidechain channel and blends the compressed music with the clean voice channel for the final mix.