bluetooth-codec-latency
v0.1.1
Published
Estimate audio latency introduced by common Bluetooth codecs (SBC, AAC, aptX, aptX LL, LDAC, LC3).
Maintainers
Readme
bluetooth-codec-latency
Reference table of typical end-to-end audio latency for the common Bluetooth Classic audio codecs, so you can pick the codec that matches the use case instead of assuming they are interchangeable.
The numbers
| Codec | Typical latency | Range | |-----------|-----------------|--------------| | SBC | 150 ms | 100 – 250 ms | | AAC | 120 ms | 90 – 200 ms | | aptX | 70 ms | 50 – 100 ms | | aptX LL | 40 ms | 30 – 60 ms | | aptX HD | 100 ms | 80 – 150 ms | | LDAC | 200 ms | 150 – 300 ms | | LC3 | 40 ms | 20 – 60 ms |
Sources: the Bluetooth SIG's LE Audio LC3 whitepaper, Qualcomm's public codec documentation, and repeated field measurements against a wired reference. Real end-to-end latency also includes the sink's own buffer and the OS's audio pipeline — treat these as the codec's floor.
Usage
const { latencyFor, bestForVideo } = require('bluetooth-codec-latency');
latencyFor('LC3');
// { codec: 'LC3', algorithmicMs: 40, minMs: 20, maxMs: 60, bitrate: 345 }
bestForVideo();
// [ 'aptX_LL', 'LC3', 'aptX', 'aptX_HD', 'AAC', 'SBC', 'LDAC' ]Why the range
Codec algorithmic latency is fixed by the algorithm. Buffering latency is not — the same codec at 40 ms in a benchmark can measure 180 ms on a bad connection, because the sink increased its buffer to hide packet loss. For the practical guidance we wrote up while comparing earbud models in our stock, see the CairoVolt post on Bluetooth latency for video.
License
MIT.
