How to Specify ALSA Subdevices in Ecasound
This article explains the syntax used to specify an Advanced Linux Sound Architecture (ALSA) hardware subdevice in Ecasound. It details the ALSA naming convention, demonstrates how to integrate hardware identifiers into Ecasound input and output options, and provides working command-line examples.
The ALSA Subdevice Syntax
In ALSA, hardware devices are addressed using the format:
hw:CARD,DEV,SUBDEV
- CARD: The card index number or the string identifier of the sound card.
- DEV: The device index on that card (defaults to
0if omitted). - SUBDEV: The specific subdevice index (defaults to
0if omitted).
To address an ALSA device in Ecasound, pass the ALSA driver type
followed by a comma and the device string to the audio input
(-i) or output (-o) flags:
alsa,hw:CARD,DEV,SUBDEV
If sample rate, format, or channel conversion is required by the
hardware, use plughw instead of hw:
alsa,plughw:CARD,DEV,SUBDEV
Locating Subdevice Numbers
To find the correct card, device, and subdevice numbers on your system, query ALSA playback or capture hardware using the command line:
- For playback devices:
aplay -l - For recording devices:
arecord -l
The output displays cards, devices, and available subdevices with their corresponding zero-indexed numbers.
Practical Command Examples
1. Routing Input from a Specific Subdevice
To record from card 1, device 0, subdevice 1 to a WAV file:
ecasound -i alsa,hw:1,0,1 -o output.wav2. Routing Output to a Specific Subdevice
To play back a stereo file through card 0, device 0, subdevice 2:
ecasound -i input.wav -o alsa,hw:0,0,23. Full Duplex Processing with Specific Subdevices
To capture audio from card 1, device 0, subdevice 0 and output it in real time to card 0, device 0, subdevice 1 using ALSA plug layer for format matching:
ecasound -i alsa,plughw:1,0,0 -o alsa,plughw:0,0,1