@audio/denoise 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +365 -91
  2. package/index.d.ts +1 -1
  3. package/package.json +17 -17
package/README.md CHANGED
@@ -8,20 +8,20 @@ Single-pass noise reduction. 13 specialised methods + an auto-classifier.
8
8
  |---|---|---|---|---|---|
9
9
  | [denoise](#denoise) | meta | auto | — | varies | "just clean it" |
10
10
  | [gate](#gate) | time | silence | ★ | very low | hard cut at threshold |
11
- | [dehum](#dehum) | time | mains hum | ★★★★ | very low | 50/60 Hz + harmonics |
11
+ | [dehum](#dehum) | time | mains hum | ★★★★ | low | 50/60 Hz + harmonics |
12
12
  | [specsub](#specsub) | freq | broadband stationary | ★★ | medium | baseline |
13
13
  | [wiener](#wiener) | freq | broadband stationary | ★★★ | medium | general broadband |
14
14
  | [omlsa](#omlsa) | freq | broadband non-stationary | ★★★★ | high | speech in changing noise |
15
15
  | [declick](#declick) | time | impulses | ★★★★ | medium | vinyl ticks, edit clicks, mouth clicks |
16
16
  | [decrackle](#decrackle) | time | dense impulses | ★★★ | medium | shellac crackle |
17
- | [declip](#declip) | time | hard clipping | ★★★ | medium | restoration |
18
- | [dewind](#dewind) | time | LF rumble | ★★★ | very low | wind, handling noise |
17
+ | [declip](#declip) | time | hard clipping | ★★★★ | medium | clipped recordings, rails found by itself |
18
+ | [dewind](#dewind) | freq | wind, LF rumble | ★★★ | medium | wind under a voice, its harmonics kept |
19
19
  | [deplosive](#deplosive) | time | LF bursts | ★★★ | low | mic plosives (p, b) |
20
20
  | [deesser](#deesser) | time | sibilance | ★★★★ | low | voice (s, sh) |
21
21
  | [debreath](#debreath) | time | inter-word noise | ★★★ | low | breath / hiss in pauses |
22
22
  | [desilence](#desilence) | time | pauses | ★★★ | low | remove / shorten / trim silence, split by pause |
23
23
  | [dereverb](#dereverb) | freq | late reverb | ★★★ | high | speech in a room |
24
- | [dewow](#dewow) | time + freq | pitch drift | ★★★ | medium | tape / vinyl / cassette wow & flutter |
24
+ | [dewow](#dewow) | time + freq | pitch drift | ★★★ | medium | disc wow (33⅓ / 45 / 78 rpm) in music; tape by its pilot tone |
25
25
 
26
26
  For broader DSP needs use [stretch](https://github.com/audiojs/stretch), [shift](https://github.com/audiojs/shift), [pitch](https://github.com/audiojs/pitch), [beat](https://github.com/audiojs/beat).
27
27
 
@@ -53,49 +53,99 @@ write() // → flush rema
53
53
 
54
54
  ## `denoise`
55
55
 
56
- Content-aware auto-selector. Runs a single STFT classification sweep over the input and dispatches to the most suitable method.
56
+ Finds the defect a recording carries and routes it to the method for it. Each route needs evidence; with none, nothing is removed and the sound comes back as it was (`'none'`).
57
57
 
58
58
  ```js
59
- denoise(data) // → cleaned Float32Array
59
+ denoise(data) // → cleaned Float32Array, or a copy: nothing to remove
60
60
  denoise(data, { returnPlan: true }) // → { out, plan }
61
61
  denoise(data, { force: 'wiener' }) // skip classifier
62
+ classify(data, fs) // → { method, scores }, the plan alone
62
63
  ```
63
64
 
64
65
  | Param | Default | |
65
66
  |---|---|---|
66
67
  | `fs` | `44100` | Sample rate |
67
- | `force` | — | One of `'dehum' \| 'declick' \| 'dewind' \| 'deesser' \| 'dereverb' \| 'omlsa' \| 'wiener'` |
68
+ | `force` | — | One of `'none' \| 'dehum' \| 'declick' \| 'dewind' \| 'deesser' \| 'dereverb' \| 'omlsa' \| 'wiener'` |
68
69
  | `returnPlan` | `false` | Return `{ out, plan }` with classifier scores + chosen method |
69
70
 
70
- **Routing (in priority order):**
71
- 1. tonal hum (Goertzel — ≥2 of first 3 harmonics show 50× line/off-line ratio at 50 or 60 Hz)
72
- 2. impulses: AR(30) residual samples over 12× the residual RMS within ±10 ms and 2× every residual 2.5–15 ms away (a glottal pulse has its like one pitch period off), more than 1 a second (`CLICK_RATE`)
73
- 3. sibilance (high/mid band power ratio > 8)
74
- 4. LF rumble (low/mid band power ratio > 3)
75
- 5. non-stationary noise (CV of the rolling-minimum frame-energy floor > 0.3) → omlsa
76
- 6. otherwise → wiener
71
+ **Routing, in priority order** (one STFT sweep, frames ≈ 46 ms, hop ¼; over 6 min, 16 spans of it spread across):
72
+ 1. **hum → `dehum`**: dehum's own measurement finds a mains series, and the lines it finds, A-weighted (IEC 61672-1), lie within 50 dB of the program's A-weighted level. A lone 60 Hz line 30 dB under a voice is there, and the ear hears 60 Hz 26 dB less than 1 kHz.
73
+ 2. **clicks → `declick`**: over 1 a second (`CLICK_RATE`) of impulses standing 32× out of the AR(30) error's local scale (the median of its 1.5 ms block RMS over ±12 ms, as declick judges), alone: no like of half its size 2.5–40 ms either side (a voice's pulses, creak down to 25 Hz), and no sound 10 dB louder after it than before (a plosive's burst, a note's attack).
74
+ 3. **sibilance → `deesser`**: 5–9 kHz over 0.2–2 kHz power over 8.
75
+ 4. **wind → `dewind`**: in over a tenth of the 0.15 s blocks, the low end (< 200 Hz) within 20 dB of the program, 6 dB over the 300–2000 Hz band, and without lines. Wind is turbulence at the microphone, without a period (Nelke & Vary, IWAENC 2014); a bass line or a voice's low end repeats at its pitch.
76
+ 5. **noise bed → `wiener` or `omlsa`**: a floor within 25 dB of the program (`BED_SNR`; the program: frames within 40 dB of the loudest), shown in its *pauses* (runs of 0.15 s or more within 6 dB of the frame level's 10th percentile, flat and without lines in the bands from 300 Hz; the bed: their median level) or in *steady bands* (a band whose quieter half varies no more than twice what Gaussian noise over its bins would, without lines). A line is a band's fine structure (log power less its ±4-bin mean) correlated with the frame N back, which shares no sample: a partial holds its bins, noise draws them anew. Steady bands → `wiener`; a bed seen in the pauses alone wanders → `omlsa`.
77
+ 6. otherwise **`none`**.
78
+
79
+ 0.3 had no `none`: every recording went somewhere. Its floor statistic (the spread of a rolling-minimum frame energy) read a program's own dynamics as a wandering noise bed, so clean speech and music went to `omlsa`; a bass-heavy mix went to `dewind` (low over mid power above 3); clean VoiceBank went to `declick`, its impulse count firing on lip smacks and plosive bursts. A blind SNR estimate can't stand in for the bed, each assuming a speech-like program: on the training material below, clean music read (median) 5.4 dB by WADA-SNR (Kim & Stern, Interspeech 2008), 15.4 dB by a NIST STNR-like frame histogram and 7.0 dB by minimum statistics (Martin 2001), under the noisy VoiceBank takes' 13.2, 22.3 and 13.0. A bed has to show itself as noise, where the program pauses or never reaches.
80
+
81
+ `node scripts/detect.js tune|test` routes labelled material and prints what each class went to (sources and mixtures in the script); the share routed right, 0.3.2 → 0.4.0, thresholds chosen on `tune` (VoiceBank+DEMAND's training subset, Spoken Wikipedia narrations, repair/ music, VocalSet singers m1 f2 m2 f1, even Slakh mixes, MUSDB18 train), `test` run once (the VoiceBank+DEMAND test set, ten other narrations, other singers and tracks):
82
+
83
+ | material | wanted | tune | test |
84
+ |---|---|---:|---:|
85
+ | clean speech, VoiceBank (84 · 138) | `none` | 0 → 93% | 0 → 96% |
86
+ | narrations (20 · 20) | `none` | 0 → 90% | 0 → 85% |
87
+ | clean music (62 · 56) | `none` | 0 → 98% | 0 → 93% |
88
+ | VoiceBank+DEMAND noisy (84 · 138) | a reducer | 86 → 73% | 92 → 57% |
89
+ | speech + white, pink noise 0–20 dB under | a reducer | 100 → 95% | 99 → 100% |
90
+ | speech + babble 0–20 dB under | a reducer | 88 → 76% | 83 → 80% |
91
+ | music + white noise 10–20 dB under | a reducer | 97 → 92% | 100 → 89% |
92
+ | music + pink noise 10–20 dB under | a reducer | 97 → 68% | 100 → 68% |
93
+ | speech, music + mains hum 20 dB under | `dehum` | 57 → 83% | 69 → 81% |
94
+ | speech, music + clicks at 5× | `declick` | 100 → 94% | 99 → 90% |
95
+ | speech + wind gusts 0–10 dB under | `dewind` | 4 → 93% | 0 → 89% |
96
+ | music + wind gusts 0–10 dB under | `dewind` | 17 → 38% | 24 → 50% |
97
+ | all scored | | 66.4 → 84.6% | 68.8 → 84.9% |
98
+
99
+ Material with nothing to remove (tune 166, test 214): 0.3.2 processed all of it (median error −22.7 and −26.0 dB re the input); now 157 and 202 come back untouched. Of the 9 tune items processed, 5 VoiceBank takes go to `declick`, and they hold lip smacks 32–124× out of the error; a VoiceBank take and a metal track to `dehum`, each with a 50 Hz line 4–8 dB under its mean power; both excerpts of one narration to `omlsa`, its floor 21–23 dB under the voice, as audio-lena's is (22 dB). On test: `declick` 5, `omlsa` 2, `wiener` 2, `dewind` 2, `dehum` 1. Missed: noise holding a line through the pauses (an engine, a fan) unless it is steady elsewhere, so most of the test set's bus noise, and its office and living-room noise at 12.5–17.5 dB, stay; pink noise under a dense mix, masked where its power lies; a steady low rumble (traffic, a car) goes to `dewind` where its low end outweighs the mid band. ~10–17 ms per second of sound.
100
+
101
+ dereverb has no reliable single-pass signature, so auto-mode never selects it — reach it explicitly via `denoise(data, { force: 'dereverb' })` or `dereverb()`.
77
102
 
78
103
 
79
104
  ## Tonal & narrowband
80
105
 
81
106
  ### `dehum`
82
107
 
83
- Measures the hum, then notches it: biquad notches at the harmonics of the mains frequency that stand out, at the frequency measured. Without hum the audio comes back untouched. Notches cost speech wherever there is no hum to remove: a voice's harmonics sweep through them and each notch rings on what it takes out (the old default, four notches at 50–200 Hz, took clean VoiceBank speech from PESQ 4.64 to 3.2).
108
+ Measures the hum, then subtracts it: each harmonic of the mains frequency is estimated as a slowly varying sinusoid and taken out, so what goes with the hum is the program within a fraction of a hertz of each line, and less of it where the program is loud there. Without hum the audio comes back untouched. Notches (0.2.0) took whatever their band held, a band that grows with the harmonic (Q 30: 1.7 Hz at 50 Hz, 33 Hz at 1 kHz), an orchestra's G2 two hertz under the 100 Hz line among it; and as the mains frequency wanders (±0.02–0.05 Hz, h times that at harmonic h) narrow ones miss the upper harmonics.
84
109
 
85
110
  ```js
86
111
  dehum(data, { fs }) // 50 or 60 Hz, measured; nothing without hum
87
112
  dehum(data, { fs, freq: 60 }) // the 60 Hz series, its exact frequency measured
88
- dehum(data, { fs, freq: 60, harmonics: 4 }) // notch 60–240 Hz whatever is there
113
+ dehum(data, { fs, freq: 60, harmonics: 4 }) // remove 60–240 Hz as told
89
114
  measure(data, fs) // → { f0, harmonics } or null (import from @audio/denoise-dehum)
90
115
  ```
91
116
 
92
117
  | Param | Default | |
93
118
  |---|---|---|
94
119
  | `freq` | measured | Fundamental, Hz. Omitted: the 50 or 60 Hz series, whichever stands out. Given: its exact frequency within ±0.4 % (±`drift` Hz with `adaptive`) |
95
- | `harmonics` | those present | Notch h = 1…`harmonics`, present or not. Omitted: the harmonics up to 1 kHz that stand out |
96
- | `Q` | `30` | Notch sharpness — higher = narrower |
120
+ | `harmonics` | to 1 kHz | Remove h = 1…`harmonics`. Omitted: every harmonic up to 1 kHz |
97
121
 
98
- The measurement is one Fourier transform over the signal (its first 80–90 s, taken down to 3 kHz), where a hum line, steady for minutes, gathers into a peak 1/T wide while speech spreads. Each line is judged by its peak over the median power of the ±8 Hz around it: hum is there when the fundamental stands out by 20 dB or two of the first six harmonics by 15 dB (searched within ±0.4 %, the mains tolerance); the fundamental is the least-squares fit f0 = Σh·p<sub>h</sub>/Σh² to the interpolated peaks, and each harmonic up to 1 kHz found within ±0.05 % of h·f0 at 13 dB is notched. It needs a second of signal: in blocks, pass the same `params` object and give the first call a second or more. As an `audio` op it is whole-clip (`streaming: false`).
122
+ The measurement is one Fourier transform over the signal (its first 80–90 s, taken down to 3 kHz), where a hum line, steady for minutes, gathers into a peak 1/T wide while speech spreads. Hum is there when the fundamental stands out by 20 dB over the median of the ±8 Hz around it, or two of the first six harmonics by 15 dB (searched within ±0.4 %, the mains tolerance), each 6 dB over any other peak within 3 Hz, all of them harmonics of one fundamental (p<sub>h</sub>/h within 0.01 Hz). A bar of music repeated exactly is a comb of lines 1/bar apart (every 2 Hz at 120 bpm), lines at 50 and 60 Hz among them: none stands alone. On 164 music clips (MUSDB18 excerpts, BabySlakh) this finds hum in one, which has it (0.2.0: in 19); on 504 clean and 504 noisy VoiceBank training utterances, in one, a steady 49.86 Hz tone at the speech's level; with hum 20 dB under the speech, in 95 % (50 Hz) and 92 % (60 Hz) of them, as before.
123
+
124
+ Then the signal is cut into Hann frames four mains cycles long, two apart, and each harmonic's phasor taken per frame; the window's zeros fall on the other harmonics. Each harmonic's phasors are fitted over 2 s by weighted local-linear least squares (normalized convolution, Knutsson & Westin 1993), each frame weighted by the inverse of the program's power around the line there, so a passing voice or note is bridged from the frames around it rather than averaged in. The mains phase is tracked from the fitted phasors' turn, harmonics combined by h²·SNR (Hajj-Ahmad, Garg & Wu 2013) over 8 s, and the sinusoids are subtracted along it (harmonic subtraction, as power-line interference is taken out of ECG: Levkov et al. 2005). A cut in the recording jumps the hum's phase: within a second of it the fit blends the two phases and takes the hum ~10 dB down, not ~40. A note within ~0.5 Hz of a line for seconds is taken for hum. Whole clip (`streaming: false`), a second at least to measure; shorter, it removes the harmonics of a given `freq` as told and passes the audio through without one.
125
+
126
+ Measured by `node scripts/dehum.js`: the hum (12 harmonics at −6 dB per octave, levels drifting ±10 %, f0 0.05 Hz off nominal and wandering) and the program told apart by phase inversion (Hagerman & Olofsson 2004). 50 Hz hum 20 dB under the program, wandering ±0.02 Hz; program SDR per band where the band holds 1 % of the program:
127
+
128
+ | material | hum down, dB | program SDR, dB | <100 Hz | 100–300 | 300–1k | 1–4k | >4k |
129
+ |---|---:|---:|---:|---:|---:|---:|---:|
130
+ | speech | 45.5 | 38.5 | 28.9 | 39.2 | 39.2 | 83.0 | – |
131
+ | narration | 43.5 | 42.7 | – | 38.8 | 42.9 | 64.5 | 73.9 |
132
+ | vibeace | no hum found | | | | | | |
133
+ | brahms | 42.2 | 25.7 | 30.2 | 17.9 | 27.0 | 57.8 | 50.2 |
134
+ | nutcracker | 41.6 | 27.6 | 23.5 | 30.7 | 26.8 | 63.6 | – |
135
+ | trumpet | 51.0 | 47.9 | – | – | 42.2 | 82.3 | – |
136
+
137
+ Hum down / program SDR, dB:
138
+
139
+ | material | 60 Hz | 50 Hz, ±0.05 Hz | 50 Hz, 30 dB under |
140
+ |---|---|---|---|
141
+ | speech | 46.3 / 42.1 | 36.6 / 38.6 | 38.7 / 38.6 |
142
+ | narration | 43.6 / 44.0 | 33.8 / 42.8 | 42.3 / 42.9 |
143
+ | vibeace | no hum found | no hum found | no hum found |
144
+ | brahms | 41.7 / 29.0 | 27.8 / 25.7 | 33.9 / 25.7 |
145
+ | nutcracker | 40.7 / 24.3 | 33.2 / 27.9 | no hum found |
146
+ | trumpet | 51.9 / 47.8 | 46.0 / 47.7 | 48.4 / 48.0 |
147
+
148
+ The same mixtures through 0.2.0 (its Q 30 notches at the lines it found, run on hum and program apart): hum 5–15 dB down (26 in Vibe Ace at 60 Hz), program SDR 10–38 dB (speech 22.3, Brahms 13.6, its 100–300 Hz band 5.7). Hum alone, 30 s, ±0.02 Hz: 56 dB down (0.2.0: 26). Clean speech, narration and music: no sample changed. In Vibe Ace the hum's lines stand among the track's own steady ones, none alone, so none is taken for hum (0.2.0 found hum in the clean track); `freq` and `harmonics` remove them as told.
99
149
 
100
150
  **Use when:** mains buzz, ground-loop hum, fixed tonal interference.<br>
101
151
  **Not for:** broadband noise (use `wiener`/`omlsa`); shifting tones (use spectral methods).
@@ -103,61 +153,145 @@ The measurement is one Fourier transform over the signal (its first 80–90 s, t
103
153
 
104
154
  ### `dewind`
105
155
 
106
- Adaptive high-pass. Cutoff slides between `cutoffMin` and `cutoffMax` based on the LF/MF energy ratio.
156
+ Takes wind out from under a voice or an instrument and leaves their harmonics. Wind is turbulence at the microphone: noise under a few hundred Hz with no period, in gusts (Nelke & Vary, IWAENC 2014), where a voice's low end is a row of harmonics. A high-pass can only take everything under its cutoff, the voice's low harmonics with the wind; here each STFT bin under `cutoff` is weighed against a wind spectrum read from the frame itself.
157
+
158
+ The frame is the power of two nearest 85 ms (4096 samples at 44.1 and 48 kHz), so a 100 Hz voice's harmonics stand 8 bins apart with valleys between them. The wind spectrum is the periodogram's morphological opening over 5 bins: every peak narrower than that is cut, and a steady harmonic under a Hann window is 4 bins wide, so the harmonics go and the broad wind stays (the inverse harmonic mask of Nelke, Naylor & Vary, ICASSP 2015, without a pitch track). Over 100 Hz it is held to 4× the least it has been over the last 1.5 s relative to its level under 100 Hz (minimum statistics, Martin 2001): wind keeps its shape while it gusts, and a voice's valleys, onsets and unvoiced sounds don't pass for it. The gain is OM-LSA's form (Cohen & Berdugo 2001): a Wiener gain on the decision-directed a priori SNR, raised to the speech presence probability, which takes a fixed 15 dB prior (Gerkmann & Hendriks 2012) and an a priori absence of 0.2 on a harmonic (a peak 6 dB over the wind), 0.9 elsewhere. So a harmonic keeps what of it stands over the wind, and the wind's own random peaks don't come through as musical noise.
159
+
160
+ It runs while wind blows: the 20–300 Hz band aperiodic (its normalized autocorrelation, taken through the frame's spectrum over the window's, under ½ at 2.5–25 ms; a harmonic H in noise N reads H / (H + N), Boersma 1993) and its noise over the 300–2000 Hz band, floored 20 dB under its peak over the last seconds, three frames in a row (a 150 ms gap between words shows it); then held 1 s, through the words, whose low end hides it. A bass line, a kick drum's body or a voice's low end repeats; a room's quiet rumble in a pause is no wind next to a voice. With no wind the output equals the input, sample for sample, `frameSize − 1` samples later (85 ms at 48 kHz, the manifest's declared latency).
107
161
 
108
162
  ```js
109
- dewind(data, { cutoffMin: 60, cutoffMax: 250 })
163
+ dewind(data, { fs: 48000 }) // in place
164
+ let write = dewind({ fs: 48000 }) // stream: write(chunk) → the samples done, write() → the rest
110
165
  ```
111
166
 
112
167
  | Param | Default | |
113
168
  |---|---|---|
114
- | `cutoffMin` | `60` | Hz — minimum cutoff (LF mostly clean) |
115
- | `cutoffMax` | `250` | Hz — maximum cutoff (heavy rumble) |
116
- | `order` | `2` | HP sections (each 12 dB/oct) |
117
- | `Q` | `0.707` | Butterworth-ish |
118
- | `blockSize` | `1024` | Coefficient update interval (samples) |
169
+ | `cutoff` | `1500` | Hz, the top of the band wind is taken from; read every frame |
170
+ | `attenuation` | `-20` | dB, the most a bin is turned down; `0` takes nothing |
171
+ | `frameSize` | 85 ms | STFT frame, a power of two; the hop a quarter |
172
+
173
+ `python scripts/wind.py fetch`, then `node scripts/lowend.js dewind` puts clean speech and music through it, then speech with wind: synthetic (Gaussian noise shaped and gusting as Nelke & Vary measure it), generated (the SC-Wind-Noise-Generator, Mirabilii et al., IWAENC 2022: spectrum and gusts by wind speed) and recorded (twelve CC0 recordings of wind on a microphone, freesound.org), half of the generated and recorded tuning the defaults, half below. VoiceBank+DEMAND test utterances (every fourth: p232 male, p257 female), ten Spoken Wikipedia narrations, the music `repair` uses, 0.2.0 → now; voiced frames thinned: the voiced 10 ms frames whose level under 250 Hz fell by more than 3 dB; their periodic part: whose periodic energy there (r·E, Boersma 1993) did:
174
+
175
+ | | untouched | voiced frames thinned | their periodic part | 20–63 Hz | 63–125 Hz | 125–250 Hz |
176
+ |---|---:|---:|---:|---:|---:|---:|
177
+ | speech, male | 0% → 0% | 5.1% → 9.1% | 4.9% → 7.2% | −0.2 → −1.7 | 0.0 → −0.5 | 0.0 → −0.1 |
178
+ | speech, female | 0% → 0% | 8.8% → 16.2% | 8.5% → 11.6% | −1.2 → −4.5 | −0.1 → −0.7 | 0.0 → 0.0 |
179
+ | narrations | 0% → 20% | 2.4% → 6.0% | 2.4% → 5.2% | −0.1 → −0.7 | −0.1 → −0.3 | 0.0 → −0.2 |
180
+ | audio-lena | 100% → 100% | 0.0% → 0.0% | 0.0% → 0.0% | 0.0 → 0.0 | 0.0 → 0.0 | 0.0 → 0.0 |
181
+ | Vibe Ace (jazz) | 0% → 0% | 0.1% → 1.2% | 0.1% → 0.9% | 0.0 → −0.2 | 0.0 → −0.1 | 0.0 → −0.1 |
182
+ | Brahms (strings) | 0% → 100% | 0.0% → 0.0% | 0.0% → 0.0% | 0.0 → 0.0 | 0.0 → 0.0 | 0.0 → 0.0 |
183
+ | Nutcracker | 0% → 100% | 0.0% → 0.0% | 0.0% → 0.0% | 0.0 → 0.0 | 0.0 → 0.0 | 0.0 → 0.0 |
184
+ | trumpet | 100% → 100% | 0.0% → 0.0% | 0.0% → 0.0% | 0.0 → 0.0 | 0.0 → 0.0 | 0.0 → 0.0 |
185
+ | bass line | 0% → 100% | 0.0% → 0.0% | 0.0% → 0.0% | 0.0 → 0.0 | 0.0 → 0.0 | 0.0 → 0.0 |
186
+
187
+ A recording's own low rumble, where it outweighs the mid band in a pause, reads as wind: VoiceBank's room tone before each take engages it for the take's first second, and narrations recorded at home in their pauses. The rumble goes; the voiced frames that thin are onsets, whose low end an 85 ms frame smears into a broad bump that reads as floor, and frames whose low end is mostly that rumble. Orchestral music, a trumpet and a bass line come back untouched; a jazz track's drums engage it for moments.
188
+
189
+ Wind at a speech-to-wind ratio of +10, 0 and −10 dB, the error to the clean speech taken away (dB):
190
+
191
+ | | +10 dB | 0 dB | −10 dB |
192
+ |---|---:|---:|---:|
193
+ | synthetic | −0.1 → 5.1 | 2.4 → 9.9 | 5.6 → 13.1 |
194
+ | generated | −0.1 → 4.4 | 1.3 → 8.3 | 4.1 → 11.3 |
195
+ | recorded | −0.4 → 3.8 | 1.1 → 7.5 | 3.2 → 10.2 |
196
+
197
+ The wind removed and the speech kept, by phase inversion (Hagerman & Olofsson, Acta Acustica 2004: the op on s + n and on s − n, ŝ = (y₊ + y₋)/2, n̂ = (y₊ − y₋)/2), dB:
198
+
199
+ | | wind removed, +10 dB | 0 dB | −10 dB | speech kept, +10 dB | 0 dB | −10 dB |
200
+ |---|---:|---:|---:|---:|---:|---:|
201
+ | synthetic | 2.2 → 9.3 | 5.3 → 14.0 | 7.0 → 15.0 | −0.1 → −0.3 | −0.4 → −0.8 | −0.7 → −1.8 |
202
+ | generated | 1.7 → 8.8 | 3.5 → 12.4 | 5.4 → 13.3 | −0.1 → −0.4 | −0.5 → −1.2 | −0.7 → −3.0 |
203
+ | recorded | 1.3 → 8.0 | 3.1 → 10.8 | 4.0 → 11.4 | −0.1 → −0.4 | −0.4 → −1.1 | −0.3 → −2.1 |
204
+
205
+ PESQ (wideband), STOI and DNSMOS P.835 of the same outputs, the three winds together (`python scripts/wind.py score DIR/now test`; scored at 16 kHz as `scripts/speech.py` does):
206
+
207
+ | | PESQ | STOI | SIG | BAK | OVRL |
208
+ |---|---:|---:|---:|---:|---:|
209
+ | +10 dB: input | 1.76 | 0.939 | 3.51 | 3.36 | 2.89 |
210
+ | 0.2.0 | 1.67 | 0.937 | 3.47 | 3.44 | 2.90 |
211
+ | now | 2.30 | 0.935 | 3.34 | 3.61 | 2.88 |
212
+ | 0 dB: input | 1.21 | 0.874 | 3.25 | 2.44 | 2.31 |
213
+ | 0.2.0 | 1.23 | 0.870 | 3.26 | 2.66 | 2.41 |
214
+ | now | 1.58 | 0.875 | 3.20 | 3.19 | 2.58 |
215
+ | −10 dB: input | 1.06 | 0.754 | 2.06 | 1.43 | 1.43 |
216
+ | 0.2.0 | 1.09 | 0.753 | 2.36 | 1.67 | 1.63 |
217
+ | now | 1.16 | 0.756 | 2.83 | 2.41 | 2.08 |
218
+ | all: input | 1.34 | 0.856 | 2.94 | 2.41 | 2.21 |
219
+ | 0.2.0 | 1.33 | 0.853 | 3.03 | 2.59 | 2.31 |
220
+ | now | 1.68 | 0.855 | 3.12 | 3.07 | 2.51 |
119
221
 
120
- **Use when:** intermittent wind buffeting, handling thumps, low-frequency room modes — the adaptive cutoff opens on gusts and closes between them (measured: beats `wiener` on gusty wind at ~1/10 the CPU).<br>
121
- **Not for:** continuous rumble under speech — a time-domain cutoff can't separate overlapping spectra; use `wiener`/`omlsa` there (measured ~9 dB vs ~1 dB SNR gain). An LPC-null post-filter was evaluated and rejected: voiced speech is as AR-predictable as wind, so nulling wind poles whitens vowels too (LSD improves, SNR and speech level degrade).
222
+ STOI barely moves: its bands begin at 150 Hz, above most of the wind. In light wind DNSMOS's SIG drops 0.17; an ideal Wiener gain from the wind's own spectrum under 1.5 kHz lost 0.12 there on the tuning material.
223
+
224
+ 0.2.0 high-passed only between the words: a voiced low end sent its filter out, so the wind under the words stayed. The wind now goes under the words too, between and under the harmonics; what a voice loses is mostly the harmonics the wind buries (its low end at −10 dB), and onsets.
225
+
226
+ **Use when:** wind on a microphone under a voice or an instrument, gusting or steady; a recording's low rumble (traffic, a fan) where it outweighs the mid band in the pauses.<br>
227
+ **Not for:** a lone thump (`deplosive`), a steady low tone or hum, which has a period (`dehum`, `highpass`), or broadband noise (`omlsa`, `wiener`). Air rushing over the whole band is taken only under `cutoff`. A neural model (`@audio/neural-denoise`'s DeepFilterNet3) takes more of the wind and keeps more of the voice; dewind leaves a sound with no aperiodic low end as it is (music, a voice with no rumble under it), streams at a frame's delay, and needs no model.
122
228
 
123
229
 
124
230
  ### `deplosive`
125
231
 
126
- Splits the signal into an LF band (`< crossover`) and its exact complement; ducks the LF band when its energy spikes above `triggerRatio`× the high band (a plosive signature). With no plosive present the output equals the input sample-for-sample — no crossover coloration.
232
+ Ducks the band under `crossover` for a close-mic `p` or `b`: a pressure pulse that rises out of nothing, outweighs the band above it and has no period, where a voice's or a bass note's low end repeats at its pitch. A duck begins when the low band's 3 ms envelope jumps over 3× its 30 ms average while standing over `triggerRatio`× the high band, and holds while that lasts and the low band stays aperiodic: its normalized autocorrelation's peak at a 2.5–25 ms lag (Talkin 1995) under ½, where a harmonic part would lead (Boersma 1993). The high band is floored 20 dB under its peak over the last seconds, so a room's own rumble in a pause is no pop. The duck crossfades toward the high-passed sound, x − (1 − g)·(x − HP(x)), so it never lifts a band; with no pop the output equals the input sample for sample.
127
233
 
128
234
  ```js
129
- deplosive(data, { triggerRatio: 4, attack: 0.005, release: 0.08 })
235
+ deplosive(data, { triggerRatio: 4, attack: 0.002, release: 0.03 })
130
236
  ```
131
237
 
132
238
  | Param | Default | |
133
239
  |---|---|---|
134
- | `triggerRatio` | `4` | LF/high energy ratio that opens the duck |
240
+ | `triggerRatio` | `4` | LF/high envelope ratio a pop must exceed |
135
241
  | `attenuation` | `-18` | dB cut on the LF band when triggered |
136
242
  | `crossover` | `200` | Hz — LF/high split point |
137
- | `attack` | `0.005` | s |
138
- | `release` | `0.08` | s |
243
+ | `attack` | `0.002` | s |
244
+ | `release` | `0.03` | s |
245
+
246
+ At full duck the response is −24 dB at 60 Hz, −17 at 100, −2.1 at 250 and −0.5 at 400 Hz; 0.1.10's g·LP + (x − LP), x − LP being no high-pass, gave −7.5, −3.1, +1.8 and +1.3 dB, and it ducked any low end over 4× the high band: a voice's, a jazz track's, a bass line's. `node scripts/lowend.js deplosive` puts clean speech and music through it, then speech with pops added (synthetic: half-sine pressure pulses of 20–60 ms under 150 Hz before each word that follows a pause; no recordings of real pops over their clean speech exist here). VoiceBank+DEMAND test utterances, Spoken Wikipedia narrations, the music `repair` uses, 0.1.10 → now; voiced frames thinned: the voiced 10 ms frames whose level under 250 Hz fell by more than 3 dB:
247
+
248
+ | | voiced frames thinned | 20–63 Hz | 63–125 Hz | 125–250 Hz |
249
+ |---|---:|---:|---:|---:|
250
+ | speech, male | 8.9% → 0.7% | −1.2 → −0.1 | −0.5 → 0.0 | −0.1 → 0.0 |
251
+ | speech, female | 16.3% → 2.2% | −3.4 → −0.2 | −0.3 → 0.0 | 0.2 → 0.0 |
252
+ | narrations | 2.4% → 0.0% | −0.7 → −0.2 | −0.2 → 0.0 | 0.0 → 0.0 |
253
+ | audio-lena | 0.0% → 0.0% | 0.0 → 0.0 | 0.0 → 0.0 | 0.0 → 0.0 |
254
+ | Vibe Ace (jazz) | 41.3% → 0.4% | −4.3 → 0.0 | −2.9 → 0.0 | −0.6 → 0.0 |
255
+ | Brahms (strings) | 0.4% → 0.1% | 0.0 → 0.0 | 0.0 → 0.0 | 0.0 → 0.0 |
256
+ | Nutcracker | 3.6% → 0.1% | 0.0 → 0.0 | −0.1 → 0.0 | 0.0 → 0.0 |
257
+ | trumpet | 0.0% → 0.0% | 0.0 → 0.0 | 0.0 → 0.0 | 0.0 → 0.0 |
258
+ | bass line | 53.1% → 0.0% | −8.3 → −0.1 | −4.6 → 0.0 | 0.2 → 0.0 |
259
+
260
+ Pops peaking at 0.5, 1 and 2× the utterance's peak, the error to the clean speech taken away over each pop and the 150 ms after it (dB):
261
+
262
+ | | 0.5× | 1× | 2× |
263
+ |---|---:|---:|---:|
264
+ | speech, male | 11.5 → 11.0 | 13.6 → 13.2 | 14.4 → 14.5 |
265
+ | speech, female | 13.9 → 12.6 | 14.7 → 14.2 | 14.9 → 15.0 |
139
266
 
140
- **Use when:** mic plosives (`p`, `b`, `t`) producing low-frequency thuds.
267
+ 0.1.10 often met a pop with its duck already down on the pause's rumble before the word; it now waits for the pop, and takes the first few ms of it a little less.
268
+
269
+ **Use when:** mic plosives (`p`, `b`, `t`) producing low-frequency thuds.<br>
270
+ **Not for:** a kick drum or a bass note struck hard: so sudden a low end is ducked for its first few ms, before its period shows.
141
271
 
142
272
 
143
273
  ### `deesser`
144
274
 
145
- Dynamic peaking EQ centred on the sibilance band. Detection runs on a HP side-chain; when the envelope exceeds threshold, a negative-gain peaking EQ at `fc` engages on the audio path. Re-computed every `block` samples for smooth gain riding. Backed by [`@audio/dynamics-deesser`](https://github.com/audiojs/dynamics) `mode: 'band'` since the 2026-07 near-dupe merge — same seconds-based options here.
275
+ Sibilance reduction, [`@audio/dynamics-deesser`](https://github.com/audiojs/dynamics) `mode: 'band'` behind this family's seconds-based options (2026-07 near-dupe merge). An 's' is told by its shape, not its level: the sibilance band at `fc` is measured against the voice body under `fc / 2`, in dB, and how far it rises over `threshold` sets a peaking cut at `fc`, held within `range`.
146
276
 
147
277
  ```js
148
- deesser(data, { fc: 6500, threshold: -28, ratio: 4 })
278
+ deesser(data, { fs }) // the kernel's threshold (0 dB) and range (−6 dB)
279
+ deesser(data, { fs, fc: 7500, threshold: -3, range: -8 }) // softer esses too, deeper
149
280
  ```
150
281
 
151
282
  | Param | Default | |
152
283
  |---|---|---|
153
284
  | `fc` | `6000` | Sibilance centre (Hz; `freq` still accepted) |
154
- | `threshold` | `-30` | dBFS — engagement level |
285
+ | `threshold` | kernel's (`0`) | dB of the sibilance band over the voice body where the cut starts; not a level |
286
+ | `range` | kernel's (`-6`) | dB, the deepest cut |
155
287
  | `ratio` | `4` | Compression ratio above threshold |
156
288
  | `attack` | `0.001` | s — how fast the cut engages |
157
289
  | `release` | `0.05` | s — how slowly it recovers |
158
290
  | `Q` | `1.4` | Peaking EQ Q |
159
291
  | `block` | `64` | Coefficient update interval (samples) |
160
292
 
293
+ `threshold` was a level, −30 dBFS here; under the kernel's 0.3 it is the band over the body, and −30 cut a ride cymbal 12 dB under a mix by a median 2.7 dB.
294
+
161
295
  **Use when:** voice post-production with hot s/sh; vocal bus de-essing.
162
296
 
163
297
 
@@ -165,7 +299,7 @@ deesser(data, { fc: 6500, threshold: -28, ratio: 4 })
165
299
 
166
300
  ### `specsub`
167
301
 
168
- Power spectral subtraction with over-subtraction and a spectral floor (Berouti, Schwartz & Makhoul 1979): |Ŝ|² = |Y|² − α·N̂ where that stays above β·N̂, else β·N̂. Over-subtraction takes out the noise's peaks that plain subtraction leaves as musical tones; the floor, a fraction of the noise estimate, fills the valleys with a steady bed that masks what is left. α follows the frame's SNR (4 − 3/20·SNR: 4.75 at −5 dB down to 1 at 20 dB) unless fixed. The noise PSD is tracked by minimum statistics (Martin 2001) over a 1.5 s window, in batch and stream alike, unless a profile or a noise-only stretch is given.
302
+ Power spectral subtraction with over-subtraction and a spectral floor (Berouti, Schwartz & Makhoul 1979): |Ŝ|² = |Y|² − α·N̂ where that stays above β·N̂, else β·N̂. Over-subtraction takes out the noise's peaks that plain subtraction leaves as musical tones; the floor, a fraction of the noise estimate, fills the valleys with a steady bed that masks what is left. α follows the frame's SNR (4 − 3/20·SNR: 4.75 at −5 dB down to 1 at 20 dB) unless fixed. The noise PSD is tracked by minimum statistics (Martin 2001) over a 1.5 s window, in batch and stream alike, unless a profile or a noise-only stretch is given. `processor(opts)` is the gain as an @audio/stft frame process, for a host running its own frames.
169
303
 
170
304
  ```js
171
305
  specsub(data, { fs }) // α(SNR), β 0.05, noise tracked
@@ -188,7 +322,7 @@ specsub(data, { fs, noiseFrames: 6 }) // noise from the
188
322
 
189
323
  ### `wiener`
190
324
 
191
- MMSE log-spectral amplitude (Ephraim & Malah 1985) or Wiener (Scalart & Filho 1996) gain on the decision-directed a priori SNR ξ = α·Â²(l−1)/λ(l−1) + (1−α)·max(γ−1, 0) (Ephraim & Malah 1984, eq. 51). The noise PSD λ is tracked by minimum statistics (Martin 2001) over a 1.5 s window, in batch and stream alike, unless a profile or a noise-only stretch is given.
325
+ MMSE log-spectral amplitude (Ephraim & Malah 1985) or Wiener (Scalart & Filho 1996) gain on the decision-directed a priori SNR ξ = α·Â²(l−1)/λ(l−1) + (1−α)·max(γ−1, 0) (Ephraim & Malah 1984, eq. 51). α = 0.98 is theirs for an 8 ms frame step (§VI: 256 samples at 8 kHz, a new frame every 64) and is rescaled to the actual step as α<sup>Δt/8 ms</sup>, so the a priori SNR's memory holds in seconds; applied per frame until 0.3, it ran 1.8× longer at 48 kHz (10.7 ms steps) than at 44.1 kHz (5.8 ms). The floor ξ<sub>min</sub> stays −15 dB: −25 dB, Cohen's and Loizou's, left more musical noise on steady white and pink noise (log kurtosis ratio 0.98 and 1.49, against 0.53 and 1.01) and cost PESQ and SIG on the training speech (`scripts/speech.mjs`). The noise PSD λ is tracked by minimum statistics (Martin 2001) over a 1.5 s window, in batch and stream alike, unless a profile or a noise-only stretch is given. `processor(opts)` is the gain as an @audio/stft frame process, for a host running its own frames.
192
326
 
193
327
  ```js
194
328
  wiener(data, { fs }) // LSA gain, noise tracked
@@ -199,7 +333,7 @@ wiener(data, { fs, noiseFrames: 6 }) // noise from the
199
333
  | Param | Default | |
200
334
  |---|---|---|
201
335
  | `rule` | `'mmse-lsa'` | `'wiener'` or `'mmse-lsa'` (log-spectral, less musical noise) |
202
- | `alpha` | `0.98` | Decision-directed smoothing (alias of `alphaDD`) |
336
+ | `alpha` | `0.98` | Decision-directed smoothing per 8 ms of frame step, rescaled to the actual step (alias of `alphaDD`) |
203
337
  | `xiMin` | `10^−1.5` | A priori SNR floor (−15 dB) |
204
338
  | `frameSize` | power of two nearest 32 ms | STFT frame: 512 at 16 and 22.05 kHz, 1024 at 44.1, 2048 at 48 (`frame(fs)`) |
205
339
  | `hopSize` | `frameSize/4` | OLA hop |
@@ -211,9 +345,13 @@ wiener(data, { fs, noiseFrames: 6 }) // noise from the
211
345
 
212
346
  ### `omlsa`
213
347
 
214
- Optimally-Modified Log-Spectral Amplitude estimator (Cohen & Berdugo 2001) with IMCRA noise estimation (Cohen 2003). The log-spectral amplitude gain when speech is present, weighed against a floor by the speech presence probability p: `G = G_H1^p · G_min^(1−p)` (eq. 16). The a priori SNR is decision-directed on G<sub>H1</sub> (eq. 18), the a priori speech absence is estimated from its spread over time and neighbouring bins (§4), the noise spectrum comes from IMCRA. As Cohen's own `omlsa.m`, a bin whose speech absence reaches 0.9 counts as noise: noise that happens to peak keeps G<sub>min</sub> and leaves no musical tone, so what remains of the noise is the noise, G<sub>min</sub> quieter. Time constants are set for 8 ms frames and rescaled to the actual frame step (`omlsa.m` rescales by the reciprocal, which lengthens them at 48 kHz). `scripts/reference.py` holds a numpy version written from the papers; on 16 kHz VoiceBank frames it gives `omlsa.m`'s noise track, speech absence and gains to the last bit (but for near-empty bins, where `omlsa.m`'s absolute 1e-10 floors bind), and test.js holds this code to it.
348
+ Optimally-Modified Log-Spectral Amplitude estimator (Cohen & Berdugo 2001) with IMCRA noise estimation (Cohen 2003). The log-spectral amplitude gain when speech is present, weighed against a floor by the speech presence probability p: `G = max(G_H1, G_min)^p · G_min^(1−p)` (eq. 16 with G<sub>H1</sub> floored at G<sub>min</sub>: as written it took a bin below G<sub>min</sub> wherever G<sub>H1</sub> was under it, to −18 dB at G<sub>min</sub> −12, so `gMin` was not the floor). The a priori SNR is decision-directed on G<sub>H1</sub> (eq. 18), the a priori speech absence is estimated from the spread of an a priori SNR over time and neighbouring bins (§4), the noise spectrum comes from IMCRA. As Cohen's own `omlsa.m`, a bin whose speech absence reaches 0.9 counts as noise: noise that happens to peak keeps G<sub>min</sub> and leaves no musical tone, so what remains of the noise is the noise, G<sub>min</sub> quieter. Time constants, the decision-directed α among them, are set for 8 ms frames and rescaled to the actual frame step (`omlsa.m` rescales by the reciprocal, which lengthens them at 48 kHz).
215
349
 
216
- A noise that holds still can be learned instead: `profile`, the noise's PSD (`noiseProfile` of a stretch where it plays alone), or, in the batch form, `noiseFrames`/`profileFrom`/`profileTo` naming that stretch. The noise is then held (`known` of @audio/noise-estimate), and p reads the observation alone: (9) at the a priori SNR of speech ξ<sub>H1</sub> = 15 dB and q = 0.5 (Gerkmann & Hendriks 2012), and 0 where the estimated q reaches 0.9, as before. The decision-directed ξ lags a word's onset; a known noise need not wait for it. On the VoiceBank+DEMAND test set, the noise learned from the half second before each speaker starts and G<sub>min</sub> −12 dB: PESQ 2.48, SI-SDR 15.2 dB, OVRL 2.89, against 2.40, 14.5 and 2.86 tracked; on steady noise under speech and music the noise goes exactly G<sub>min</sub> down, with no musical noise from −12 to −20 dB (log kurtosis ratio 0.00; in the half second after music stops, 0.06 at −12 dB and 0.46 at −20). `processor(opts)` is the gain as an @audio/stft frame process, for a host running its own frames: audio's `denoise` op learns a print from a range and runs it so.
350
+ α sets how soon ξ follows a word's start after a pause, and how much gain a noise peak gets. Until 0.3 it was 0.98 per frame, whatever the frame (0.985 per 8 ms at 48 kHz, 0.972 at 44.1), and a word's second and third frames after a pause lost 10 and 5 dB. It is now the lowest value per 8 ms that leaves steady white and pink noise without musical noise: 0.97 tracking the noise (log kurtosis ratio 0.00 at G<sub>min</sub> −15 and −25 dB; 0.96 left 1.16 and 0.49 at −25, the paper's 0.92 0.99 and 1.81 at −15), 0.95 on a learned noise (`omlsa.m`'s; 0.92 left 0.19 and 0.42). The paper's cap q ≤ q<sub>max</sub> = 0.95 (Table 1) in place of the gate kept a word's second frame after a pause another 3 dB but left musical noise on steady noise (0.24 and 0.46 at α 0.97), so the gate stays. The table under [Speech](#speech) has what each keeps. `scripts/reference.py` holds a numpy version written from the papers; on 16 kHz VoiceBank frames it gives `omlsa.m`'s noise track, speech absence and gains to the last bit (but for near-empty bins, where `omlsa.m`'s absolute 1e-10 floors bind), and test.js holds this code to it.
351
+
352
+ The a priori SNR the speech absence is read from is smoothed in the cepstrum (Breithaupt, Gerkmann & Martin 2008): the speech power's maximum-likelihood estimate λ·max(γ−1, ξ<sub>ml,min</sub>), its cepstrum smoothed over time per quefrency, hardly where speech lives (the envelope's low quefrencies, the pitch's peak), much where a lone noise peak lives, and back. The decision-directed ξ (Cohen's, `qFrom: 'dd'`) lags a word's start after a pause, and takes a short burst of noise the tracker cannot follow for speech; the cepstral one follows a word's envelope at once and smooths a lone spectral peak away. Its constants are Table 1's, per 16 ms of frame step, but under 1.25 ms of quefrency Gerkmann & Hendriks's (ICASSP 2012: 0 and 0.2, where the 2008 paper's 0.5 and 0.7 lag an onset as the decision-directed ξ does) and above it 0.9: the least that leaves steady white and pink noise on a learned noise free of musical noise (0.85 left 0.22 on pink). On the training speech, tracked: PESQ 1.823 → 1.825, STOI 0.832 → 0.834, OVRL 2.525 → 2.543, BAK 3.00 → 3.04, musical noise 0.82 → 0.80; 40 ms tone bursts in steady noise pass at −6.5 dB (were −2.6). The cepstral ξ as the gain's own ξ as well lost voiced speech where the pitch glides (SIG −0.04), so the gain keeps the decision-directed one.
353
+
354
+ A noise that holds still can be learned instead: `profile`, the noise's PSD (`noiseProfile` of a stretch where it plays alone), or, in the batch form, `noiseFrames`/`profileFrom`/`profileTo` naming that stretch. The noise is then held (`known` of @audio/noise-estimate), and p reads the observation: γ averaged over 105.5 Hz and over 543 Hz of the frame, at fixed priors (Gerkmann, Breithaupt & Martin 2008: the averaged γ is χ² with r degrees of freedom from the Hann window's correlation across bins, ξ<sub>fix</sub> the a priori SNR that minimizes false alarms plus misses, eq. 13; at 48 kHz r 5.7 and 24, ξ<sub>fix</sub> 9.4 and 5.1 dB), and 0 where the estimated q reaches 0.9, as before. Until 0.4 it read γ in each bin alone, at ξ<sub>H1</sub> = 15 dB (Gerkmann & Hendriks 2012), and speech 0–5 dB over the noise lost 7.8 dB on the training speech, where the MMSE Wiener gain keeps 3.9. The paper averages over 64 ms of frames as well; presence then outlasted a sound by those frames, and in the half second after music stopped the noise came through in tones (log kurtosis ratio 0.45 at G<sub>min</sub> −12 dB, 1.77 at −20): over the frame alone. On the training speech, G<sub>min</sub> −12 dB: PESQ 1.861 → 1.867, OVRL 2.564 → 2.572, BAK 3.05 → 3.08, musical noise 0.53 → 0.46, speech 0–5 dB over the noise −7.8 → −5.1 dB, the noise taken in pauses 9.7 → 10.1 dB. Steady noise under speech and music goes exactly G<sub>min</sub> down, with no musical noise from −12 to −20 dB (log kurtosis ratio 0.00); in the half second after music stops, 0.05 at −12 dB and 0.61 at −20 (0.3: 0.11 and 1.00; `scripts/broadband.mjs`). Tracking the noise from the print (Gerkmann & Hendriks 2012's MMSE tracker started on it, RX's "adaptive") lost OVRL 0.04 and left musical noise (0.40 on pink): the print is held. `processor(opts)` is the gain as an @audio/stft frame process, for a host running its own frames: audio's `denoise` op learns a print from a range and runs it so.
217
355
 
218
356
  ```js
219
357
  omlsa(data, { fs })
@@ -223,10 +361,11 @@ omlsa(data, { fs, profileFrom: 0, profileTo: fs / 2, gMin: -12 }) // the noise
223
361
 
224
362
  | Param | Default | |
225
363
  |---|---|---|
226
- | `gMin` | `-15` | dB: what noise-only bins keep (alias `gMinDb`) |
227
- | `alpha` | `0.98` | Decision-directed smoothing (alias of `alphaDD`) |
364
+ | `gMin` | `-15` | dB: what noise-only bins keep, the floor (alias `gMinDb`) |
365
+ | `alpha` | `0.97`; `0.95` with a `profile` | Decision-directed smoothing per 8 ms of frame step, rescaled to the actual step (alias of `alphaDD`) |
228
366
  | `xiMin` | `10^−2.5` | A priori SNR floor (−25 dB) |
229
367
  | `qPrior` | estimated | A fixed a priori speech absence instead of the estimate |
368
+ | `qFrom` | `'cts'` | The a priori SNR the speech absence is read from: smoothed in the cepstrum, or `'dd'`, decision-directed (Cohen's `omlsa.m`) |
230
369
  | `frameSize` | power of two nearest 32 ms | STFT frame: 512 at 16 and 22.05 kHz, 1024 at 44.1, 2048 at 48 (`frame(fs)`) |
231
370
  | `hopSize` | `frameSize/4` | |
232
371
  | `profile` | tracked | A known noise PSD (`frameSize/2+1` bins), held |
@@ -271,78 +410,138 @@ declick(data, { fs: 44100, regions: [{ at: 12.31, duration: 0.02 }] }) // the cl
271
410
 
272
411
  ### `decrackle`
273
412
 
274
- Continuous AR-residual outlier detection with MAD-based threshold. Suited to high-rate impulse noise.
413
+ Finds crackle, a worn record's dense small impulses, where the sound departs both from its AR prediction and from its least-squares interpolation from either side, and rebuilds all of it in a 46 ms window at once. The prediction error alone also stands out at the sound's own excitation, a voice's glottal pulses, a reed's or a bow's; the two-sided error (the prediction error through its matched filter, Vaseghi & Rayner 1990) holds those back by √Σa² against its spread and lifts an impulse added to the sound by as much, so crackle is where both stand over `threshold` × their local level: per 1.5 ms block the median |error|, the median of those over ±12 ms, which crackle can't raise until it fills half the samples of half the blocks. All flagged samples of a window are solved together by exact least-squares AR interpolation ([`lpc`](https://github.com/audiojs/denoise/tree/main/packages/lpc)'s `arFill`, Janssen 1986 / Godsill-Rayner 1998), so a neighbouring impulse is never taken for sound. Then it looks again on the rebuilt sound, the models fitted to it, until no new impulse stands out (Vaseghi & Rayner's iteration): with the largest gone, the smaller ones show; a new one must stand out of the input too, so a rebuild's own departures are never taken for crackle. Samples no crackle reaches come back bit-exact.
275
414
 
276
415
  ```js
277
- decrackle(data, { threshold: 3 })
416
+ decrackle(data, { fs: 44100 })
278
417
  ```
279
418
 
280
- **Use when:** shellac / 78 RPM crackle; persistent low-amplitude clicks.
419
+ | Param | Default | |
420
+ |---|---|---|
421
+ | `threshold` | `4` | how far over each error's local level an impulse stands, multiples |
422
+ | `order` | `32` | AR order of the detection |
423
+ | `fs` | `44100` | sample rate, Hz |
424
+
425
+ `node scripts/decrackle.js` adds crackle to speech (audio-lena; 8 VoiceBank+DEMAND test utterances), music ("Vibe Ace", Brahms, the trumpet loop, as `repair`) and a sung vibrato (VocalSet), 6 s of each: impulses at random times, half 1–3 samples off, half ticks ringing at 2–8 kHz for 0.03–0.15 ms, each peaking at a fifth to all of 0.5, 2 or 8× the sound's RMS. It measures the SDR to the clean sound, input → decrackle · FFmpeg `adeclick` at its defaults, the mean over the six:
426
+
427
+ | crackle, peaks × RMS | 50/s | 200/s | 1000/s |
428
+ |---|---:|---:|---:|
429
+ | small (0.1–0.5×) | 38.7 → 44.2 · 32.1 | 32.7 → 38.3 · 31.1 | 25.8 → 30.2 · 27.5 |
430
+ | medium (0.4–2×) | 26.7 → 36.4 · 30.7 | 20.8 → 29.6 · 28.0 | 13.8 → 20.8 · 20.3 |
431
+ | loud (1.6–8×) | 14.8 → 29.2 · 26.1 | 8.6 → 21.8 · 19.7 | 1.7 → 12.0 · 8.7 |
432
+
433
+ Of the 54 cases, `adeclick` does better in 16: 8 of the sung vibrato's (by 0.1–4.9 dB, most with loud crackle at 50/s: 24.2 · 29.1), 8 of speech and Brahms by 0.3–1.4 dB; `decrackle` in the rest, by up to 22 dB (the trumpet, small crackle at 50/s: 48.6 · 26.7). The clean sound through it: audio-lena 0.01% of the samples changed, to −66 dB; VoiceBank 0.22%, −41 dB; the music 0.01–0.12%, −52 to −74 dB; the song 0.02%, −67 dB (`adeclick`: 1.9–8.5%, −26 to −47 dB). 0.1.7 (2.5 × its window's MAD, 30 Gauss-Seidel sweeps of the fill) made small crackle worse than it found it (38.7 → 21.9 dB at 50/s, the trumpet to 5.6) and changed 3.7–10% of the clean samples (the trumpet to −5.5 dB, speech to −21 dB). `threshold: 3` takes 0.6–2.5 dB more of medium and loud crackle (1000/s: 22.1 and 14.5 dB) and trails `adeclick` on the song alone, but changes up to 0.56% of the clean samples, to −40.5 dB, the trumpet above 8 kHz by as much as is in it. 10 s in 0.1–0.5 s clean, 1–4 s crackled (0.1.7: 4–11 s).
434
+
435
+ **Use when:** shellac / 78 RPM crackle; a worn LP's surface noise; dense small ticks under music or speech.<br>
436
+ **Not for:** loud isolated clicks and pops (use `declick`); long dropouts (use `repair`).
281
437
 
282
438
 
283
439
  ### `declip`
284
440
 
285
- Detects runs of samples at ±`clipLevel`, fits AR on the un-clipped neighbourhood, extrapolates a sign-constrained interpolation.
441
+ Finds where a sound was cut flat and rebuilds what the cut took off. A hard clip piles every sample it cuts onto one level, its rail. Each side's rail is the sound's extreme there, taken when the samples within 0.1 % of it outnumber those in the next 0.1 % below tenfold and most of them sit in runs: the top-bin test of FFmpeg's `adeclip` (1000 bins, ratio 10), made relative to the rail so it holds at any level (and never finer than one step of a 16- or 24-bit grid), and per side, so one rail or two different ones are found. A loud peak is one sample; a limiter's ceiling is touched by single samples or by arches, and a sine's top is an arch, which fill the band below about as densely: sound with no rail comes back bit-exact. Then, per window of 186 ms (hop half, crossfaded), every sample at a rail is unknown at once: AR(256) fitted to the window under its taper, all of them solved by exact least squares ([`lpc`](https://github.com/audiojs/denoise/tree/main/packages/lpc)'s `arFill`), each held at least as far out as it was recorded (a clip only ever lowers a sample: the consistent set of A-SPADE, Kitić, Bertin & Gribonval 2015), the model refitted to the filled window and the solve repeated, 8 times (Janssen, Veldhuis & Vries 1986). Runs of any length; samples off the rails come back bit-exact.
286
442
 
287
443
  ```js
288
- declip(data, { clipLevel: 0.95 }) // explicit threshold
289
- declip(data) // auto-detects clip level
444
+ declip(data, { fs: 44100 }) // each side's rail found; none: untouched
445
+ declip(data, { fs: 44100, clipLevel: 0.95 }) // a known rail, ±0.95
290
446
  ```
291
447
 
292
448
  | Param | Default | |
293
449
  |---|---|---|
294
- | `clipLevel` | auto | Detected from histogram of \|x\| > 0.5 |
295
- | `order` | `100` | AR model order |
296
- | `maxRun` | `order/2` | Longest run that gets restored |
450
+ | `clipLevel` | auto | the rail, ± this; omitted or 0: found per side |
451
+ | `order` | `256` | AR order of the rebuild; `512` takes dense music up to 2 dB closer and speech further, in about 3× the time |
452
+ | `fs` | `44100` | sample rate, Hz |
453
+
454
+ `node scripts/declip.js` clips speech (audio-lena) and music ("Vibe Ace", Brahms, the trumpet loop, as `repair`), 6 s of each, peak-normalized and cut at the level that leaves the clipped sound 3–20 dB from the original (the input SDR of the declipping survey, Záviška, Rajmic, Ozerov & Rencker 2021), and measures the SDR after, dB, declip (finding the rails itself) · FFmpeg `adeclip` at its defaults:
455
+
456
+ | input SDR | 3 dB | 7 dB | 10 dB | 15 dB | 20 dB |
457
+ |---|---:|---:|---:|---:|---:|
458
+ | speech | 11.6 · 5.0 | 24.2 · 12.1 | 31.2 · 16.9 | 37.7 · 24.0 | 42.4 · 30.5 |
459
+ | "Vibe Ace" | 9.3 · 5.0 | 15.6 · 10.3 | 19.7 · 14.0 | 26.5 · 19.9 | 32.9 · 24.6 |
460
+ | Brahms | 8.5 · 3.9 | 16.1 · 10.2 | 20.0 · 14.4 | 26.4 · 19.8 | 34.0 · 23.8 |
461
+ | trumpet | 15.1 · 4.1 | 31.4 · 10.4 | 45.6 · 14.8 | 46.1 · 21.4 | 59.0 · 25.0 |
297
462
 
298
- **Use when:** hard digital clipping with short clip runs.<br>
299
- **Not for:** sustained clipping covering many cycles (use sparsity-based methods).
463
+ A-SPADE as the survey's code runs it (`--spade`: 186 ms blocks, a twice-redundant DFT, s = r = 1, ε = 0.1): speech 9.7 / 22.4 / 27.6 / 33.7 / 37.7, "Vibe Ace" 13.2 / 19.0 / 24.4 / 29.0 / 33.0, Brahms 12.9 / 18.0 / 21.0 / 26.3 / 31.8, the trumpet 17.7 / 31.4 / 37.2 / 49.8 / 57.0: ahead of declip in 9 of the 15 music cases, by 1.0–4.7 dB (each at 3 dB, "Vibe Ace" up to 15 dB), within 0.1 dB in 3, behind in 3 (the trumpet at 10 dB by 8.4); behind it on speech at every level, by 1.8–4.7 dB; in 27–65 s per second of sound. VoiceBank+DEMAND's test set, every 20th utterance clipped to 10 and 20 dB: declip 19.8 and 32.4 dB, `adeclip` 16.0 and 28.2.
464
+
465
+ Rails are found at the 20 dB level clipped asymmetrically (with the 10 dB level below), on one side only, then turned down to 0.4, quantized to 16 bits plain or dithered, and on a 16-bit converter driven 2.5 dB over (rails at 32767 and −32768): 10 dB or more of SDR gained in each. The unclipped material through it, as it is, peak-normalized, at 16 bits and through a lookahead limiter 12 dB over its ceiling: not a sample changed; nor in any of VoiceBank+DEMAND's 824 clean test utterances. 0.1.7 took the most populated level over half scale for the rail: on unclipped sound peaking over it, a limiter at half scale (151–43,538 samples changed per 6 s; the overdriven converter's Brahms 41.1 → 21.3 dB), while clipping at other levels it mostly left as it was (3–20 dB in, the same out). It takes about 0.1 s per second of sound clipped at the 20 dB level, 0.5 s at 10 dB, 5 s at 3 dB (`adeclip`: 0.07, 1.3 and 23 s on the same machine).
466
+
467
+ **Use when:** digital clipping: a converter overdriven, a mix bounced too hot, a plug-in's hard clip; at any level, on either side or both.<br>
468
+ **Not for:** clipping that has since been through lossy coding or resampling (the plateau is no longer flat, and no rail is found); soft saturation, tape or tube, which has no rail.
300
469
 
301
470
 
302
471
  ## Reverb
303
472
 
304
473
  ### `dereverb`
305
474
 
306
- Late reverberation off speech by weighted prediction error, WPE (Nakatani et al. 2010), in its recursive form (Yoshioka & Nakatani 2012). In each STFT bin, what the frames 30 to 130 ms back predict of the current one is the room's tail, and is subtracted. The prediction is fitted with each frame weighted by its inverse power, so it takes what the room adds, not the speech's own correlation. A linear filter per bin: no decay time to estimate, no gain floor, no musical noise. It adapts within about a second; each frame leaves through the filter a quarter second later has learned (`lookahead`), so a take's first words are cleaned too.
475
+ Late reverberation off a voice, one microphone, the whole take at once. First weighted prediction error, WPE (Nakatani et al. 2010): in each STFT bin, what the frames 50 to 160 ms back predict of the current one is the room's tail, and is subtracted; the prediction is fitted over the whole take, each frame weighted by its inverse power, three times. The room is one for the take and the voice is not, so the fit learns the room. One microphone cannot invert a room, and the prediction cancels a dB or two of the tail; but its taps measure the room. The power they carry from the past into a frame is the late reverberation's power, which Lebart et al. (2001) and Habets (2010) model from a decay time and a direct-to-reverberant ratio: here neither is estimated, and on a dry voice the taps are near zero. A log-spectral-amplitude gain (Ephraim & Malah 1985) takes that power off what WPE left, floored at −14 dB, and no bin leaves louder than it came. Below 500 Hz the estimate falls 3 dB an octave: there a voice's harmonics hold their phase longest and the taps learn some of them as room. A bin cut to digital silence (an edit, a gate) is left out of the fit. About 0.1 s per second of 48 kHz sound.
307
476
 
308
477
  ```js
309
478
  dereverb(data, { fs: 48000 })
479
+ dereverb(data, { fs: 48000, strength: 0.5 }) // a lighter hand
310
480
  ```
311
481
 
312
482
  | Param | Default | |
313
483
  |---|---|---|
314
- | `lookahead` | `0.25` | s the filter learns past each frame before it leaves; the latency grows by it (0: the frame's alone, 32 to 46 ms) |
484
+ | `strength` | `1` | Scale of the late-reverberation estimate: 0 is the linear prediction alone, 2 takes more of the tail and more of the voice |
485
+
486
+ Measured (`python scripts/dereverb.py`, test set): 42 VoiceBank test utterances (1.6–5.9 s), and four 41–60 s takes of ten utterances by one speaker, in 19 MIT IR Survey rooms the tuning never heard (T60 0.38–1.85 s). Each room's response is split at direct + 50 ms: under it, the voice as the room colours it; over it, the tail to take. Voice lost: the output's power where the voice is 10 dB over the tail; tail taken: where the tail is 10 dB over the voice. PESQ and STOI against the dry take; SRMR (Falk et al. 2010) higher is drier; DNSMOS at the input's loudness; a dry voice through it, PESQ. 0.2 → 0.3:
487
+
488
+ | | voice lost dB | tail taken dB | PESQ | STOI | SRMR | OVRL | dry voice, PESQ |
489
+ |---|---|---|---|---|---|---|---|
490
+ | short takes in | | | 1.39 | 0.774 | 3.98 | 2.19 | 4.64 |
491
+ | short, `dereverb` | −0.32 → −0.81 | −1.7 → **−6.2** | 1.45 → **1.50** | 0.793 → 0.768 | 4.56 → **6.90** | 2.28 → **2.47** | 4.42 → 4.25 |
492
+ | long takes in | | | 1.37 | 0.739 | 3.43 | 1.98 | 4.64 |
493
+ | long, `dereverb` | −0.13 → −0.25 | −1.1 → **−3.3** | 1.43 → **1.49** | 0.756 → 0.749 | 3.83 → **4.99** | 2.03 → **2.43** | 4.58 → 4.58 |
494
+
495
+ `strength` 0, 1, 2, 4: on the short takes the tail −1.4, −6.2, −7.7, −9.0 dB for the voice −0.12, −0.81, −1.18, −1.64, a dry voice's PESQ 4.51, 4.25, 4.17, 4.10; on the long ones the tail −0.9, −3.3, −4.5, −6.0 for the voice −0.02, −0.25, −0.41, −0.65. A sung voice passes (VocalSet: SI-SDR 19.4 → 35.3 dB, 125–250 Hz −2.55 → −0.45 dB). STOI falls 0.025 on the short takes, the gain's cost; PESQ, SRMR and DNSMOS rise.
315
496
 
316
- **Use when:** speech in a room, one microphone.<br>
317
- **Not for:** music or anything holding a steady pitch: a steady tone is predictable, and taken (a held note with vibrato loses 13 dB). Noise: denoise first.
497
+ 0.2 fitted the prediction recursively, over its last second: it learned some of the voice as room (−0.32 dB of the voice for 1.7 dB of the tail), and alone it cannot take much more (at 30 taps, about 4 dB of the tail for 0.6 dB of the voice). Late-reverb subtraction at each room's measured T60 (Lebart; Habets's κ) took 6 dB for −0.4 dB of the voice on the training takes, but it needs the T60, which free-decay estimates did not give on 3 s takes (correlation −0.3 to 0.2 with the measured one), and it took a dry voice for a room (PESQ 3.7). DeepFilterNet3 (`@audio/neural-denoise`), a denoiser that also learned to take reverberation, took 6.6–8.1 dB of the tail on the training takes and 2.1–2.9 dB of the first 50 ms, early reflections with the tail: PESQ 1.71–1.74 against 1.70 here, STOI 0.84 against 0.82.
498
+
499
+ **Use when:** a voice in a room, one microphone, one room per take.<br>
500
+ **Not for:** music or anything holding a pitch: a held note is predictable, and taken for room (music loses 2–5.5 dB under 1 kHz; 0.2 lost 1–4.3). Noise: denoise first.
318
501
 
319
502
 
320
503
  ## Pitch drift
321
504
 
322
505
  ### `dewow`
323
506
 
324
- Wow & flutter correction. Estimates the transport speed curve — from stable spectral partials tracked with a phase vocoder (McAulay–Quatieri linking, amplitude-weighted median across tracks), from a known reference tone (mains hum, calibration tone, tape bias residual), or from monophonic pitch — then reads the signal back through a variable-rate windowed-sinc resampler along the integrated curve. Whole-signal (needs the full curve), length-preserving by default. The classical counterpart of Celemony Capstan; `wowFlutter()` alone is a wow & flutter meter.
507
+ Wow & flutter correction. A speed change of the disc or tape moves every frequency in the recording by one ratio at one instant; a singer's vibrato, a glide or a melody moves one note and its harmonics. dewow tracks the partials (phase-vocoder frequency over a 0.19 s frame), cuts them into steady pieces, and fits Godsill & Rayner's speed model (*Digital Audio Restoration*, 1998, ch. 8) with each piece's centre tied to its pitch class: music reuses its pitches, so every return of a note measures the speed, where free centres let errors add up along the chain of overlapping notes. Harmonics of a note count as one source; a hop counts where two independent sources agree. Of that curve it applies only what a second test proves: a disc's wow, a sinusoid at a turntable's rotation (33⅓, 45 or 78 rpm within 4 %, or its 2nd harmonic), fitted to the partials and kept where its amplitude stands 4.5 times over its own bootstrapped noise, holds from one half of its 20 s window to the other and reaches 0.1 %. A pilot tone running through the recording (above 5 kHz) is read instead, flutter too; `mode: 'reference'` reads a tone given or found (a pilot, a calibration tone, mains hum). The sound is read back through a variable-rate windowed sinc. Nothing proven, nothing changed: the clip comes back bit-exact. Whole-signal, length-preserving. `wowFlutter()` alone is the meter.
325
508
 
326
509
  ```js
327
- dewow(data, { fs }) // partial tracking (default)
328
- dewow(data, { fs, mode: 'reference', refFreq: 50 }) // lock to 50 Hz hum
329
- dewow(data, { fs, wow: true, flutter: false }) // remove slow drift only
330
- wowFlutter(data, { fs }) // → { speed, times, wow, flutter, confidence }
510
+ dewow(data, { fs }) // a disc's wow from the music; a pilot tone if there is one
511
+ dewow(data, { fs, mode: 'reference' }) // the tone found: a pilot, else 50/60 Hz hum
512
+ dewow(data, { fs, mode: 'reference', refFreq: 1000 }) // a 1 kHz calibration tone
513
+ wowFlutter(data, { fs }) // → { speed, times, wow, flutter, lines, reference, confidence }
331
514
  ```
332
515
 
333
516
  | Param | Default | |
334
517
  |---|---|---|
335
- | `mode` | `'partial'` | `'partial' \| 'reference' \| 'pitch'` |
336
- | `refFreq` | — | Hz — the known tone for `reference` mode |
337
- | `smooth` | `0.05` | s — flutter-band smoothing of the speed curve |
338
- | `wow` / `flutter` | `true` / `true` | correct the < 6 Hz / 6–43 Hz bands |
518
+ | `mode` | `'partial'` | `'partial' \| 'reference' \| 'pitch'` (`pitch`: one voice's f0 against its own trend; takes its vibrato for speed) |
519
+ | `refFreq` | found | Hz — the tone for `reference`; omitted: a pilot above 5 kHz, else 50/60 Hz hum |
520
+ | `smooth` | `0.05` | s — splits the curve into wow (slower) and flutter |
521
+ | `wow` / `flutter` | `true` / `true` | correct each part |
339
522
  | `maxDeviation` | `0.05` | clamp on the speed ratio (±5 %) |
523
+ | `minTrack` | `0.2` | s — shortest steady piece of a partial used (`partial`) |
524
+ | `minFreq` / `maxFreq` | `50` / `2000` | Hz — where partials (`partial`) or the f0 (`pitch`) are looked for |
340
525
  | `keepLength` | `true` | output length equals input |
341
526
 
342
- Measured on synthetic 2 % wow @ 0.8 Hz + 0.4 % flutter @ 30 Hz over a sustained chord: curve correlation 0.98, residual deviation of the 440 Hz partial 1.4 % → 0.18 %; clean input passes at 44 dB SNR.
527
+ `node scripts/dewow.js` reads clean speech (audio-lena, two Spoken Wikipedia narrations), music ("Vibe Ace", "Dance of the Sugar Plum Fairy", Brahms' Hungarian Dance No. 5, a trumpet loop, three GuitarSet takes, six MUSDB18 and four BabySlakh mixes) and singing (five VocalSet excerpts) at a varying speed — a disc turning off-centre at 33⅓, 45 or 78 rpm, or tape's random wow (0.5–6 Hz) — at 0.3, 1 and 2 % peak, and measures the pitch error left on the audio itself (local lag against the clean sound, differentiated; cents RMS, mean over clips; doing nothing leaves the wow):
528
+
529
+ | | wow | 0.3 % | 1 % | 2 % |
530
+ |---|---|---:|---:|---:|
531
+ | music | disc 33⅓ | 3.7 → 1.7 | 12.2 → 2.1 | 24.5 → 4.3 |
532
+ | | disc 45 | 3.7 → 1.6 | 12.2 → 3.0 | 24.5 → 6.0 |
533
+ | | disc 78 | 3.7 → 1.2 | 12.2 → 2.9 | 24.5 → 13.4 |
534
+ | | tape | 1.4 → 1.4 | 4.6 → 4.6 | 9.2 → 9.2 |
535
+ | speech, singing | any | unchanged | unchanged | unchanged |
536
+ | steady notes (C4 E4 G♯4 D5) | disc 33⅓ / 45 / 78 | 3.7 → 0.0 / 0.1 / 0.1 | 12.3 → 0.1 / 0.2 / 0.5 | 24.6 → 0.3 / 0.5 / 0.9 |
537
+ | | tape | 1.3 → 1.3 | 4.5 → 4.5 | 9.0 → 9.0 |
538
+
539
+ The longer the recording, the more turns of the disc and returns of each note it holds: on whole pieces (`node scripts/dewow.js whole`) disc wow at 33⅓ rpm comes out of the Sugar Plum Fairy (120 s) at 0.4, 0.6 and 0.8 cents from 3.7, 12.2 and 24.5; of "Vibe Ace" (61 s) at 0.6, 1.0 and 1.9; of the Brahms (46 s, strings with vibrato) at 3.0, 2.4 and 3.2. Flutter (random, 6–30 Hz, 0.1 % peak, over 1 % tape wow) is not read from the music; a 19 kHz pilot 40 dB under the program, found by itself, reads it all: 4.2–4.5 → 0.1 cents on speech, music and singing. 50 Hz hum 30 dB down is a poor reference where the program has its own energy at 50–100 Hz: singing 4.3 → 2.2, speech 4.3 → 3.7, music 4.4 → 4.2 (`reference`).
343
540
 
344
- **Use when:** tape, cassette, vinyl and film transfers with audible pitch wobble; material with sustained tones or a reference tone.<br>
345
- **Not for:** dropouts, azimuth/time-skew, material with no stable partials (percussion-only); flutter above `fs/(2·hopSize)` ≈ 43 Hz at defaults needs a smaller `hopSize`.
541
+ Clean, every clip comes back bit-exact: 25 tuning and 19 held-out clips, the 504 clean VoiceBank+DEMAND training and 824 test utterances, a vibrato voice (±50 cents at 5.5 Hz), a 220 → 330 Hz glide, a vibrato voice over steady notes. With wow, no clip came out worse. Held out (never tuned on: two narrations, six MUSDB18 test mixes, three GuitarSet takes, four BabySlakh mixes, four VocalSet singers), music under disc wow at 0.3 / 1 / 2 %: 33⅓ rpm 3.7 → 2.3, 12.2 → 2.8, 24.5 → 6.9; 45 rpm 1.9, 2.8, 7.7; 78 rpm 2.0, 5.7, 17.6. 0.2 on the tuning music: 33⅓ rpm 3.7 → 3.6, 12.2 → 10.5, 24.5 → 18.0, 3 of 17 clean clips moved and 4 tape cases made worse (held out: 12.2 → 11.4 at 1 %); it did correct steady notes under random tape wow (4.5 → 0.5 cents), which 0.3 leaves. What dewow cannot do, measured: random tape wow, read from the music alone, is left — over a few seconds the notes' own pitch movement is as large as the wow, and no test told the two apart without also passing a voice's intonation; one voice or instrument alone gives no evidence, so speech and singing are corrected only through a tone; a clip under 5 s is never corrected from the music.
542
+
543
+ **Use when:** disc transfers (33⅓, 45, 78 rpm) of music with more than one voice, the record off-centre or warped; any transfer with a pilot tone (found by itself) or a calibration tone (`reference`).<br>
544
+ **Not for:** random tape wow read from the music alone (left as it is); a solo voice or instrument without a tone to read; dropouts; azimuth/time-skew.
346
545
 
347
546
 
348
547
  ## Gates & inter-word
@@ -361,18 +560,46 @@ gate(data, { threshold: -45, attack: 0.005, release: 0.1, hold: 0.05, lookahead:
361
560
 
362
561
  ### `debreath`
363
562
 
364
- VAD-driven inverse gate. Uses energy + spectral flatness with a percentile-based noise floor; attenuates frames classified as non-speech with smooth attack/release.
563
+ VAD-driven inverse gate: what [`vad`](#lower-level-building-blocks) does not call speech (breaths, mouth noise, the room between phrases) goes down by `range`. Speech is voicing and the sound over the noise floor next to it, so a soft word in noise stays and a breath that a pause parts from the phrase goes. A gap under 0.15 s is no breath (a breath lasts 0.15–0.6 s, Ruinskiy & Lavner 2007) and stays; the gain holds 50 ms past speech. The whole clip is read at once (streaming: false), so the gain is zero-phase: it rises over `attack` before speech starts and falls over `release` after it ends.
365
564
 
366
565
  ```js
367
- debreath(data, { range: -10 }) // -10 dB on non-speech (default -12)
566
+ debreath(data, { range: -10 }) // -10 dB between phrases (default -12)
368
567
  ```
369
568
 
370
- **Use when:** breath, mouth noise, hiss in pauses on a voiceover.
569
+ | Param | Default | |
570
+ |---|---|---|
571
+ | `range` | `-12` | dB — how far everything between phrases goes down |
572
+ | `attack` | `0.005` | s — the gain rises over this before speech starts |
573
+ | `release` | `0.1` | s — and falls over this after speech ends |
574
+
575
+ `snrTh` and `flatTh` (0.1) are gone: they tuned the old detector, whose floor was the 10th-percentile frame energy of the whole input. Under noise that percentile is the noise, and every word under 9 dB over it went down. Measured with `python scripts/vad.py` (VoiceBank+DEMAND test set, ten Spoken Wikipedia narrations; defaults chosen on the training subset and ten other narrations), 0.1.8 → 0.2.1, frames turned down by over 3 dB:
576
+
577
+ | | voiced | word edges |
578
+ |---|---:|---:|
579
+ | VoiceBank+DEMAND, 824 noisy | 5.87 → **0.06** % | 24.55 → **0.30** % |
580
+ | the same, clean | 0.03 → 0.09 % | 1.22 → **0.60** % |
581
+ | 10 narrations | 0.07 → 0.05 % | 0.23 → 0.03 % |
582
+
583
+ Breaths (350 ms of noise through three wide resonances, 500/1500/2500 Hz) put into the narrations' pauses, ending G before the next phrase, 35 and 25 dB under the speech: median gain, share turned down by 6 dB or more.
584
+
585
+ | G | −35 dB | −25 dB |
586
+ |---|---|---|
587
+ | 0.05 s | −6.6 dB, 53 % → **−11.1 dB, 55 %** | −0.2 dB, 45 % → 0.0 dB, 13 % |
588
+ | 0.15 s | −2.9 dB, 44 % → **−11.7 dB, 81 %** | −0.1 dB, 44 % → **−11.4 dB, 74 %** |
589
+ | 0.3 s | −4.0 dB, 50 % → **−11.8 dB, 75 %** | −3.2 dB, 50 % → **−11.8 dB, 69 %** |
590
+ | 0.5 s | −11.5 dB, 55 % → **−12.0 dB, 91 %** | −11.5 dB, 55 % → **−11.6 dB, 73 %** |
591
+
592
+ A breath within 0.3 s of a vowel, parted from it by less than 0.15 s, reads as the word's onset and stays: that is where consonants lie, parted from the vowel at most by a stop's closure. A loud breath that close to a phrase went down more often before (45 → 13 %), and so did a quarter of the word edges in noise.
593
+
594
+ Noise after speech goes down: 1.5 s of noise after 1.5 s of a VoiceBank utterance, frames from 0.4 s on turned down by 6 dB or more, white, pink and brown 94 %, the office 99 %; noises with talkers in them (bus, cafe, public square) stay, as speech. 0.2.0 kept white and pink noise after speech whole (its VAD read voicing off the Wiener estimate, which peaks on any noise). Music, frames within 30 dB of the loudest turned down by over 3 dB: Vibe Ace 37.4 → 0.67 %, Nutcracker 22.1 → 0 %, trumpet 0 → 0 %, four sung excerpts (VocalSet) up to 21.6 → up to 0.39 %, but Brahms (strings) 4.29 → 9.35 %: an orchestra raises its own floor (0.2.0: 0.02 %).
595
+
596
+ **Use when:** breath, mouth noise, hiss in pauses on a voiceover.<br>
597
+ **Not for:** a breath that runs into a word; whispered speech (it holds no voicing: it goes down whole).
371
598
 
372
599
 
373
600
  ### `desilence`
374
601
 
375
- VAD-driven silence editing. Runs `vad` once, folds frames into speech/pause segments, then cuts pauses per `mode` with equal-power crossfades at every splice — never a hard cut. Length-changing, so it is a batch call (and a `silence` stat atom), not a streaming processor.
602
+ VAD-driven silence editing. Runs [`vad`](#lower-level-building-blocks) once (voicing, and the sound over a tracked noise floor next to it: noise, breaths and room tone between phrases are pause, a quiet word in noise is not), folds frames into speech/pause segments, then cuts pauses per `mode` with equal-power crossfades at every splice — never a hard cut. Length-changing, so it is a batch call (and a `silence` stat atom), not a streaming processor.
376
603
 
377
604
  ```js
378
605
  desilence(data, { mode: 'shorten', maxSilence: 0.25 }) // Overcast "Smart Speed": long pauses → 0.25 s
@@ -393,8 +620,18 @@ splitSilence(data, { fs }) // → one Floa
393
620
 
394
621
  Returns `{ data, segments, removed, map }`; `project(map, t)` re-times markers/subtitles (`@audio/subtitle` `project()` takes the same map).
395
622
 
623
+ 0.1 read silence under 11 dB over the input's 10th-percentile frame energy: under noise that percentile is the noise, and whole words went. Measured with `python scripts/vad.py` (as `debreath` above), `shorten` at its defaults, 0.1.1 → 0.2.1, frames cut:
624
+
625
+ | | voiced | word edges | removed |
626
+ |---|---:|---:|---:|
627
+ | VoiceBank+DEMAND, 824 noisy | 3.89 → **0.02** % | 3.93 → **0.08** % | 290 → 40 of 2072 s |
628
+ | the same, clean | 0.00 → 0.05 % | 0.01 → 0.19 % | 167 → 156 s |
629
+ | 10 narrations | 0.00 → 0.04 % | 0.00 → 0.03 % | 50 → 56 of 600 s |
630
+
631
+ Breaths in the narrations' pauses (as above) ending 0.3 s before the next phrase: 56 → 75 % of each removed at −35 dB, 50 → 69 % at −25 dB. Noise after speech is a pause (0.2.0 read white or pink noise there as speech and cut none of it). Music, frames within 30 dB of the loudest cut: Vibe Ace 10.5 → 0.5 %, Nutcracker 16.8 → 0 %, sung (VocalSet m8) 25.3 → 0 %, but Brahms (strings) 3.5 → 9.1 % (0.2.0: 0.02 %).
632
+
396
633
  **Use when:** podcast/lecture pause tightening, split-by-silence, auto-trim.<br>
397
- **Not for:** music (a rest is a pause to this VAD); overlapping speech.
634
+ **Not for:** music (a rest is a pause to this VAD); overlapping speech; whispered speech (no voicing: it reads as pause).
398
635
 
399
636
 
400
637
  ## Quality measurement
@@ -427,7 +664,7 @@ import { noiseProfile, minStats, imcra } from '@audio/denoise'
427
664
  ```
428
665
 
429
666
  - **`stft*`** — analysis-modification-synthesis with Hann + ∑win² OLA reconstruction. Visit `(mag, phase, state, ctx) => { mag, phase }`.
430
- - **`vad`** — frame-level activity (energy + spectral flatness, percentile floor).
667
+ - **`vad`** — frame-level speech: Sohn's likelihood ratio over a minimum-statistics noise floor, anchored on voicing ([`@audio/vad`](packages/vad)).
431
668
  - **`spp`** — per-bin Speech Presence Probability under Gaussian model.
432
669
  - **`ddSnr`** — decision-directed a-priori SNR (Ephraim-Malah).
433
670
  - **`noiseProfile`** — average PSD over leading frames.
@@ -441,7 +678,7 @@ import { noiseProfile, minStats, imcra } from '@audio/denoise'
441
678
 
442
679
  | scenario | SNR-in | best method | SNR-out | NRR | ms |
443
680
  |---|---:|---|---:|---:|---:|
444
- | 60 Hz hum + harmonics | -5.2 dB | `dehum` | 15.3 dB | 6.3 dB | 5 |
681
+ | 60 Hz hum + harmonics | -5.2 dB | `dehum` | 40.4 dB | 6.4 dB | 65 |
445
682
  | white noise (~13 dB SNR) | 13.3 dB | `wiener` | 20.5 dB | 0.3 dB | 82 |
446
683
  | clicks (vinyl-style) | 24.1 dB | `declick` | 46.2 dB | — | 227 |
447
684
  | 7 kHz sibilance | 2.0 dB | `deesser` | 9.2 dB | 1.9 dB | 5 |
@@ -456,16 +693,43 @@ VoiceBank+DEMAND test set (Valentini-Botinhao 2017, CC BY 4.0), 824 utterances;
456
693
 
457
694
  | op, before → after | PESQ | STOI | SI-SDR dB | SIG | BAK | OVRL |
458
695
  |---|---|---|---|---|---|---|
459
- | `omlsa` | 1.88 → **2.40** | 0.870 → 0.916 | 5.4 → **14.5** | 3.07 → 3.38 | 3.15 → **3.49** | 2.51 → **2.86** |
460
- | `wiener` | 2.19 → 2.34 | 0.916 → 0.910 | 11.9 → 14.0 | 3.34 → 3.38 | 3.26 → 3.38 | 2.73 → 2.81 |
461
- | `specsub` | 2.11 → 2.24 | 0.921 → 0.920 | 10.4 → 12.5 | 3.29 → 3.35 | 3.12 → 3.32 | 2.66 → 2.77 |
696
+ | `omlsa` | 1.88 → **2.36** | 0.870 → 0.919 | 5.4 → **14.0** | 3.07 → 3.38 | 3.15 → **3.43** | 2.51 → **2.84** |
697
+ | `wiener` | 2.19 → 2.36 | 0.916 → 0.911 | 11.9 → 14.3 | 3.34 → 3.40 | 3.26 → 3.43 | 2.73 → 2.84 |
698
+ | `specsub` | 2.11 → 2.26 | 0.921 → 0.919 | 10.4 → 12.8 | 3.29 → 3.36 | 3.12 → 3.36 | 2.66 → 2.79 |
462
699
  | `dehum` (no hum here) | 1.78 → 1.97 | 0.907 → 0.921 | 6.5 → 8.4 | 3.29 → 3.32 | 3.08 → 3.11 | 2.65 → 2.68 |
463
700
 
464
- The same clean utterances in: PESQ 3.06 → 4.27 (`omlsa`), 3.97 → 4.03 (`wiener`), 4.30 → 4.05 (`specsub`, which now subtracts an unbiased noise estimate), 3.20 → 4.64 (`dehum`: no hum found, output equals input). Stationary white and pink noise alone, 8 s: `omlsa` takes it 15 dB down with log kurtosis ratio 0.00 (was +0.53 and +0.30), `wiener` 16 dB at +0.33 and +0.79 (was 10 dB at +0.93 and +1.35), `specsub` 12 dB at +0.65 and +1.36 (was 4 dB at +0.48 and +0.58). With mains hum 20 dB under the clean utterances (12 harmonics at −6 dB per octave, 0.05 Hz off nominal), `dehum` takes PESQ from 2.64 to 2.88 at 50 Hz and from 2.48 to 2.76 at 60 Hz (before: 2.54 and 2.19); alone, that hum goes 44.6 and 50.0 dB down (before: 10.3 dB at 50 Hz, nothing at 60).
701
+ The same clean utterances in: PESQ 3.06 → 4.29 (`omlsa`), 3.97 → 4.03 (`wiener`), 4.30 → 4.03 (`specsub`, which now subtracts an unbiased noise estimate), 3.20 → 4.64 (`dehum`: no hum found, output equals input). Stationary white and pink noise alone, 8 s: `omlsa` takes it 15 dB down with log kurtosis ratio 0.00 (was +0.53 and +0.30), `wiener` 15.5 dB at +0.53 and +1.01 (was 10 dB at +0.93 and +1.35), `specsub` 12 dB at +0.78 and +1.44 (was 4 dB at +0.48 and +0.58). With mains hum 20 dB under the clean utterances (12 harmonics at −6 dB per octave, 0.05 Hz off nominal), `dehum` takes PESQ from 2.64 to 4.17 at 50 Hz and from 2.48 to 4.26 at 60 Hz, SI-SDR from 20.0 to 39.1 and 41.5 dB, STOI to 0.998 (0.2.0's notches: PESQ 2.88 and 2.76, SI-SDR 23.8 and 24.2 dB); alone, that hum goes 110 and 87 dB down (0.2.0: 44.6 and 50.0).
702
+
703
+ Ten Spoken Wikipedia narrations, 60 s each (volunteers at home; raw OVRL 3.17): `omlsa` SIG 3.25 → 3.46 (raw 3.45), BAK 4.00 → 4.09, OVRL 2.96 → 3.20, speech level −1.1 → −0.04 dB, noise floor median −76 → −75 dBFS. Room tone stays: G<sub>min</sub> is 15 dB, so only a room already under −75 dBFS ends under −90 (one of the nine, raw −83).
704
+
705
+ In the rows above, `omlsa` 0.3 and `wiener` 0.3 take the decision-directed α per 8 ms of frame step, as their papers quote it, where it was per frame (the a priori SNR's memory ran 1.8× longer at 48 kHz than at 44.1); `omlsa`'s is the lowest per 8 ms that leaves steady noise free of musical noise, 0.97 tracking and 0.95 on a learned noise, `wiener`'s Ephraim & Malah's 0.98; `omlsa`'s G<sub>min</sub> is the floor; and minimum statistics (`wiener`, `specsub`; noise-estimate 2.2) starts its smoother on the mean of the first frames, not on one periodogram that left 2.6 % of bins 10 dB low for the first 1.5 s. Against 0.2 on the test set: `omlsa` PESQ 2.40 → 2.36, STOI 0.916 → 0.919, SI-SDR 14.5 → 14.0, SIG 3.39 → 3.38, OVRL 2.86 → 2.84; `wiener` 2.34 → 2.36, 0.910 → 0.911, 14.0 → 14.3, 3.38 → 3.40, 2.81 → 2.84; `specsub` 2.24 → 2.26, 0.920 → 0.919, 12.5 → 12.8, 3.35 → 3.36, 2.77 → 2.79 (chosen on the training subset, where tracked `omlsa` went STOI 0.826 → 0.832, PESQ 1.83 → 1.82). On a learned noise (`omlsa` with `profile`, as audio's `denoise` runs it, G<sub>min</sub> −12 dB, the noise learned from the lead-in): PESQ 2.48 → 2.45, STOI 0.915 → 0.919, SIG 3.36 → 3.38, OVRL 2.89 → 2.88.
706
+
707
+ `omlsa` 0.4 reads the speech absence from the a priori SNR smoothed in the cepstrum, and on a learned noise the speech presence from γ averaged over neighbouring bins ([`omlsa`](#omlsa)). Chosen on the training subset; on the test set, once, 0.3 → 0.4, tracked: PESQ 2.362 → 2.364, STOI 0.919 → 0.920, SI-SDR 14.04 → 14.25 dB, SIG 3.382 → 3.384, BAK 3.43 → 3.47, OVRL 2.838 → 2.853, musical noise 0.49 → 0.48; on a learned noise (`node scripts/speech.mjs vbdemand omlsa-learned`, as audio's `denoise` runs it, 12 dB): 2.453 → 2.455, 0.919 → 0.920, 15.05 → 15.11, 3.380 → 3.367, 3.53 → 3.54, 2.875 → 2.874, 0.39 → 0.34. The clean utterances in: PESQ 4.288 → 4.287 tracked, 4.299 → 4.288 learned; steady white and pink noise alone 15 dB down at log kurtosis ratio 0.00 and 0.02. (The learned form was scored on the test set once before, its presence averaged over 64 ms of frames as the paper has it: PESQ 2.421, OVRL 2.885; the musical noise it left after music stops, measured on the training material, then took it to the frame alone.)
708
+
709
+ The open classical denoisers on the same 824, each given the noise as ours is: noisereduce 3.0.3 (stationary spectral gating, the lead-in as its noise clip) at 12 dB (`prop_decrease` 0.75): PESQ 2.409, STOI 0.921, SI-SDR 12.8, SIG 3.37, BAK 3.51, OVRL 2.861, musical noise 0.03; at full reduction 2.357, 0.910, 12.4, 3.22, 3.72, 2.825, 0.74; logmmse 1.5 (a port of Loizou's `logmmse.m`, noise from the lead-in, updated by its VAD) 2.350, 0.900, 14.7, 3.29, 3.52, 2.799, 0.73; FFmpeg 8.0.1's `afftdn` learning the lead-in, 12 dB: 2.048, 0.920, 8.6, 3.25, 3.14, 2.657, 0.20 (`anlmdn` at its defaults leaves the input as it is). Neural, for scale: DeepFilterNet3 limited to 12 dB 2.670, 0.939, 16.2, 3.49, 3.69, 3.026, 0.06; RNNoise 2.109, 0.890, 12.3, 3.28, 3.85, 2.935, 0.90. iZotope RX was not measured: no RX plug-in is installed where these ran.
710
+
711
+ Tried on the training subset and not taken: the cepstral a priori SNR as the gain's ξ as well (tracked SIG −0.04, music cut 9.6 → 15.6 %); Gerkmann & Hendriks's MMSE noise tracker (2012) in place of IMCRA (tracked PESQ +0.04, OVRL +0.03, but STOI −0.008, clean speech in PESQ 4.24 → 4.08, music cut 9.6 → 28.5 %) or of minimum statistics in `wiener` (PESQ 1.82 → 1.87, steady-noise musical noise 0.53 → 0.79, music cut 14.5 → 28.5 %); that tracker started on a learned print (RX's "adaptive": OVRL −0.04, musical noise 0.40 on pink noise); the cepstral ξ in `wiener` (STOI +0.014, SIG −0.06); the averaged presence in the tracked gain (PESQ +0.015, a word's second frame after a pause 0.7 dB lower); the gain smoothed over frequency, in dB or linear, ±100 Hz (musical noise 0.46 → 0.22–0.29, speech cut by more than 3 dB 9.5 → 25–38 %). With the noise known exactly (the true noise's periodogram, recursively smoothed) the learned form scores PESQ 2.11 on the training subset (1.87 with the print) and leaves musical noise of 0.01 (0.46): what remains to be had is in the estimate of a noise that changes, not in the gain.
712
+
713
+ What each keeps of the speech, by shadow filtering (`node scripts/broadband.mjs`: each frame's gain, computed on the noisy mix, applied to the clean speech and to the noise alone): a word's second and third frame after 85 ms of pause, in ten Spoken Wikipedia narrations under pink noise 10 dB down; speech 20–50 dB under the take's loudest frame, and bins where it stands 0–5 dB over the noise (the MMSE-optimal Wiener gain keeps −3.9 dB there), in the test set's every fourth utterance; the noise taken; the share of clean speech, and of clean music, cut by more than 3 dB. dB, `omlsa` 0.3 → 0.4 (`wiener` and `specsub` as they stand):
714
+
715
+ | op | onset +1 | onset +2 | quiet | 0–5 dB | noise, VB | noise, narr. | clean cut % | music cut % |
716
+ |---|---|---|---|---|---|---|---|---|
717
+ | `omlsa` | −8.9 → −6.1 | −4.8 → −3.5 | −2.0 → −2.1 | −3.6 → −3.6 | −6.7 → −7.0 | −7.5 → −7.6 | 0.3 → 0.3 | 9.6 → 9.9 |
718
+ | `omlsa`, learned noise | −6.1 → −4.8 | −2.7 → −2.6 | −3.0 → −3.0 | −7.9 → −4.6 | −8.3 → −8.1 | −8.4 → −7.3 | 0.4 → 0.4 | – |
719
+ | `wiener` | −5.4 | −2.4 | −2.1 | −3.7 | −7.1 | −7.1 | 0.7 | 14.5 |
720
+ | `specsub` | −1.5 | −0.3 | −1.9 | −3.9 | −4.8 | −5.8 | 0.3 | 10.3 |
721
+
722
+ The paper's α 0.92 kept more again (tracked, a word's second frame after a pause on the training narrations: −1.6 dB) but left musical noise on steady noise (log kurtosis ratio 0.99 and 1.81), as did the paper's q ≤ q<sub>max</sub> in place of the gate (0.24 and 0.46). Martin's time-varying optimal smoothing for minimum statistics kept more speech only by reading the noise low (pink noise 1.7 dB under; `wiener`'s noise taken on the training speech 5.0 → 3.8 dB, PESQ 1.79 → 1.73), and a −25 dB ξ<sub>min</sub> for `wiener` brought more musical noise (0.98 and 1.49) and lower PESQ and SIG: none was taken. Minimum statistics' fixed start costs clean music cut at the start of a take, where the first frame's low values used to hold the estimate down (music cut 12.5 → 14.5 % for `wiener`, all of it in the first 1.5 s of the 6 s trumpet loop, cut 8 → 20 % there; the other three tracks are unchanged). In the half second after music stops, `omlsa` on a learned noise leaves musical noise of 0.11 → 0.05 at G<sub>min</sub> −12 dB and 1.00 → 0.61 at −20 (0.3 → 0.4; 0.00 a second later). Its noise taken in all frames falls (narrations 8.4 → 7.3 dB) for what lies under the weak speech it now keeps; in pauses it is as before or more (training speech 9.7 → 10.1 dB).
723
+
724
+ The same test set at other rates (`vbdemand@RATE`), PESQ, STOI and OVRL, 0.2 → 0.3. At 16 kHz (8 ms steps) `wiener`'s α is as it was; at 22.05 and 44.1 kHz (5.8 ms) it rose per frame, 0.980 → 0.985, and its STOI fell 0.004:
465
725
 
466
- Ten Spoken Wikipedia narrations, 60 s each (volunteers at home; raw OVRL 3.17): `omlsa` SIG 3.25 → 3.46 (raw 3.45), BAK 4.00 → 4.09, OVRL 2.96 → 3.19, speech level −1.1 → −0.04 dB, noise floor median −76 → −75 dBFS. Room tone stays: G<sub>min</sub> is 15 dB, so only a room already under −75 dBFS ends under −90 (one of the nine, raw −83).
726
+ | op | 16 kHz | 22.05 kHz | 44.1 kHz | 48 kHz |
727
+ |---|---|---|---|---|
728
+ | `omlsa` | 2.42 → 2.41, 0.915 → 0.918, 2.87 → 2.85 | 2.42 → 2.44, 0.915 → 0.916, 2.86 → 2.86 | 2.42 → 2.44, 0.915 → 0.916, 2.86 → 2.86 | 2.40 → 2.36, 0.916 → 0.919, 2.86 → 2.84 |
729
+ | `wiener` | 2.36 → 2.39, 0.912 → 0.911, 2.82 → 2.85 | 2.37 → 2.40, 0.913 → 0.909, 2.82 → 2.86 | 2.37 → 2.40, 0.913 → 0.909, 2.82 → 2.86 | 2.34 → 2.36, 0.910 → 0.911, 2.81 → 2.84 |
730
+ | `specsub` | 2.25 → 2.27, 0.920 → 0.919, 2.75 → 2.77 | 2.23 → 2.25, 0.920 → 0.919, 2.74 → 2.76 | 2.23 → 2.25, 0.920 → 0.919, 2.74 → 2.76 | 2.24 → 2.26, 0.920 → 0.919, 2.77 → 2.79 |
467
731
 
468
- Frames follow the rate: the power of two nearest 32 ms, the papers' frame, where they were 2048 samples at every rate (128 ms at 16 kHz). The same test set resampled (`python scripts/speech.py resample vbdemand RATE`, then `vbdemand@RATE`), PESQ and OVRL, 2048 → rate's frame; 48 kHz keeps 2048:
732
+ Frames follow the rate: the power of two nearest 32 ms, the papers' frame, where they were 2048 samples at every rate (128 ms at 16 kHz). The same test set resampled (`python scripts/speech.py resample vbdemand RATE`, then `vbdemand@RATE`), PESQ and OVRL, 2048 → rate's frame (0.2); 48 kHz keeps 2048:
469
733
 
470
734
  | op | 16 kHz (512) | 22.05 kHz (512) | 44.1 kHz (1024) |
471
735
  |---|---|---|---|
@@ -475,18 +739,16 @@ Frames follow the rate: the power of two nearest 32 ms, the papers' frame, where
475
739
 
476
740
  STOI holds or rises for `wiener` and `specsub` and falls 0.001–0.002 for `omlsa`; SI-SDR falls 0.3–0.7 dB for `omlsa` and `wiener` at 22.05 and 44.1 kHz, and 0.8–1.2 dB for `specsub`, which alone prefers the longer frame there (so it did on the training subset).
477
741
 
478
- Reverberant speech (`vbreverb`): a quarter of the clean test utterances, 206, through 130 rooms of the MIT IR Survey (Traer & McDermott 2016; T60 from each response's decay, 500 Hz and 1 kHz: median 0.40 s, 55 utterances at 0.6 s or more), scored against the dry takes, DNSMOS at the input's loudness. `dereverb` before (0.1.10: late-reverb subtraction at an assumed T60 of 0.5 s) → now:
742
+ Reverberant speech (`vbreverb`): a quarter of the clean test utterances, 206, through 130 rooms of the MIT IR Survey (Traer & McDermott 2016), scored against the dry takes, DNSMOS at the input's loudness. `dereverb` 0.2 (recursive WPE) → 0.3; the rooms with a tail to hear are in [`dereverb`](#dereverb)'s own table:
479
743
 
480
744
  | | PESQ | STOI | SI-SDR dB | SIG | BAK | OVRL |
481
745
  |---|---|---|---|---|---|---|
482
746
  | reverberant input | 2.33 | 0.904 | −5.7 | 3.19 | 3.71 | 2.82 |
483
- | `dereverb` | 1.55 → **2.52** | 0.758 → **0.914** | −7.7 → **−5.2** | 2.27 → **3.22** | 3.85 → 3.73 | 2.08 → **2.85** |
484
- | T60 ≥ 0.6 s (55), input | 1.65 | 0.838 | −10.7 | 2.81 | 3.28 | 2.38 |
485
- | T60 ≥ 0.6 s, `dereverb` | 1.48 → **1.76** | 0.724 → **0.855** | −10.5 → **−10.0** | 2.25 → **2.88** | 3.76 → 3.37 | 2.03 → **2.45** |
747
+ | `dereverb` | 2.52 → **2.55** | 0.914 → 0.897 | −5.2 → −5.3 | 3.22 → **3.27** | 3.73 → **3.89** | 2.85 → **2.93** |
486
748
  | dry takes in (`vbreverb-dry`) | 4.64 | 1.000 | ∞ | 3.51 | 4.04 | 3.22 |
487
- | dry, `dereverb` | 1.60 → 4.37 | 0.812 → 0.999 | 2.6 → 27.5 | 2.46 → 3.50 | 3.92 → 4.03 | 2.27 → 3.21 |
749
+ | dry, `dereverb` | 4.37 → 4.24 | 0.999 → 0.997 | 27.5 → 28.2 | 3.50 → 3.49 | 4.03 → 4.05 | 3.21 → 3.21 |
488
750
 
489
- The old estimate summed every past frame's power though each already holds its own tail (about 6 dB over, then ×1.5), at a fixed T60, with a −26 dB floor: it took the direct sound itself. The prediction's length, delay, memory and look-ahead were chosen on the training utterances in the even-numbered rooms (`vbreverb-train`, 126: PESQ 2.36 → 2.56); longer prediction (160 ms) gained 0.04 PESQ there and cost 0.09 on dry takes. Late-reverb subtraction (Lebart et al. 2001) at each room's measured T60, the best a blind T60 estimator could do, scored below WPE there (PESQ 2.38–2.51, STOI down), and after it lowered WPE's scores: no T60 is estimated.
751
+ On the training utterances (`vbreverb-train`, 126): PESQ 2.36 → 2.56 → 2.57, OVRL 2.81 → 2.84 → 2.91. The constants were chosen on `scripts/dereverb.py train`: VoiceBank training speakers in the even-numbered rooms, 1.8–4.5 s utterances and 25–41 s takes.
490
752
 
491
753
 
492
754
  ## Demo
@@ -502,11 +764,17 @@ The old estimate summed every past frame's power though each already holds its o
502
764
  - Ephraim & Malah, *Speech Enhancement Using a Minimum Mean-Square Error Log-Spectral Amplitude Estimator*, IEEE TASSP 1985.
503
765
  - Martin, *Noise Power Spectral Density Estimation Based on Optimal Smoothing and Minimum Statistics*, IEEE TSAP 2001.
504
766
  - Martin, *Bias Compensation Methods for Minimum Statistics Noise Power Spectral Density Estimation*, Signal Processing 2006.
767
+ - Sohn, Kim & Sung, *A Statistical Model-Based Voice Activity Detection*, IEEE SPL 1999.
768
+ - Ruinskiy & Lavner, *An Effective Algorithm for Automatic Detection and Exact Demarcation of Breath Sounds in Speech and Song Signals*, IEEE TASLP 2007.
505
769
  - Scalart & Vieira Filho, *Speech Enhancement Based on a Priori Signal to Noise Estimation*, ICASSP 1996.
506
770
  - Cohen & Berdugo, *Speech Enhancement for Non-Stationary Noise Environments*, Signal Processing 2001.
507
771
  - Cohen, *Optimal Speech Enhancement Under Signal Presence Uncertainty Using Log-Spectral Amplitude Estimator*, IEEE SPL 2002.
508
772
  - Cohen, *Noise Spectrum Estimation in Adverse Environments: Improved Minima Controlled Recursive Averaging*, IEEE TSAP 2003.
509
773
  - Cohen, `omlsa.m` (OM-LSA with IMCRA), [israelcohen.com/software](https://israelcohen.com/software/).
774
+ - Breithaupt, Gerkmann & Martin, *A Novel A Priori SNR Estimation Approach Based on Selective Cepstro-Temporal Smoothing*, ICASSP 2008.
775
+ - Gerkmann, Breithaupt & Martin, *Improved A Posteriori Speech Presence Probability Estimation Based on a Likelihood Ratio With Fixed Priors*, IEEE TASLP 2008.
776
+ - Gerkmann & Hendriks, *Unbiased MMSE-Based Noise Power Estimation With Low Complexity and Low Tracking Delay*, IEEE TASLP 2012.
777
+ - Gerkmann & Hendriks, *Improved MMSE-Based Noise PSD Tracking Using Temporal Cepstrum Smoothing*, ICASSP 2012.
510
778
  - Uemura, Takahashi, Saruwatari, Shikano & Kondo, *Automatic Optimization Scheme of Spectral Subtraction Based on Musical Noise Assessment via Higher-Order Statistics*, IWAENC 2008.
511
779
  - Valentini-Botinhao, *Noisy Speech Database for Training Speech Enhancement Algorithms and TTS Models*, University of Edinburgh 2017, [doi:10.7488/ds/2117](https://doi.org/10.7488/ds/2117).
512
780
  - Reddy, Gopal & Cutler, *DNSMOS P.835*, ICASSP 2022.
@@ -515,8 +783,14 @@ The old estimate summed every past frame's power though each already holds its o
515
783
  - Lebart, Boucher & Denbigh, *A New Method Based on Spectral Subtraction for Speech Dereverberation*, Acta Acustica 2001.
516
784
  - Nakatani, Yoshioka, Kinoshita, Miyoshi & Juang, *Speech Dereverberation Based on Variance-Normalized Delayed Linear Prediction*, IEEE TASLP 2010.
517
785
  - Yoshioka & Nakatani, *Generalization of Multi-Channel Linear Prediction Methods for Blind MIMO Impulse Response Shortening*, IEEE TASLP 2012.
518
- - Caroselli, Shafran, Narayanan & Rose, *Adaptive Multichannel Dereverberation for Automatic Speech Recognition*, Interspeech 2017.
786
+ - Kinoshita, Delcroix, Nakatani & Miyoshi, *Suppression of Late Reverberation Effect on Speech Signal Using Long-Term Multiple-Step Linear Prediction*, IEEE TASLP 2009.
787
+ - Habets, *Speech Dereverberation Using Statistical Reverberation Models*, in Naylor & Gaubitch (eds.), Speech Dereverberation, Springer 2010.
788
+ - Polack, *Playing Billiards in the Concert Hall: The Mathematical Foundations of Geometrical Room Acoustics*, Applied Acoustics 1993.
789
+ - Falk, Zheng & Chan, *A Non-Intrusive Quality and Intelligibility Measure of Reverberant and Dereverberated Speech*, IEEE TASLP 2010 (SRMR).
519
790
  - Traer & McDermott, *Statistics of Natural Reverberation Enable Perceptual Separation of Sound and Space*, PNAS 2016 (MIT IR Survey).
791
+ - Talkin, *A Robust Algorithm for Pitch Tracking (RAPT)*, in Kleijn & Paliwal (eds.), Speech Coding and Synthesis, Elsevier 1995.
792
+ - Boersma, *Accurate Short-Term Analysis of the Fundamental Frequency and the Harmonics-to-Noise Ratio of a Sampled Sound*, IFA Proceedings 17, 1993.
793
+ - Nelke & Vary, *Measurement, Analysis and Simulation of Wind Noise Signals for Mobile Communication Devices*, IWAENC 2014.
520
794
  - RBJ Audio EQ Cookbook (biquad coefficients).
521
795
 
522
796
 
package/index.d.ts CHANGED
@@ -41,7 +41,7 @@ export type { DereverbOptions } from '@audio/denoise-dereverb'
41
41
  export type { DesilenceOptions, TimeSegment, MapPoint, DesilenceResult, SegmentsResult } from '@audio/denoise-desilence'
42
42
  export type { DenoiseMethod, ClassifyScores, Plan, DenoiseOptions, DenoiseResult, DeesserOptions } from '@audio/denoise-detect'
43
43
  export type { DewindOptions } from '@audio/denoise-dewind'
44
- export type { DewowOptions, DewowTrack, DewowAnalysis } from '@audio/denoise-dewow'
44
+ export type { DewowOptions, DewowTrack, DewowLine, DewowAnalysis } from '@audio/denoise-dewow'
45
45
  export type { OmlsaOptions } from '@audio/denoise-omlsa'
46
46
  export type { RepairRegion, RepairOptions, RepairMethod } from '@audio/denoise-repair'
47
47
  export type { SpecsubOptions } from '@audio/denoise-spectral'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/denoise",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "Noise reduction — gate, spectral subtraction, Wiener, OM-LSA, dehum, declick, decrackle, declip, deesser, dereverb",
6
6
  "sideEffects": false,
@@ -50,26 +50,26 @@
50
50
  "node": ">=18"
51
51
  },
52
52
  "dependencies": {
53
- "@audio/vad": "^1.0.0",
54
- "@audio/noise-estimate": "^2.1.0",
55
- "@audio/denoise-spectral": "^0.2.1",
56
- "@audio/denoise-wiener": "^0.2.1",
57
- "@audio/denoise-omlsa": "^0.2.0",
58
- "@audio/denoise-dehum": "^0.2.0",
53
+ "@audio/vad": "^2.0.1",
54
+ "@audio/noise-estimate": "^2.2.0",
55
+ "@audio/denoise-spectral": "^0.2.2",
56
+ "@audio/denoise-wiener": "^0.3.0",
57
+ "@audio/denoise-omlsa": "^0.4.0",
58
+ "@audio/denoise-dehum": "^0.3.0",
59
59
  "@audio/denoise-declick": "^0.2.0",
60
- "@audio/denoise-decrackle": "^0.1.0",
61
- "@audio/denoise-declip": "^0.1.0",
62
- "@audio/denoise-dewind": "^0.1.0",
63
- "@audio/denoise-deplosive": "^0.1.0",
64
- "@audio/denoise-debreath": "^0.1.0",
65
- "@audio/denoise-dereverb": "^0.2.0",
66
- "@audio/denoise-detect": "^0.3.1",
60
+ "@audio/denoise-decrackle": "^0.2.0",
61
+ "@audio/denoise-declip": "^0.2.0",
62
+ "@audio/denoise-dewind": "^0.3.0",
63
+ "@audio/denoise-deplosive": "^0.2.0",
64
+ "@audio/denoise-debreath": "^0.2.1",
65
+ "@audio/denoise-dereverb": "^0.3.0",
66
+ "@audio/denoise-detect": "^0.4.1",
67
67
  "@audio/dynamics-gate": "^0.1.4",
68
- "@audio/denoise-repair": "^0.2.0",
68
+ "@audio/denoise-repair": "^0.4.0",
69
69
  "@audio/quality": "^1.0.0",
70
70
  "@audio/stft": "^2.0.0",
71
- "@audio/denoise-desilence": "^0.1.0",
72
- "@audio/denoise-dewow": "^0.1.0"
71
+ "@audio/denoise-desilence": "^0.2.1",
72
+ "@audio/denoise-dewow": "^0.3.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "audio-lena": "^3.0.0",