How Multiout Solves Audio Clock Drift
Why routing audio to two soundcards is physically difficult, and how our closed-loop PI resampler and per-device delay lines achieve glitch-free synchronization.
Multiout Audio Routing & Clock Drift Architecture
How Multiout routes one stream across unsynchronized DAC crystal clocks without buffer underrun crackles or latency lag.
01The Physics of Hardware Clock Drift
Every audio device plugged into your computer—whether a 3.5 mm motherboard DAC, a USB gaming headset, or a Bluetooth transmitter—relies on an independent physical quartz crystal oscillator to clock its Digital-to-Analog Converter (DAC).
Even when both devices are configured at a standard sample rate of 48,000 Hz, temperature variations, manufacturing tolerances, and voltage fluctuations ensure that neither runs at precisely 48,000.000 Hz. One device might consume samples at 48,001.2 Hz while the second consumes at 47,998.7 Hz.
02Closed-Loop Proportional-Integral (PI) Resampling
Multiout treats clock synchronization as a real-time feedback control system. Rather than crudely dropping or duplicating audio frames, Multiout tracks the fill level of each output device's ring buffer:
- Exponential Moving Average (EMA) Low-Pass Filter: Filters out high-frequency jitter caused by thread scheduling and operating system buffer dispatch cycles, deriving the true long-term buffer trend.
- Proportional-Integral (PI) Controller: Computes the error between the target buffer midpoint and the filtered fill level. The proportional term reacts to sudden drift, while the integral term cancels steady-state frequency errors.
- Fractional Linear Resampler: Continuously modulates the resampling ratio within a narrow window of ±5000 ppm (±0.5%). Because the speed adjustment is micro-scale, it is completely imperceptible to the human ear with zero pitch warble.
03Per-Device Delay Alignment for Bluetooth Lag
Clock drift is only half the battle. If you connect one wired earphone via a 3.5 mm jack and one wireless earbud via Bluetooth, you will immediately notice an annoying room echo.
This happens because Bluetooth audio codecs (such as SBC, AAC, or LDAC) require packetization, radio transmission, and receiver decompression, introducing 80 ms to 200 ms of latency. The analog jack, by contrast, has virtually zero latency (sub-5 ms).
Multiout incorporates a dedicated 0 to 300 ms millisecond delay line for each output channel. By adding a 120 ms buffer to the low-latency wired output, both listeners hear explosions, dialogue, and beats at the exact same millisecond.
04Zero-Allocation Real-Time Audio Architecture
Many audio utilities written in high-level managed languages suffer from micro-stutter when the runtime garbage collector triggers a heap sweep.
Multiout is engineered in Go and miniaudio with a strict zero-allocation real-time design pattern:
Experience Clock-Synchronized Audio
Download Multiout today for Windows and Linux. Plug in your headphones and enjoy perfect sync.
Go backend and systems developer. Passionate about real-time audio synchronization and lightweight software.