AetherCodec
Hi-Res Audio Wireless, Finally Lossless
The problem AetherCodec solves
AetherCodec
A hi-res audio codec built for wireless — because no standard Bluetooth
codec today can carry lossless sound.
The problem
Every codec that Bluetooth audio actually uses — SBC, AAC, aptX, even LDAC —
is lossy. That's not an oversight, it's physics: a true lossless 24-bit/96kHz
stereo stream needs roughly 2–3 Mbps, and Bluetooth Classic audio links top
out an order of magnitude below that. So no matter how expensive your
headphones are, if they connect over Bluetooth, the music reaching your ears
has already been compressed and had information thrown away — and there's no
standard, open way to change that. The few formats that get close (like LDAC)
are proprietary, license-gated, and still not bit-exact.
We wanted to know: what would it take to actually fix this?
What we built
AetherCodec is a from-scratch, dual-mode audio codec, written in pure C,
designed around one idea: separate the codec from the transport entirely,
so it isn't boxed in by what any one wireless link can carry.
- Near-Lossless (NL) mode — LPC prediction + Rice coding, bit-perfect,
sample-for-sample identical audio on decode. For when you want your music
exactly as it was recorded. - Perceptual HQ mode — MDCT + psychoacoustic masking, transparent
perceived quality at a fraction of the bitrate lossless needs, for links
that can't sustain full lossless bandwidth. - Adaptive bitrate engine — watches real link conditions (signal
strength, packet loss, buffer health) and steps the quality ladder down
before audio glitches, then climbs back up as headroom returns, so
degradation is a controlled, graceful choice instead of a silent dropout.
Because the codec core has zero dependency on any specific radio or OS audio
stack, it can run over whatever pipe is available — Bluetooth, Wi-Fi, or a
wired link — and automatically choose the mode that fits.
Where this is going
Our target isn't a Linux desktop tool — it's a wireless hi-res audio
standard for phones and headphones. Today's prototype runs on two Linux
laptops because that's the fastest way to prove the codec and the adaptive
engine actually work end-to-end on real hardware and a real wireless link.
The destination is a lightweight decoder that can live on a receiving device
(a custom hi-res receiver or headphone hardware) and a sender that runs on a
phone, so that anyone can get genuinely lossless — or knowingly, gracefully
compressed — audio over a wireless connection, without needing licensed
proprietary silicon to do it.
Why it's hard
Getting bit-perfect lossless right is unforgiving — the encoder and decoder
have to reproduce identical integer math over identical history, so there's
no room for approximation the way there is in lossy formats. Making the
adaptive engine responsive to real link behavior — not just signal
strength, but actual congestion and buffer pressure — took real tuning to
get a system that degrades smoothly instead of stuttering or overcorrecting.
And validating all of this required building and testing over multiple real
transport layers, from short-range Bluetooth to Wi-Fi, to prove the codec
behaves the same no matter what's carrying the bits.
Tech stack
Pure C codec core (LPC/Rice, MDCT + psychoacoustic model), custom framed
packet protocol, multi-transport support (RFCOMM, L2CAP, TCP/Wi-Fi), adaptive
bitrate control loop, PipeWire audio integration for the live demo pipeline.
Challenges we ran into
- Bluetooth Classic can't actually carry the audio. Measured NL-96k needs ~3.2 Mbps; RFCOMM realistically delivers ~200 kbps. This is why TCP-over-Wi-Fi transport (
--tcp) was added as the transport that actually makes NL/HQ usable, while RFCOMM/L2CAP remain for genuine short-range Bluetooth testing. - Bit-perfect losslessness is unforgiving. The NL path (LPC + Rice coding) requires encoder and decoder to run identical integer arithmetic over identical history — any drift (rounding, a Q15 mismatch,
wasted-bits handling) breaks losslessness rather than just degrading quality. Several documented "intentional divergences" from the spec (e.g.LPC_RICE_MAX_PARAM=30instead of the spec's 15, which overflowed the unary code on noisy signal) came directly from debugging this invariant. - The reference docs (PRD/HLD) had real errors, not just omissions — a non-existent magic-number hex value, a backwards ABR quality-ordering rule that would upgrade quality on link failure, an MDCT sketch that called non-existent FFTW functions, and a virtual-sink placement that contradicted itself between steps. Each had to be diagnosed and consciously overridden rather than followed.
- PipeWire's virtual-sink integration was fragile. Marking the sink
node.driver=trueseemed reasonable but silently stalled the whole graph (stream never leftstreamingstate). Buffer sizing also had to be pinned to one quantum — filling PipeWire'smaxsizeover-drained the ring buffer and caused underruns that looked like packet loss but weren't. - Adaptive bitrate tuning required chasing symptoms across the whole pipeline. A naive "optimistic start at NL-96k" flooded the queue and cascaded down to the worst rung in the first second of every real session; queue-based backpressure (not just RSSI) had to be added as a second congestion signal; and switching rungs without flushing the stale backlog made the new rung look congested too, creating a feedback loop.
- Encode/send coupling caused audio stutter. Blocking the capture/encode loop on
rfcomm_send_packetduring a slow link dropped captured audio. This forced decoupling encode from send via a bounded queue, sized by queued audio time rather than packet count (since NL and HQ frames differ ~4x in duration). - Real two-laptop testing is inherently harder to develop against. RSSI polling, RFCOMM negotiation, and real packet loss can't be fully exercised on one machine, so a
--loopbackmode had to be built just to validate the capture→encode→decode→playback pipeline in single-machine development.
Tracks Applied (1)
Open Innovation
Technologies used
