Scripting Ecasound Interactive Mode via Stdin

Ecasound fully supports feeding batch command scripts directly into its interactive mode using standard input (stdin). By invoking Ecasound with the interactive mode flag (-c), the engine continuously reads text-based instructions from the input stream, allowing you to automate multitrack processing, effect parameters, and routing. Using standard UNIX streams, redirection, pipes, and here-documents enables non-interactive, programmatic execution of Ecasound Control Interface (ECI) commands.

How Ecasound Handles Interactive Stdin

When launched with the -c option, Ecasound starts in interactive mode and listens for ECI commands via standard input. Rather than manually typing commands into the terminal prompt, you can pipe or redirect a pre-written text file containing sequential commands directly into the process.

Methods for Passing Batch Commands

1. Input Redirection

You can store your commands in a plain text file (commonly with a .eci extension) and pass it directly to Ecasound using shell redirection:

ecasound -c < batch_commands.eci

2. Using Standard Pipes

If commands need to be generated dynamically by another process, you can pipe standard output straight to Ecasound:

cat batch_commands.eci | ecasound -c

Or generate single, sequential commands inline:

printf "cs-add play_chain\nai-add input.wav\nao-add /dev/dsp\nstart\nsleep 5\nstop\nquit\n" | ecasound -c

3. Bash Here-Documents

For standalone shell scripts, embedding commands directly within a here-document avoids the need for external .eci files:

ecasound -c <<EOF
cs-add session1
c-add chain1
ai-add audio_track.wav
ao-add alsa
start
int-cmd-sleep 10
stop
quit
EOF

Essential Scripting Guidelines