Ecasound Global Audio Channels Flag Guide

In Ecasound, global audio format parameters—including the number of audio channels—are controlled using the -f flag. This article explains how the -f flag works, its exact syntax for defining global channels, and practical command-line examples to configure multi-channel or stereo audio processing effectively.

The Global Channel Flag: -f

Ecasound does not have a standalone, single-purpose flag dedicated exclusively to channel counts. Instead, channel configuration is handled globally via the general audio format specifier:

-f:sample_format,channels,sample_rate,interleaving

When placed before input (-i) and output (-o) definitions in an Ecasound command, the -f flag sets the default format across the entire chainsetup. The second parameter within this flag directly controls the number of audio channels.

Parameter Breakdown

  • sample_format: The sample encoding format (e.g., s16_le, s24_le, s32_le, f32_le).
  • channels: An integer indicating the number of audio channels (e.g., 1 for mono, 2 for stereo, 6 for 5.1 surround).
  • sample_rate: The sampling frequency in Hz (e.g., 44100, 48000).
  • interleaving: Optional layout format, such as i (interleaved) or n (non-interleaved).

Usage Examples

Setting Global Stereo (2 Channels)

To process audio globally as 16-bit little-endian stereo at 44.1 kHz:

ecasound -f:s16_le,2,44100 -i:input.wav -o:output.wav

Setting Multi-Channel Audio (4 or More Channels)

To configure a 4-channel audio processing session at 48 kHz using 32-bit floating-point samples:

ecasound -f:f32_le,4,48000 -i:multitrack.wav -o:alsa

Omitting Unchanged Values

If you only need to enforce certain parameters while letting others use default values, you can leave fields empty between the colons:

ecasound -f:,2, -i:somefile.raw -o:alsa

This instructs Ecasound to specifically enforce 2 channels while preserving default or auto-detected sample format and sample rate values.

Channel Routing and Processing

Setting the channel count with -f determines the channel width for subsequent inputs, outputs, and internal processing chains. If you need to manipulate individual channels within that global layout, Ecasound provides specific chain operators:

  • -chcopy:from_channel,to_channel: Copies audio from one channel to another.
  • -chmove:from_channel,to_channel: Moves audio routing between channels.
  • -chorder:ch1,ch2,...: Reorders the channels within a chain.

By setting the channel number through the -f flag at the start of your command, Ecasound establishes the channel architecture for all audio streams processed in the session.