Ecasound Flag for Immediate Audio Processing

This article explains how to configure Ecasound for immediate audio processing without initial pre-buffering delays. It identifies the primary command-line flag responsible for altering buffer behavior, explains the underlying mechanics of Ecasound's buffering modes, and provides practical syntax examples for low-latency, real-time audio workflows.

The Immediate Processing Flag: -B:realtime

In Ecasound, the flag that forces immediate audio processing without pre-buffering is -B:realtime.

By default, Ecasound operates under -B:auto, where it analyzes the signal chain and often fills internal audio buffers prior to playback or recording to avoid dropouts (buffer underruns). Setting the buffering mode explicitly to realtime forces Ecasound to bypass this pre-buffering phase and begin streaming audio through the processing engine immediately.

How Buffering Modes Work in Ecasound

The -B option controls the overall buffering policy of the Ecasound engine. It accepts three main parameters:

  • -B:auto (Default): Automatically selects the buffering strategy based on the inputs and outputs. When working with static files or complex routing, it pre-buffers frames before starting the transport.
  • -B:nonrealtime: Maximizes throughput by using large buffers and aggressive pre-buffering. This mode is intended for offline rendering, batch conversions, or non-interactive processing where latency is irrelevant.
  • -B:realtime: Disables pre-buffering and switches the engine to minimal-latency operation. Audio streams directly between endpoints with zero pre-fill delay.

Command-Line Usage and Syntax

To run an Ecasound session with immediate processing enabled, supply the flag at the start of your command:

ecasound -B:realtime -i:alsahw,0,0 -o:alsahw,0,0

In this setup:

  • -B:realtime disables pre-buffering and forces real-time execution.
  • -i:alsahw,0,0 captures audio directly from the specified hardware input.
  • -o:alsahw,0,0 outputs audio directly to the hardware output with immediate start.

Optimizing Latency with -b

While -B:realtime ensures processing begins without waiting to fill a pre-buffer queue, total round-trip latency is governed by the engine buffer size set by the -b flag:

ecasound -B:realtime -b:128 -i:jack -o:jack

Using a small buffer size (such as -b:128 or -b:256 frames) alongside -B:realtime ensures both an immediate start and minimal delay between input and output. Note that running without pre-buffering at very low buffer sizes requires adequate CPU performance and real-time system privileges (such as using the -r priority flag) to prevent buffer underruns (xruns).