audio

@audio/filter-spectral-tilt1.3.0

Spectral tilt filter

Spectral tilt filter: apply a constant dB/octave slope to the spectrum

Status
calibrated
Updated
Family
filter, 16 packages under it
Plugin
spectral-tilt, effect, streaming, 1 parameter
Category
effects
Licence
MIT
Dependencies
none
Downloads
2,360 last month
Tests
at least 129 in audiojs/filter's CI, passed at 878f618,

Parameters

  • effect
  • streaming
  • tail
slope
0 dB/oct
−6 to 6 dB/oct
import spectralTilt from '@audio/filter-spectral-tilt'

Applies a constant dB/octave slope — tilts the entire spectrum.

Model: cascade of 8 octave-spaced first-order shelving sections approximating a fractional power-law spectrum S(f)∝fαS(f) \propto f^\alpha; positive slope boosts highs, negative slope cuts them
slope: α=−3 dB/oct\alpha = -3\,\text{dB/oct} gives pink noise character; −6 dB/oct-6\,\text{dB/oct} gives brownian/red noise
Accuracy: measured slope tracks the requested dB/oct to within ~20% (inherent to the 8-stage shelving cascade) — e.g. slope: +3 measures ≈+2.4 dB/oct, slope: -6 measures ≈-4.9 dB/oct

spectralTilt(buffer, { slope: -3, fs: 44100 })   // −3 dB/oct: pink noise character
spectralTilt(buffer, { slope: +3, fs: 44100 })   // +3 dB/oct: pre-emphasis for coding
Param Default
slope 0 dB/octave; 0 is a no-op (returns data unmodified)
fs 44100 sample rate, Hz

Pass the same params object on every call to persist the 8-section cascade state across blocks.

In the /audio processor slope moves no pole: it sets the gain each stage gives above its corner, 10^(slope/20), and that gain 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. At slope 0 the input passes as it is while each stage's one-pole follows it, so a slope moving off 0 starts from the states the cascade has there.

Use when: matching microphone/speaker frequency responses, spectral coloring, noise synthesis.


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

MIT © audiojs