Route Audio to Multiple Outputs in Ecasound

Ecasound routes a single audio input to multiple output destinations using its chain-based architecture. By grouping multiple signal chains to a shared input or using virtual loopback devices, Ecasound can duplicate an incoming stream—whether from a soundcard, audio file, or network stream—and deliver it simultaneously to distinct outputs such as physical hardware channels, disk files, or JACK ports.

The Chain Assignment Method

The primary and most efficient method to route an input to multiple outputs is assigning the input source to multiple chains at once using the -a option.

In Ecasound, a chain represents an individual signal path. When an input is assigned to multiple chains, Ecasound splits the input stream and feeds an identical copy to each designated chain. Each chain can then specify its own independent output.

Syntax Example

ecasound -a:1,2 -i:source.wav -a:1 -o:alsa,default -a:2 -o:copy.wav

How It Works:

  1. -a:1,2 -i:source.wav: Creates chains 1 and 2, attaching the single input (source.wav) to both.
  2. -a:1 -o:alsa,default: Directs the processed audio of chain 1 to the default ALSA sound device for real-time monitoring.
  3. -a:2 -o:copy.wav: Directs the audio of chain 2 simultaneously to a new file named copy.wav.

Independent Chain Processing

Because each output destination resides on its own chain, you can apply effects, volume adjustments, or format changes to one destination without affecting the other.

ecasound -a:1,2 -i:live_input.wav \
  -a:1 -ea:100 -o:alsa \
  -a:2 -ea:50 -efl:1000 -o:stream.wav

In this scenario:

The Loop Device Method

For complex configurations where preprocessing must occur prior to the split, Ecasound provides virtual loop devices (loop,tag). This allows you to apply master effects to an input chain before distributing it to child chains.

Syntax Example

ecasound -a:in -i:mic.wav -ea:120 -o:loop,1 \
  -a:out1,out2 -i:loop,1 \
  -a:out1 -o:alsa \
  -a:out2 -o:backup.wav

How It Works:

  1. Input Stage: Chain in captures the microphone, amplifies it by 20% (-ea:120), and sends the output to an internal buffer named loop,1.
  2. Routing Stage: Chains out1 and out2 use loop,1 as their shared input.
  3. Output Stage: Chain out1 routes to hardware playback, while chain out2 records the amplified signal directly to a file.