Ecasound File vs Hardware Inputs on Command Line
This article provides an overview of how Ecasound distinguishes
between physical hardware interfaces and stored audio files when parsing
command-line options. By understanding how the utility evaluates the
-i (input) argument through device prefixes, file
extensions, and device nodes, you can reliably route both file-based
media and live audio streams in your processing chains.
Ecasound differentiates audio sources using a combination of explicit
driver prefixes, filesystem paths, and recognized file format extensions
provided to the -i parameter.
1. Driver and Subsystem Prefixes
Hardware audio inputs typically require a subsystem prefix that tells
Ecasound which audio backend driver to use to communicate with the
physical sound card. The syntax follows a type,parameter
format:
- ALSA Devices: Specified using the
alsakeyword followed by the ALSA device identifier.- Example:
-i alsa,default - Example:
-i alsa,hw:0,0
- Example:
- JACK Audio Connection Kit: Specified using the
jackkeyword to route live audio from another client or system capture.- Example:
-i jack - Example:
-i jack,system:capture_1
- Example:
When Ecasound encounters these prefixes, it bypasses the filesystem file reader and initializes the corresponding real-time audio subsystem driver.
2. Device Node Paths (OSS/Legacy)
For older interfaces such as Open Sound System (OSS), hardware
devices are represented directly as filesystem nodes under
/dev. Ecasound checks whether the path corresponds to a
character device rather than a regular file:
- Example:
-i /dev/dsp
If the targeted path is identified as a direct sound card interface node, Ecasound attaches to it as an input stream rather than attempting to read it as a standard audio file.
3. File Extensions and Regular Paths
When no subsystem prefix (like alsa or
jack) is provided, Ecasound treats the input as a file. It
determines how to decode the data by inspecting the filename's
extension:
- Standard Audio Files: Filenames ending in
.wav,.flac,.mp3, or.oggautomatically trigger the appropriate decoder or file-reading engine.- Example:
-i track1.wav - Example:
-i /path/to/recording.flac
- Example:
- Raw PCM Files: If raw, headerless audio is used,
Ecasound allows explicit format definitions prefixed to the file (e.g.,
-i:raw,format_params filename.raw).
Summary of Parsing Priority
When resolving an input:
- Prefix Match: Ecasound checks if the string starts
with a recognized audio I/O driver keyword followed by a comma (e.g.,
alsa,,jack,). - Device Node Match: Ecasound checks if the argument
points to an existing system hardware node (e.g.,
/dev/dsp). - File Match: If neither condition is met, the argument is handled as a standard filesystem path and processed using the file extension to load the corresponding audio reader.