Ecasound ALSA Playback Command-Line Syntax

This article explains the command-line syntax required to route audio playback to an Advanced Linux Sound Architecture (ALSA) device using Ecasound. It covers the standard output arguments, device naming conventions, and practical examples for targeting specific soundcards and ALSA subdevices.

Basic Output Syntax

In Ecasound, an audio destination is defined using the -o (output) option. To specify ALSA as the playback subsystem, prefix the device identifier with the alsa keyword:

ecasound -i input_file.wav -o alsa

Running this command routes playback to the default ALSA device defined in your system configuration.

Target Specific ALSA Devices

To target a specific soundcard or virtual ALSA PCM device, pass the device name immediately after alsa, without spaces:

-o alsa,DEVICE_NAME

1. Default ALSA Device

To explicitly use the default sound device:

ecasound -i input.wav -o alsa,default

2. Direct Hardware Device (hw)

To bypass ALSA software mixing and send audio directly to a hardware card and subdevice, use the hw:CARD,DEVICE syntax:

ecasound -i input.wav -o alsa,hw:0,0

3. Automatic Sample Rate and Format Conversion (plughw)

Direct hardware access (hw) fails if the source audio format or sample rate does not match the soundcard's native capabilities. To enable automatic conversion via ALSA plugins, use plughw:

ecasound -i input.wav -o alsa,plughw:0,0

4. ALSA PCM Names and Virtual Devices

You can also target named devices or ALSA definitions configured in /etc/asound.conf or ~/.asoundrc:

ecasound -i input.wav -o alsa,surround51

Syntax Within Multi-Chain Routing

When configuring chains in Ecasound, attach the -o parameter to a specific chain identifier using -a:

ecasound -a:playback -i track1.wav -o alsa,plughw:1,0

Finding Device Identifiers

To identify the available cards and device numbers on your system, run:

aplay -l

The card index and device index output by aplay -l correspond directly to the values required by hw:CARD,DEVICE or plughw:CARD,DEVICE in Ecasound.