audio

@audio/filter-preemphasis1.2.0

Pre-emphasis / de-emphasis filter

Status
calibrated
Updated
Family
filter, 16 packages under it
Category
effects
Licence
MIT
Dependencies
none
Downloads
2,334 last month
Tests
at least 129 in audiojs/filter's CI, passed at 878f618,

Listen

// "Local Forecast" by Kevin MacLeod (incompetech.com), CC BY 4.0, incompetech.com/music/royalty-free/faq.html
audio('/samples/music/modern/local-forecast.mp3').emphasis()

// "Local Forecast" by Kevin MacLeod (incompetech.com), CC BY 4.0, incompetech.com/music/royalty-free/faq.html

Plugins

deemphasis

  • effect
  • streaming
  • tail
alpha
0.97
0.5 to 0.99

emphasis

  • effect
  • streaming
alpha
0.97
0.5 to 0.99
import { emphasis, deemphasis } from '@audio/filter-preemphasis'

First-order highpass (emphasis) and its inverse (de-emphasis) — used before and after coding or transmission.

H(z)=1−αz−1H(z) = 1 - \alpha z^{-1} (emphasis)  /  H(z)=11−αz−1H(z) = \dfrac{1}{1 - \alpha z^{-1}} (de-emphasis)

Rolloff: emphasis boosts above fc=(1−α)fs2πf_c = \frac{(1-\alpha) f_s}{2\pi} — α=0.97\alpha = 0.97 gives ~210 Hz at 44.1 kHz
Inverse pair: deemphasis exactly cancels emphasis — He(z)⋅Hd(z)=1H_e(z) \cdot H_d(z) = 1 (round-trip error ~5.5e-17)

emphasis(buffer, { alpha: 0.97 })    // before encoding
deemphasis(buffer, { alpha: 0.97 })  // after decoding — exact inverse
Function Param Default
emphasis alpha 0.97 GSM/AMR speech coding convention
deemphasis alpha 0.97 must match the emphasis call it inverts

Pass the same params object on every call to persist the one-pole state across blocks.

In the /audio processors alpha is smoothed (20 ms) and glided sample by sample: a host's ramp of it is one line, the same however the host cuts its calls (it hands each call the value at its first frame, so the line is played 32 frames late); held, it is the value itself.

Use when: speech coding (GSM, AMR uses α=0.97\alpha = 0.97), tape recording, FM broadcasting.


Part of @audio/filter — the filter family umbrella. This README is generated from the umbrella docs.

MIT © audiojs