@audio/denoise 0.3.2 → 0.3.3
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.
- package/README.md +41 -24
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -99,27 +99,36 @@ dehum(data, { freq: 50, adaptive: true, drift: 0.5 }) // tracks slow ma
|
|
|
99
99
|
Adaptive high-pass. Cutoff slides between `cutoffMin` and `cutoffMax` based on the LF/MF energy ratio.
|
|
100
100
|
|
|
101
101
|
```js
|
|
102
|
-
dewind(data, { cutoffMin: 60, cutoffMax:
|
|
102
|
+
dewind(data, { cutoffMin: 60, cutoffMax: 250 })
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
| Param | Default | |
|
|
106
106
|
|---|---|---|
|
|
107
107
|
| `cutoffMin` | `60` | Hz — minimum cutoff (LF mostly clean) |
|
|
108
|
-
| `cutoffMax` | `
|
|
108
|
+
| `cutoffMax` | `250` | Hz — maximum cutoff (heavy rumble) |
|
|
109
|
+
| `order` | `2` | HP sections (each 12 dB/oct) |
|
|
109
110
|
| `Q` | `0.707` | Butterworth-ish |
|
|
110
|
-
| `
|
|
111
|
+
| `blockSize` | `1024` | Coefficient update interval (samples) |
|
|
111
112
|
|
|
112
113
|
**Use when:** wind buffeting, handheld-mic rumble, low-frequency room modes.
|
|
113
114
|
|
|
114
115
|
|
|
115
116
|
### `deplosive`
|
|
116
117
|
|
|
117
|
-
Splits the signal into LF (`<
|
|
118
|
+
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.
|
|
118
119
|
|
|
119
120
|
```js
|
|
120
|
-
deplosive(data, {
|
|
121
|
+
deplosive(data, { triggerRatio: 4, attack: 0.005, release: 0.08 })
|
|
121
122
|
```
|
|
122
123
|
|
|
124
|
+
| Param | Default | |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| `triggerRatio` | `4` | LF/high energy ratio that opens the duck |
|
|
127
|
+
| `attenuation` | `-18` | dB cut on the LF band when triggered |
|
|
128
|
+
| `crossover` | `200` | Hz — LF/high split point |
|
|
129
|
+
| `attack` | `0.005` | s |
|
|
130
|
+
| `release` | `0.08` | s |
|
|
131
|
+
|
|
123
132
|
**Use when:** mic plosives (`p`, `b`, `t`) producing low-frequency thuds.
|
|
124
133
|
|
|
125
134
|
|
|
@@ -136,9 +145,10 @@ deesser(data, { freq: 6500, threshold: -28, ratio: 4 })
|
|
|
136
145
|
| `freq` | `6000` | Sibilance centre (Hz) |
|
|
137
146
|
| `threshold` | `-30` | dBFS — engagement level |
|
|
138
147
|
| `ratio` | `4` | Compression ratio above threshold |
|
|
139
|
-
| `attack` | `0.001` | s |
|
|
140
|
-
| `release` | `0.05` | s |
|
|
148
|
+
| `attack` | `0.001` | s — how fast the cut engages |
|
|
149
|
+
| `release` | `0.05` | s — how slowly it recovers |
|
|
141
150
|
| `Q` | `1.4` | Peaking EQ Q |
|
|
151
|
+
| `block` | `64` | Coefficient update interval (samples) |
|
|
142
152
|
|
|
143
153
|
**Use when:** voice post-production with hot s/sh; vocal bus de-essing.
|
|
144
154
|
|
|
@@ -147,12 +157,19 @@ deesser(data, { freq: 6500, threshold: -28, ratio: 4 })
|
|
|
147
157
|
|
|
148
158
|
### `specsub`
|
|
149
159
|
|
|
150
|
-
Berouti spectral subtraction (1979). Estimates noise from the first `noiseFrames` and subtracts
|
|
160
|
+
Berouti spectral subtraction (1979). Estimates noise from the first `noiseFrames` (or tracks it via Minimum Statistics) and subtracts `α(γ)·N̂(k)` — an SNR-adaptive over-subtraction factor — from each magnitude frame, with a `β·|Y(k)|²` spectral floor. Pass an explicit `alpha` to force a fixed factor.
|
|
151
161
|
|
|
152
162
|
```js
|
|
153
|
-
specsub(data, {
|
|
163
|
+
specsub(data, { beta: 0.02, noiseFrames: 6 }) // adaptive α(γ)
|
|
164
|
+
specsub(data, { alpha: 2, beta: 0.02 }) // fixed over-subtraction
|
|
154
165
|
```
|
|
155
166
|
|
|
167
|
+
| Param | Default | |
|
|
168
|
+
|---|---|---|
|
|
169
|
+
| `alpha` | adaptive | Fixed over-subtraction factor; omit for Berouti α(γ) |
|
|
170
|
+
| `beta` | `0.02` | Spectral floor (fraction of the noisy spectrum) |
|
|
171
|
+
| `noiseFrames` | first 4 frames | Leading noise-only frames for the PSD bootstrap |
|
|
172
|
+
|
|
156
173
|
**Use when:** quick baseline; offline cleanup with a known noise-only preamble.<br>
|
|
157
174
|
**Not for:** musical-noise-sensitive material — use `wiener` or `omlsa`.
|
|
158
175
|
|
|
@@ -162,17 +179,17 @@ specsub(data, { alpha: 2, beta: 0.01, noiseFrames: 6 })
|
|
|
162
179
|
MMSE Wiener / log-MMSE (Ephraim-Malah 1984/1985) with decision-directed a-priori SNR.
|
|
163
180
|
|
|
164
181
|
```js
|
|
165
|
-
wiener(data, { rule: '
|
|
166
|
-
wiener(data) // defaults: '
|
|
182
|
+
wiener(data, { rule: 'wiener' }) // pure Wiener gain
|
|
183
|
+
wiener(data) // defaults: 'mmse-lsa' rule
|
|
167
184
|
```
|
|
168
185
|
|
|
169
186
|
| Param | Default | |
|
|
170
187
|
|---|---|---|
|
|
171
|
-
| `rule` | `'
|
|
172
|
-
| `alpha` | `0.98` | Decision-directed smoothing |
|
|
173
|
-
| `frameSize` | `
|
|
188
|
+
| `rule` | `'mmse-lsa'` | `'wiener'` or `'mmse-lsa'` (log-spectral, less musical noise) |
|
|
189
|
+
| `alpha` | `0.98` | Decision-directed smoothing (alias of `alphaDD`) |
|
|
190
|
+
| `frameSize` | `2048` | STFT frame |
|
|
174
191
|
| `hopSize` | `frameSize/4` | OLA hop |
|
|
175
|
-
| `noiseFrames` |
|
|
192
|
+
| `noiseFrames` | first 4 frames | Leading noise-only frames for PSD bootstrap |
|
|
176
193
|
|
|
177
194
|
**Use when:** transparent broadband denoise; the "safe default" for stationary noise.
|
|
178
195
|
|
|
@@ -189,9 +206,9 @@ omlsa(data, { gMinDb: -25 }) // less aggressiv
|
|
|
189
206
|
|
|
190
207
|
| Param | Default | |
|
|
191
208
|
|---|---|---|
|
|
192
|
-
| `gMinDb` | `-
|
|
193
|
-
| `alpha` | `0.92` | Decision-directed smoothing |
|
|
194
|
-
| `frameSize` | `
|
|
209
|
+
| `gMinDb` | `-20` | dB floor for non-speech bins (alias of `gMin`) |
|
|
210
|
+
| `alpha` | `0.92` | Decision-directed smoothing (alias of `alphaDD`) |
|
|
211
|
+
| `frameSize` | `2048` | |
|
|
195
212
|
| `hopSize` | `frameSize/4` | |
|
|
196
213
|
|
|
197
214
|
**Use when:** speech in non-stationary noise (street, café, car); generally the highest-quality choice for noisy speech.
|
|
@@ -204,15 +221,15 @@ omlsa(data, { gMinDb: -25 }) // less aggressiv
|
|
|
204
221
|
Detects impulses as AR-residual outliers (`> threshold·σ`); replaces each click region with an AR-LS interpolation (Janssen 1986 / Godsill-Rayner 1998).
|
|
205
222
|
|
|
206
223
|
```js
|
|
207
|
-
declick(data, { threshold: 4, order:
|
|
224
|
+
declick(data, { threshold: 4, order: 60 })
|
|
208
225
|
```
|
|
209
226
|
|
|
210
227
|
| Param | Default | |
|
|
211
228
|
|---|---|---|
|
|
212
229
|
| `threshold` | `4` | σ-multiple for click detection |
|
|
213
|
-
| `order` | `
|
|
214
|
-
| `
|
|
215
|
-
| `
|
|
230
|
+
| `order` | `60` | AR model order |
|
|
231
|
+
| `guard` | `2` | Extra samples on each side of the detected click |
|
|
232
|
+
| `maxBurst` | `64` | Longest run repaired (longer → left as a real transient) |
|
|
216
233
|
|
|
217
234
|
**Use when:** vinyl pops, edit clicks, occasional impulse noise.<br>
|
|
218
235
|
**Not for:** dense crackle (use `decrackle`); long dropouts (use `arInterpolate` directly).
|
|
@@ -223,7 +240,7 @@ declick(data, { threshold: 4, order: 50 })
|
|
|
223
240
|
Continuous AR-residual outlier detection with MAD-based threshold. Suited to high-rate impulse noise.
|
|
224
241
|
|
|
225
242
|
```js
|
|
226
|
-
decrackle(data, {
|
|
243
|
+
decrackle(data, { threshold: 3 })
|
|
227
244
|
```
|
|
228
245
|
|
|
229
246
|
**Use when:** shellac / 78 RPM crackle; persistent low-amplitude clicks.
|
|
@@ -289,7 +306,7 @@ gate(data, { threshold: -45, attack: 0.005, release: 0.1, hold: 0.05, lookahead:
|
|
|
289
306
|
VAD-driven inverse gate. Uses energy + spectral flatness with a percentile-based noise floor; attenuates frames classified as non-speech with smooth attack/release.
|
|
290
307
|
|
|
291
308
|
```js
|
|
292
|
-
debreath(data, {
|
|
309
|
+
debreath(data, { range: -10 }) // -10 dB on non-speech (default -12)
|
|
293
310
|
```
|
|
294
311
|
|
|
295
312
|
**Use when:** breath, mouth noise, hiss in pauses on a voiceover.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/denoise",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
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,
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"test": "node test.js",
|
|
16
16
|
"test:all": "npm test --workspaces --if-present && npm test",
|
|
17
17
|
"measure": "node scripts/measure.js",
|
|
18
|
-
"compare": "node scripts/compare.js",
|
|
19
18
|
"publish:all": "npm publish --workspaces && npm publish"
|
|
20
19
|
},
|
|
21
20
|
"repository": {
|