How Ecasound -B Modifies Internal Buffering

The -B parameter in Ecasound controls the audio processing engine's internal buffering mode, determining how the application manages data flow between inputs, signal processing chains, and outputs. By selecting a specific buffering strategy, users can optimize Ecasound for high-throughput batch operations where latency does not matter, or minimize audio delay during live, real-time performance.

Overview of the Buffering Strategy

Ecasound processes audio in blocks of samples defined by the engine buffer size (often set using the -b option). The -B option dictates how aggressively Ecasound coordinates these sample blocks across its internal pipelines, threads, and hardware device interfaces. It determines queue depths, whether buffering favors high-speed processing or drop-free real-time delivery, and how the system responds to timing constraints imposed by audio hardware.

Available -B Modes

The -B option accepts several modes that directly reshape the internal buffer pipeline:

Internal Effects on Engine Mechanics

When -B is modified, Ecasound alters several specific mechanics inside its processing core:

  1. Queue Sizing: In nonrt mode, internal ring buffers and device queues are allocated with generous margins to absorb disk read/write bursts. In rt and rtlowlatency, these queues are clamped to strictly constrained depths to prevent old audio data from accumulating.
  2. Thread Scheduling and Execution: In real-time modes, the processing engine waits for device synchronization triggers before advancing sample blocks, aligning audio processing cycles directly with hardware interrupts. In non-realtime modes, the engine loops continuously without yielding to an external clock.
  3. Error Handling and Overruns: Real-time modes track and report xruns when the engine fails to deliver a block within the hardware deadline. In non-realtime mode, the concept of an underrun is suspended, as the engine simply pauses until the next block is read from disk.