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.wavHow It Works:
-a:1,2 -i:source.wav: Creates chains1and2, attaching the single input (source.wav) to both.-a:1 -o:alsa,default: Directs the processed audio of chain1to the default ALSA sound device for real-time monitoring.-a:2 -o:copy.wav: Directs the audio of chain2simultaneously to a new file namedcopy.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.wavIn this scenario:
- Chain 1 routes unattenuated audio (
-ea:100) to the ALSA speaker output. - Chain 2 reduces the volume by half (
-ea:50) and applies a low-pass filter at 1000 Hz (-efl:1000) before writing tostream.wav.
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.wavHow It Works:
- Input Stage: Chain
incaptures the microphone, amplifies it by 20% (-ea:120), and sends the output to an internal buffer namedloop,1. - Routing Stage: Chains
out1andout2useloop,1as their shared input. - Output Stage: Chain
out1routes to hardware playback, while chainout2records the amplified signal directly to a file.