Expand description
Audio companding: the non-linear µ-law and “A”-law compression curves used by the ITU-T G.711 telephony standard to compress a wide-dynamic-range linear audio sample down to a lower bit depth with minimal perceptual loss (Steven W. Smith, “The Scientist and Engineer’s Guide to DSP”, Ch. 22, Eq. 22-1 / 22-2).
All functions operate on samples normalized to -1.0..=1.0.
Functions§
- a_
law_ compress_ f32 - Compresses a normalized linear sample
x(-1.0..=1.0) using “A”-law companding (Eq. 22-2): a linear segment near zero, transitioning to a logarithmic curve. - a_
law_ expand_ f32 - Expands an “A”-law-compressed sample
y(-1.0..=1.0) back to a normalized linear sample, invertinga_law_compress_f32. - mu_
law_ compress_ f32 - Compresses a normalized linear sample
x(-1.0..=1.0) using µ255-law companding (Eq. 22-1), expanding resolution for small amplitudes at the expense of large ones. - mu_
law_ expand_ f32 - Expands a µ-law-compressed sample
y(-1.0..=1.0) back to a normalized linear sample, invertingmu_law_compress_f32.