Ultra Audio (ua)
Technologies Used
Software Info
Standard OS audio APIs route through software mixers that introduce latency in the 20-100ms range. Ultra Audio bypasses this by interfacing directly with the lowest-level audio APIs each platform exposes.
On Windows, WASAPI Exclusive Mode is used for playback and WASAPI Loopback for capture. Loopback capture intercepts the final mixed audio stream at the render endpoint before it reaches the speakers, which means any application's audio can be forwarded without requiring the target app to expose a capture API. The captured PCM frames are fed directly into the Opus encoder configured for low-delay mode.
On Android, the AAudio C API (android/audio.h) is used with the AAUDIO_PERFORMANCE_MODE_LOW_LATENCY flag. AAudio operates on dedicated hardware audio threads and avoids the JVM entirely, keeping garbage collection pauses out of the audio pipeline.
For USB transport, a custom client-server socket architecture is layered over the ADB daemon. The Android process listens on TCP port 7890. The host issues adb forward tcp:7890 tcp:7890 which tunnels the connection through the ADB USB channel without any additional driver or network stack. The host then connects to localhost:7890 as a standard TCP client. This achieves sub-2ms transport latency over USB compared to 10-30ms over Wi-Fi UDP.
Clock synchronization uses a 4-timestamp exchange (T1 host send, T2 device receive, T3 device send, T4 host receive) to compute RTT and clock offset, matching the NTP algorithm. This offset is applied to incoming audio timestamps to correct for drift without pausing the audio pipeline.
Software Specifications
System Requirements
Supported Formats
Key Features
WASAPI Loopback capture on Windows bypassing the software mixer stack
AAudio native C API on Android with AAUDIO_PERFORMANCE_MODE_LOW_LATENCY
Real-time Opus compression with low-delay mode configuration
ADB-forwarded USB transport via custom TCP client-server over adb forward tcp:7890
UDP transport for local network streaming
NTP-style 4-timestamp RTT probe for sub-millisecond clock synchronization
Hardware-accelerated SDL2 + RmlUI interface
Bidirectional audio stream (playback + mic capture simultaneously)
Architectural Implementation
Native Audio Backend Abstraction
Audio backends are abstracted behind a common interface (AudioCapture, AudioPlayback). The Windows build links against WASAPI and uses IAudioClient in exclusive or loopback mode. The Android build uses the NDK AAudio headers. Swapping backends requires only a different compilation target, keeping the network transport and codec layers unchanged.
ADB USB Transport Layer
The Android process binds a standard TCP server socket on port 7890. The host issues adb forward tcp:7890 tcp:7890 prior to connecting, which routes the TCP stream through the Android Debug Bridge USB channel. No wireless adapter or router is required. The socket implementation uses raw BSD send/recv calls on both sides to avoid any buffering introduced by higher-level stream abstractions.
Clock Synchronization and Drift Correction
A background probe thread sends timestamp packets every 500ms. Each probe carries T1 (host send time). The device stamps T2 on receipt and T3 before replying. The host records T4 on reply arrival. RTT = (T4-T1) - (T3-T2). Clock offset = ((T2-T1) + (T3-T4)) / 2. This offset is applied to incoming audio packet timestamps to align the playback buffer without introducing audible discontinuities.
Outcomes
Bidirectional audio streaming operational on Windows-to-Android over USB and UDP
USB transport latency measured under 2ms end-to-end on test hardware
Opus compression maintaining audio fidelity at configurable bitrates without frame drops
Performance Benchmarks
USB transport RTT under 2ms on test hardware
WASAPI Exclusive Mode latency in the 2-5ms range on Windows
AAudio low-latency mode on Android (hardware-dependent, typically 4-10ms)
NTP-style clock sync drift correction within 1ms