@audio/denoise 0.4.2 → 0.5.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 (2) hide show
  1. package/README.md +23 -10
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -12,7 +12,7 @@ Single-pass noise reduction. 13 specialised methods + an auto-classifier.
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
- | [declick](#declick) | time | impulses | ★★★★ | medium | vinyl pops, edit clicks |
15
+ | [declick](#declick) | time | impulses | ★★★★ | medium | vinyl ticks, edit clicks, mouth clicks |
16
16
  | [decrackle](#decrackle) | time | dense impulses | ★★★ | medium | shellac crackle |
17
17
  | [declip](#declip) | time | hard clipping | ★★★ | medium | restoration |
18
18
  | [dewind](#dewind) | time | LF rumble | ★★★ | very low | wind, handling noise |
@@ -239,21 +239,34 @@ omlsa(data, { fs, profileFrom: 0, profileTo: fs / 2, gMin: -12 }) // the noise
239
239
 
240
240
  ### `declick`
241
241
 
242
- Detects impulses as AR-residual outliers (`> threshold·σ`); replaces each click region with an AR-LS interpolation (Janssen 1986 / Godsill-Rayner 1998).
242
+ Finds each click as an outlier of the AR prediction error and rebuilds it from the sound either side. The error is judged against its own median level over ±12 ms, so a click can't raise the bar it must clear; the model is fitted again with the outliers left out, since a loud click otherwise teaches it its own ringing and only its onset stands out. A click spans where the error stays over 3× that level after its onset; one with a like half its size 2.5–15 ms away is a glottal pulse or a plucked string, and is left alone. Each is rebuilt by least-squares AR interpolation over 46 ms either side ([`lpc`](https://github.com/audiojs/denoise/tree/main/packages/lpc)'s `arBridge`, Janssen 1986 / Godsill-Rayner 1998). Samples no click reaches come back bit-exact.
243
243
 
244
244
  ```js
245
- declick(data, { threshold: 4, order: 60 })
245
+ declick(data, { fs: 44100 }) // everywhere
246
+ declick(data, { fs: 44100, regions: [{ at: 12.31, duration: 0.02 }] }) // the clicks seen there
246
247
  ```
247
248
 
248
249
  | Param | Default | |
249
250
  |---|---|---|
250
- | `threshold` | `4` | σ-multiple for click detection |
251
- | `order` | `60` | AR model order |
252
- | `guard` | `2` | Extra samples on each side of the detected click |
253
- | `maxBurst` | `64` | Longest run repaired (longer → left as a real transient) |
251
+ | `threshold` | `8` | how far over the error's local level a click stands, multiples |
252
+ | `longest` | `6` | longest click rebuilt, ms; longer is taken for real sound |
253
+ | `order` | `32` | AR order of the detection |
254
+ | `regions` | — | `[{ at, duration }]`, s: look only there, and take nothing there for a pulse or too long |
255
+ | `fs` | `44100` | sample rate, Hz |
254
256
 
255
- **Use when:** vinyl pops, edit clicks, occasional impulse noise.<br>
256
- **Not for:** dense crackle (use `decrackle`); long dropouts (use `arInterpolate` directly).
257
+ `node scripts/declick.js` adds clicks to speech (audio-lena) and music (librosa/data, as `repair`), one every 0.25–0.45 s at 2, 5 and 15× the sound's RMS around it, and measures how much of each click's error is gone (median dB, over the click and 1 ms either side) and the share gone by 10 dB or more:
258
+
259
+ | click | 2× | 5× | 15× |
260
+ |---|---:|---:|---:|
261
+ | tick (rings at 2–8 kHz, 0.05–0.3 ms) | 13.4 dB · 60% | 17.5 dB · 88% | 25.4 dB · 99% |
262
+ | pop (300–1500 Hz, 0.3–1 ms) | 5.7 dB · 30% | 12.9 dB · 60% | 18.2 dB · 86% |
263
+ | glitch (1–8 samples off) | 15.5 dB · 71% | 20.5 dB · 90% | 29.4 dB · 99% |
264
+ | mouth (1–3 ms of noise) | 9.3 dB · 49% | 17.8 dB · 86% | 25.6 dB · 100% |
265
+
266
+ 0.1.7 (AR(60) on its own window, σ including the click, 2 samples either side): ticks 5–6 dB, pops 0, mouth clicks 4–6 dB. The clean material through it: speech, Brahms and the trumpet untouched (0.1.7 changed 2295, 123 and 2283 samples, the trumpet to −19 dB), "Vibe Ace" 112 samples at −42 dB. Each click's surroundings (3–20 ms either side) given as `regions`: the same within 0.5 dB; regions over the clean material change nothing. Ticks at 2× are as far as the interpolation reaches: rebuilt at their exact span, they come out the same. 10 s in 0.1 s.
267
+
268
+ **Use when:** vinyl ticks, edit clicks, digital glitches, mouth clicks on a voice; a click seen on a spectrogram, given as a region.<br>
269
+ **Not for:** dense crackle (use `decrackle`); long dropouts (use `repair`).
257
270
 
258
271
 
259
272
  ### `decrackle`
@@ -430,7 +443,7 @@ import { noiseProfile, minStats, imcra } from '@audio/denoise'
430
443
  |---|---:|---|---:|---:|---:|
431
444
  | 60 Hz hum + harmonics | -5.2 dB | `dehum` | 15.3 dB | 6.3 dB | 5 |
432
445
  | white noise (~13 dB SNR) | 13.3 dB | `wiener` | 20.5 dB | 0.3 dB | 82 |
433
- | clicks (vinyl-style) | 24.1 dB | `declick` | 44.1 dB | — | 462 |
446
+ | clicks (vinyl-style) | 24.1 dB | `declick` | 46.2 dB | — | 227 |
434
447
  | 7 kHz sibilance | 2.0 dB | `deesser` | 9.2 dB | 1.9 dB | 5 |
435
448
 
436
449
  Higher = better.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/denoise",
3
- "version": "0.4.2",
3
+ "version": "0.5.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,
@@ -56,7 +56,7 @@
56
56
  "@audio/denoise-wiener": "^0.2.1",
57
57
  "@audio/denoise-omlsa": "^0.2.0",
58
58
  "@audio/denoise-dehum": "^0.2.0",
59
- "@audio/denoise-declick": "^0.1.0",
59
+ "@audio/denoise-declick": "^0.2.0",
60
60
  "@audio/denoise-decrackle": "^0.1.0",
61
61
  "@audio/denoise-declip": "^0.1.0",
62
62
  "@audio/denoise-dewind": "^0.1.0",