Ecasound Dynamic Sample Rate Conversion and Anti-Aliasing

This article explains how the Ecasound digital audio processing utility performs dynamic sample rate conversion while preserving signal fidelity and preventing aliasing artifacts. It details the underlying mathematical principles, the filtering mechanisms used during upsampling and downsampling, and how the software manages time-varying resampling ratios cleanly across continuous real-time audio streams.

Dynamic sample rate conversion (SRC) in Ecasound occurs whenever an input stream, an internal processing chain, and an output device operate at disparate or fluctuating sampling frequencies. Without proper handling, mapping discrete samples across different sampling grids produces mirror frequencies that fold back into the audible spectrum, creating severe harmonic distortion known as aliasing.

To eliminate aliasing, Ecasound integrates band-limited sinc interpolation algorithms, predominantly utilizing high-performance external libraries such as Secret Rabbit Code (libsamplerate). Rather than applying basic linear or polynomial interpolation—which introduce audible phase distortion and high-frequency roll-off—the engine relies on normalized sinc function kernels that accurately reconstruct continuous-time band-limited waveforms between discrete time points.

The core anti-aliasing mechanism depends on the direction of conversion:

Dynamic conversion requires handling changing frequency ratios on the fly, such as during variable-speed playback, real-time pitch-shifting, or clock drift compensation between independent audio interfaces. Ecasound manages dynamic ratio changes by tracking fractional sample positions using sub-sample phase accumulators. Instead of recalculating heavy filter coefficients for every slight fluctuation, the sinc kernel is stored as a polyphase filter table.

As the ratio changes, the engine interpolates between adjacent pre-computed filter phases. This enables seamless, continuous-time tracking across buffer boundaries without causing sample drops, phase cancellations, or zipper noise. The filter's cutoff frequency dynamically scales with the ratio to ensure that the cutoff threshold always corresponds to the minimum of either the input or output Nyquist limit.

Through this combination of polyphase sinc interpolation, rigorous linear-phase FIR filtering, and continuous phase tracking, Ecasound achieves high dynamic range and noise suppression well below the threshold of human hearing, maintaining clean audio signals across dynamic sample rate shifts.