Skip to main content
PickTensorSoftware & AI Studio
Back to All WorkBackend & Systems
LiveSystems & Audio EngineeringBackend Systems

AirStream Pro

Ultra-low latency PC-to-phone and AirPods audio streaming over local Wi-Fi with zero mobile app required.

Role: Creator & Sole Engineer
Team: 1 Engineer
Areas:Real-Time StreamingDesktop Software
10–25ms
WebRTC Latency
UDP + Opus over Wi-Fi
20–40ms
WebSocket Latency
Adaptive TCP PCM fallback
10ms / 48kHz
Audio Frame Size
Hardware WASAPI callback
AirStream Pro desktop audio waveform and mobile AirPods receiver showcase
PC audio capture server streaming to mobile browser receiver over local Wi-Fi.

Overview

A real-time audio capture and streaming engine built with FastAPI, WebRTC (aiortc), and native Windows WASAPI loopback that streams 48 kHz stereo desktop audio straight to mobile Safari or Chrome in 10ms–40ms.

API Capabilities & Integrations

Capabilities

  • WebRTC SDP signaling endpoint with low-latency Opus parameters
  • Real-time WebSocket binary PCM audio streaming with adaptive jitter cushion
  • Dynamic audio input/loopback device switching from the mobile client
  • QR code local network discovery and 60 FPS spectrum telemetry

Integrations

  • Windows WASAPI Loopback
  • VB-Audio Virtual Cable & Stereo Mix
  • iOS MediaSession Lock-Screen Audio

Protocol & Backend Architecture

PortAudio C callbacks capture 10ms stereo frames at 48 kHz (with live resampling for 96 kHz hardware devices), dispatching concurrently into an aiortc WebRTC media track (SDP configured with minptime=10 and cbr=1) and a WebSocket PCM fallback endpoint. The browser receiver bypasses HTMLMediaElement buffering by routing WebRTC audio directly into an AudioContext configured with latencyHint: 0 while keeping a muted media tag for iOS lock-screen MediaSession continuity.

Bottleneck & Requirement

Desktop PCs without Bluetooth—or with basic USB dongles—often suffer 150ms–250ms audio-video desync, while existing mobile audio-relay tools require installing dedicated mobile apps, fighting iOS background lock-screen limits, or paying for subscriptions.

System Design

Built a lightweight Windows tray server that captures system audio directly from the WASAPI loopback endpoint in 10ms hardware frames and streams it over WebRTC (UDP + Opus) or adaptive WebSocket PCM to a zero-install mobile web receiver with instant QR code pairing.

System & API Capabilities

  • 10ms–25ms WebRTC UDP + Opus streaming and 20ms–40ms WebSocket fallback
  • Zero mobile app installation—works directly in Safari and Chrome
  • Instant QR code pairing from the Windows system tray dashboard
  • iOS lock-screen and background playback support for AirPods
  • Real-time 60 FPS frequency visualizer, VU meter, and 200% pre-amp boost
  • Standalone Windows .exe packaging via PyInstaller

Implementation Details

Optimized the pipeline from v1.0.0 (>200ms browser NetEQ buffering) down to 10ms–25ms on WebRTC by setting receiver.playoutDelayHint = 0 and receiver.jitterBufferTarget = 0, and added a 12ms target cushion with 35ms drift snap-back on the TCP WebSocket path.

Latency & Reliability Challenges

  • Bypassing mobile Safari and Chrome default 150ms–200ms NetEQ and <audio> element pipeline buffers
  • Handling 96 kHz Windows hardware mixer endpoints cleanly without sample-rate drift or crackling
  • Keeping WebRTC audio alive when an iPhone screen locks without an active native app

Operational Outcomes

  • Reduced WebRTC playback latency from >200ms in v1.0.0 down to 10ms–25ms in v1.1.0
  • Reduced WebSocket PCM playback latency from ~100ms down to 20ms–40ms
  • Published open-source v1.1.0 release with standalone Windows executable

Technical Stack

Languages

PythonJavaScriptHTML5

Frameworks

FastAPIUvicornWeb Audio API

Libraries

aiortcPyAudioWPatchPyStrayPillowCanvas 2D

Infrastructure

WebRTC (UDP/Opus)WebSockets (TCP PCM)WASAPI LoopbackPyInstaller

Technologies

PythonFastAPIWebRTCWebSocketsWASAPIWeb Audio API

Latency Optimization Breakdown (v1.0.0 -> v1.1.0)

Key systems changes made to eliminate hidden browser media buffers and Windows driver overhead:

  • 10ms hardware PCM capture chunks (480 samples @ 48 kHz) replacing 20ms buffers.
  • Programmatic receiver.playoutDelayHint = 0 and jitterBufferTarget = 0.
  • Direct Web Audio API AudioContext playout instead of buffered HTML5 <audio> playback.
  • Native WASAPI loopback capture eliminating external virtual audio driver hops.
Tags:#WebRTC#FastAPI#Audio Engineering#Low Latency#Python#Open Source

Need similar engineering architecture for your product?

Discuss your goals directly with Danish Saifi at PickTensor.

Start a Discussion