Ecasound Sample Rate Conversion for Mixed Audio
This article explains how the Ecasound command-line audio processor
handles mismatched sample rates when importing and mixing audio tracks.
You will learn about Ecasound’s global engine format, how it utilizes
resampling libraries like libsamplerate, the default
behaviors when handling mixed files, and how to avoid playback speed and
pitch anomalies during multitrack processing.
The Global Processing Format
Ecasound processes audio using a unified internal format defined across an entire chainsetup. Unlike modern digital audio workstations that automatically resample every input to a project rate in the background without user intervention, Ecasound relies on an explicit engine processing format.
This format is set using the -f flag (e.g.,
-f:s16_le,2,44100 for 16-bit little-endian, 2-channel, 44.1
kHz audio). When an engine is launched, all active chains and processing
operations execute at this defined global sample rate.
Handling Mixed Sample Rates
When importing audio files with varying sample rates into a single session, Ecasound must reconcile the differences against the target engine rate:
- Automatic Resampling with
libsamplerate: If Ecasound is compiled withlibsamplerate(Secret Rabbit Code) support, it can automatically resample input files that deviate from the engine rate. High-quality algorithms are used to interpolate and convert the streams to match the processing rate without noticeable degradation. - Pitch and Speed Discrepancies: If Ecasound is compiled without resampling support or if dynamic resampling is bypassed, it reads the input samples directly at the engine's clock speed. For example, if a 48 kHz file is loaded into a 44.1 kHz chainsetup without conversion, the audio will play slightly slower and at a lower pitch.
- Explicit Resample Filters: Ecasound provides built-in audio objects and effect operators for format conversion. Users can explicitly insert resampling stages into individual chains to convert an input to the target engine rate before it reaches the mixdown bus or effect stages.
Best Practices for Mixing Different Formats
To ensure clean output when working with mixed sample rates in Ecasound:
- Establish the Master Rate: Determine the master
sample rate based on your hardware output or intended export target
using the
-foption. - Verify Engine Capabilities: Check your Ecasound
build configuration using
ecasound --versionto ensure that audio conversion libraries (libsamplerate) are enabled. - Pre-render When Necessary: For complex sessions involving numerous tracks with varying sample rates, pre-converting source files to a single, uniform sample rate using tools like SoX or Ecasound batch scripts minimizes CPU overhead and avoids real-time buffer underruns during live processing.