Ecasound Audio Synchronization Across Multiple Files

Ecasound synchronizes audio playback across disparate physical files of varying lengths by utilizing a centralized, real-time audio processing engine governed by a unified master transport clock. Regardless of differing durations, sample rates, or formats, each file is assigned to an independent processing chain that moves in lockstep with the engine's global timeline. By managing transport states, automatic silence padding for shorter files, sample rate normalization, and precise position offsets, Ecasound ensures sample-accurate, drift-free playback across all configured inputs simultaneously.

The Master Transport and Global Engine Clock

At the core of Ecasound's synchronization is its central engine loop, which processes audio in discrete, uniform buffer blocks (governed by the system buffer size and sampling rate). When playback begins, Ecasound increments a single, authoritative transport position. Every active input stream advances by the exact same number of audio samples per engine cycle. Because playback progress is dictated by this central timeline rather than the internal properties of the individual files, time drift between disparate files is structurally eliminated.

Multitrack Processing via Chains

Ecasound achieves multitrack playback by abstracting audio paths into "chains." Each disparate physical file is assigned as an input to a distinct chain (-a:chain_name -i:filename.wav).

While each chain can host unique signal processing effects, volume envelopes, and routing assignments, they are all bound to the same engine instance. During every audio processing cycle, Ecasound reads a frame buffer from each chain's input, processes them in parallel, and mixes or routes them to the designated outputs without temporal divergence.

Managing Disparate Track Lengths

Files of varying durations naturally terminate at different times. Ecasound controls this behavior using specific transport and chain configurations:

Positioning and Time Offsets

When disparate audio files must start at different chronological points along the master timeline, Ecasound employs audio offset and delay operators. Through options like -y:seconds, playback of a specific file can be deferred until the master transport reaches a defined timestamp. Ecasound buffers or silences that specific chain until the engine time matches the offset, allowing asynchronous recordings to align to a specific bar, beat, or reference cue.

Sample Rate Normalization

If the physical files possess different native sampling rates (e.g., one at 44.1 kHz and another at 48 kHz), playing them simultaneously would cause pitch shifts and temporal drift. Ecasound leverages internal audio resampling to convert all incoming streams to the engine's master sample rate in real time. This ensures that every file outputs the exact same number of samples per unit of real-world time, preserving synchronicity across the entire arrangement.