FLAC
Free Lossless Audio Codec
An open-source audio codec that compresses audio without any loss in quality, reducing file sizes by 50-70%.
Technical Detail
Audio flac algorithms exploit psychoacoustic masking — louder sounds make nearby quieter frequencies inaudible. MP3 (MPEG-1 Layer 3) uses the Modified Discrete Cosine Transform (MDCT) and was revolutionary in 1993. AAC improves on MP3 with better spectral resolution and support for more channels. Opus (RFC 6716) combines speech (SILK) and audio (CELT) codecs and is optimal for VoIP, streaming, and interactive applications with latency requirements under 20ms.
Example
```javascript
// FLAC: Web Audio API example
const audioCtx = new AudioContext();
const response = await fetch('audio.mp3');
const buffer = await audioCtx.decodeAudioData(await response.arrayBuffer());
const source = audioCtx.createBufferSource();
source.buffer = buffer;
source.connect(audioCtx.destination);
source.start();
```