Skip to content
All projects

Phone-Server: Real-Time Full-Duplex Voice Router & Jitter Buffer

A low-latency raw PCM audio streaming engine built on Tokio and Tungstenite. Features server-side echo mitigation and a client-side Jitter Buffer.

Performance & metrics

  • Unbounded MPSC channels prevent lock contention and dropped packets in the critical audio threads
  • The Jitter Buffer actively absorbs network underruns, stopping audio stutter during latency spikes
  • Multi-stage Docker builds with --no-default-features keep heavy C/C++ audio libs (libasound2) out of the Debian runtime, heavily shrinking the image size

Why I built it

Standard protocols like WebRTC are often overkill for simple audio streaming. I built this to have a lightweight, memory-safe Rust setup that strictly transmits raw PCM audio (f32 LE bytes) over WebSockets. The goal was to eliminate feedback loops (echo) by filtering source addresses at the routing layer and to manually sync hardware sample-rate disparities right on the client.

Architecture & decisions

The core bridges CPAL's synchronous hardware threads with Tokio's asynchronous network I/O. The client downmixes stereo microphone input to mono to save bandwidth, then pipes the bytes to the async WebSocket writer via unbounded MPSC channels. On the playback side, a Mutex-wrapped VecDeque acts as a Jitter Buffer (triggering at 1000 samples) to smooth out network spikes. The server just uses a tokio::sync::broadcast channel mapped with (SocketAddr, Message) tuples, broadcasting packets to everyone except the original sender to prevent echo.

Key features

  • Low-latency audio capture and playback using CPAL
  • VecDeque-based concurrent Jitter Buffer to handle network instability
  • Server-side echo suppression using SocketAddr packet mapping
  • Cargo feature flags to drop hardware audio dependencies (like ALSA/PulseAudio) from the server build
  • On-the-fly Mono/Stereo downmixing and upmixing to keep bandwidth usage low

Technical review

This project highlights how to cleanly manage the boundary between synchronous hardware interrupts and async event loops. Forcing in_config.sample_rate = out_config.sample_rate; on the client is a straightforward, low-level fix for hardware clock mismatches. Also, hiding the cpal dependency behind a Cargo feature flag keeps the server binary very lean, cutting down the Docker footprint and reducing the attack surface in production.

Networking & Protocols

Actix-Web Overlay Network Proxy Orchestrator

A high-performance, asynchronous WebSocket signaling and orchestration API built to securely manage and route distributed proxy nodes across Tor and Lokinet overlay networks.

  • Rust
  • Actix-Web
  • Tokio
  • +4

Networking & Protocols

Private

Major project

Watch Together Server: Cross-Household Synced Playback with Rust, Axum and Steam Lobbies

A Rust server that lets people in different homes watch the same video at the same moment. Inside a home, the TV, the desktop app and the game join the same WebSocket room; homes connect to each other through a Steam lobby, without opening ports. Heavy work such as resolving, subtitles and remuxing happens on the server instead of the TV.

  • Rust
  • Axum
  • Tokio
  • +5

Networking & Protocols

Private

Major project

Cyberia & Wired Protocol

A secure, decentralized operating system and network layer built on Wired — a custom, high-performance communication protocol. Instead of HTTP, it uses a mutually encrypted TCP handshake and AES-encrypted WebSocket payloads for strong data confidentiality.

  • Rust
  • C++
  • Tauri
  • +6

Need something similar?

I can build a system like this for you, too.

Describe your project in a few sentences, and we'll work out the right approach and an estimated scope together.