Fushi

All projects

DualSpeakers

A Windows program that plays the same audio on two speakers, aligned so closely that they sound like one source.

Type:
Personal project
Status:
In progress
Year:
2026

The problem

Two output devices drift apart (1 ppm of clock difference adds 3.6 ms per hour) and have different internal latency. The result is a comb-filter effect that sounds like a doubled voice. The program measures the offset and removes it.

What I built

  • A C++ audio engine that captures system audio and plays it on an analog output and a USB soundbar through WASAPI.
  • Offset measurement with GCC-PHAT correlation and clock drift correction with resampling.
  • No allocation, locks or logging on the audio thread. A test replaces the global allocator and asserts zero allocations.

Stack

  • C++
  • CMake
  • WASAPI
  • libsamplerate
  • Python
  • PowerShell

Results

  • Median offset between the speakers at the listening position: -0.021 ms, with a spread of 0.203 ms over five runs (target 0.3 ms). Measured with a microphone.
  • The USB soundbar plays 9.600 ms after the analog output, with a spread of 0.095 ms over three runs.
  • Crystal drift of +0.002 ppm over 2,562 measurements. I checked the method by injecting +50 ppm and reading back +51.03.
  • Exclusive mode at 144 frames (3 ms) cuts the device buffer from 1056 frames (22 ms).
  • A 30-minute soak test passed with zero overruns and zero refused frames.
  • These figures come from the project README, and I measured them on my own hardware. The project works but is not finished. It has no settings file yet, its control window cannot select devices, and it has no installer.