How Ecasound Reports XRUNs in Live Audio Capture

This article explains how Ecasound detects and reports buffer underrun and overrun (xrun) events during live audio hardware capture. It details the mechanisms through which Ecasound registers timing failures, the distinction between ALSA and JACK reporting, the role of debug verbosity flags, and how to track these events interactively using the Ecasound Control Interface (ECI).

Understanding XRUNs in Capture Mode

During live hardware capture, an xrun is almost exclusively a buffer overrun (overflow). This occurs when the hardware audio interface fills its ring buffer with incoming sample data faster than Ecasound can read and process it, resulting in dropped samples and audible clicks or gaps in the recording.

Console and Terminal Notifications

By default, Ecasound prints system state changes and critical stream warnings to standard error (stderr). When an xrun occurs during processing:

Increasing Output Detail with Debug Flags

Default logging provides minimal notification to avoid causing additional I/O latency. To see precise information about xrun events, Ecasound provides the -d flag, which controls debug levels:

Running a capture session with elevated debugging reveals the exact point where the read pointer fell behind the write pointer.

ALSA Direct Capture Reporting

When capturing directly from ALSA hardware (e.g., -i:alsa,default or -i:alsa,hw:0), Ecasound manages the ALSA buffer pointers directly:

JACK Subsystem Reporting

When using the JACK Audio Connection Kit as the input engine (-i:jack), responsibility for xrun detection shifts to the JACK server daemon (jackd):

Programmatic Reporting via ECI

For headless operation or custom recording software, Ecasound reports engine health through the Ecasound Control Interface (ECI). Using interactive commands: