⚙️ ENGINEER LEVEL: Bluetooth Protocol Deep Dive
Bluetooth Audio Stack
Protocol layers:
Application Layer (Music Player App)
↓
A2DP Profile Layer (streaming control)
↓
AVDTP (Audio/Video Distribution Transport Protocol)
↓
L2CAP (Logical Link Control and Adaptation Protocol)
↓
HCI (Host Controller Interface)
↓
Baseband and RF Layer (physical radio)
Audio encoding path:
- App generates PCM audio (44.1 kHz, 16-bit, stereo)
- Codec encodes PCM to compressed stream (SBC, AAC, aptX)
- AVDTP packetizes stream
- L2CAP routes packet
- RF transmits
- Head unit RF receives
- L2CAP reassembles
- AVDTP extracts audio packet
- Codec decodes to PCM
- Head unit DAC converts to analog
Latency sources:
| Stage | Typical Latency |
|---|---|
| Codec encode/decode | 5–40 ms (codec dependent) |
| Bluetooth transmission | 5–10 ms |
| Buffers and protocol overhead | 20–100 ms |
| DAC and output stage | 1–5 ms |
| Total | 30–150 ms |
Why latency matters in car audio:
For music listening: Not perceptible (brain accepts delays up to ~80 ms as "normal") For navigation: 30-80 ms delay after turn — acceptable For video sync: Can cause lip-sync issues if display and audio have different paths
SBC Codec Deep Dive
SBC (Subband Coding) encoding:
- Analysis filterbank: Divide signal into 4 or 8 subbands using polyphase filter
- Bit allocation: Allocate bits per subband using bit pool (8–75 bits per subband typical)
- Quantization: Quantize each subband with allocated bits
- Frame assembly: Pack into Bluetooth packet
Bit pool and quality:
Bitrate (kbps) ≈ (Bitpool × 2 × 8 × f_s) / (Samples_per_frame × 1000)
Where fs = sample rate, Samplesper_frame = 128 for 8 subbands.
Maximum standard bitpool: 53 (joint stereo) → ~345 kbps at 44.1 kHz
High-quality SBC (if both devices agree): Bitpool up to 75 → ~512 kbps
Most consumer devices negotiate lower bitpool. Audiophile tweaks like "SBC Dual Channel" mode at maximum bitpool get near-aptX quality.
SBC spectral distortion:
Subband coding causes ringing artifacts at subband boundaries. These are most audible in transient-rich material (percussion, plucked strings) and at subband center frequencies.
Perceptual masking:
SBC relies on the masking effect — loud frequencies mask nearby quieter ones. Bits are allocated where they're audible. When masking model fails (complex signal, wide dynamic range), artifacts become audible as metallic shimmer or phasiness.
aptX improvement:
aptX uses ADPCM (Adaptive Differential Pulse Code Modulation) per subband with 4 bits per sample. Different approach than SBC — less susceptible to masking model errors. Generally sounds cleaner on complex material.