Ecasound Audio Format Command-Line Syntax
This article provides a guide to the command-line syntax used to define audio format parameters in Ecasound. It covers the structure of the audio format flag, explains each comma-separated argument, and demonstrates how to apply these parameters to audio inputs and outputs.
In Ecasound, the audio format is defined using the -f
option. This option specifies how raw audio samples are interpreted or
how processed streams should be formatted before being sent to an output
target.
The Format Syntax
The general syntax for the audio format parameter is:
-f:sample_format,channels,sample_rate[,interleaving]
The parameter requires three primary arguments separated by commas, with an optional fourth argument for interleaving:
sample_format: Defines the data type, bit depth, and endianness of the audio samples. Common values include:u8: Unsigned 8-bit integers16_le: Signed 16-bit little-endian integer (standard CD quality)s24_le: Signed 24-bit little-endian integers32_le: Signed 32-bit little-endian integerf32_le: 32-bit little-endian floating-point
channels: An integer indicating the number of audio channels (e.g.,1for mono,2for stereo,6for 5.1 surround).sample_rate: The sampling frequency specified in Hertz (e.g.,44100,48000,96000).interleaving(Optional): Specifies whether sample channels are interleaved in memory. Acceptable values are:i: Interleaved (default for most hardware and standard formats)n: Non-interleaved
Application and Placement
The -f option affects the audio target that follows it
in the command sequence. If specified before an input (-i),
it defines the incoming stream format, which is required when reading
raw, headerless PCM files. If placed before an output (-o),
it sets the target encoding format for that specific destination.
Examples
To record a 16-bit, 44.1 kHz stereo stream from the default ALSA device and save it to a raw PCM file:
ecasound -f:s16_le,2,44100 -i alsa -o output.rawTo read a raw 32-bit float, 48 kHz mono file and convert it into a standard WAV file:
ecasound -f:f32_le,1,48000 -i raw_track.pcm -o converted.wav