@audio/denoise 0.3.7 → 0.3.9

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 +59 -0
  2. package/index.js +2 -0
  3. package/package.json +4 -2
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @audio/denoise [![npm](https://img.shields.io/npm/v/@audio/denoise)](https://www.npmjs.com/package/@audio/denoise) [![license](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
2
2
 
3
+ Try it in the browser: [Noise remover](https://audiojs.dev/util/denoise/). Runs on this package, nothing is uploaded.
4
+
3
5
  Single-pass noise reduction. 13 specialised methods + an auto-classifier.
4
6
 
5
7
  | | Domain | Targets | Quality | CPU | Best for |
@@ -17,7 +19,9 @@ Single-pass noise reduction. 13 specialised methods + an auto-classifier.
17
19
  | [deplosive](#deplosive) | time | LF bursts | ★★★ | low | mic plosives (p, b) |
18
20
  | [deesser](#deesser) | time | sibilance | ★★★★ | low | voice (s, sh) |
19
21
  | [debreath](#debreath) | time | inter-word noise | ★★★ | low | breath / hiss in pauses |
22
+ | [desilence](#desilence) | time | pauses | ★★★ | low | remove / shorten / trim silence, split by pause |
20
23
  | [dereverb](#dereverb) | freq | late reverb | ★★ | medium | moderate room reverb |
24
+ | [dewow](#dewow) | time + freq | pitch drift | ★★★ | medium | tape / vinyl / cassette wow & flutter |
21
25
 
22
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).
23
27
 
@@ -288,6 +292,34 @@ dereverb(data, { t60: 0.6, predelay: 0.04 })
288
292
  **Not for:** heavy reverb or convolutive distortion — use multi-channel WPE (out of scope).
289
293
 
290
294
 
295
+ ## Pitch drift
296
+
297
+ ### `dewow`
298
+
299
+ 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.
300
+
301
+ ```js
302
+ dewow(data, { fs }) // partial tracking (default)
303
+ dewow(data, { fs, mode: 'reference', refFreq: 50 }) // lock to 50 Hz hum
304
+ dewow(data, { fs, wow: true, flutter: false }) // remove slow drift only
305
+ wowFlutter(data, { fs }) // → { speed, times, wow, flutter, confidence }
306
+ ```
307
+
308
+ | Param | Default | |
309
+ |---|---|---|
310
+ | `mode` | `'partial'` | `'partial' \| 'reference' \| 'pitch'` |
311
+ | `refFreq` | — | Hz — the known tone for `reference` mode |
312
+ | `smooth` | `0.05` | s — flutter-band smoothing of the speed curve |
313
+ | `wow` / `flutter` | `true` / `true` | correct the < 6 Hz / 6–43 Hz bands |
314
+ | `maxDeviation` | `0.05` | clamp on the speed ratio (±5 %) |
315
+ | `keepLength` | `true` | output length equals input |
316
+
317
+ 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.
318
+
319
+ **Use when:** tape, cassette, vinyl and film transfers with audible pitch wobble; material with sustained tones or a reference tone.<br>
320
+ **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`.
321
+
322
+
291
323
  ## Gates & inter-word
292
324
 
293
325
  ### `gate`
@@ -313,6 +345,33 @@ debreath(data, { range: -10 }) // -10 dB on non-s
313
345
  **Use when:** breath, mouth noise, hiss in pauses on a voiceover.
314
346
 
315
347
 
348
+ ### `desilence`
349
+
350
+ 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.
351
+
352
+ ```js
353
+ desilence(data, { mode: 'shorten', maxSilence: 0.25 }) // Overcast "Smart Speed": long pauses → 0.25 s
354
+ desilence(data, { mode: 'remove', minSilence: 0.5, pad: 0.1 }) // cut pauses > 0.5 s, keep 0.1 s around speech
355
+ desilence(data, { mode: 'trim' }) // leading/trailing silence only
356
+ silenceSegments(data, { fs }) // → { speech: [{start, end}], silence: [...] }
357
+ splitSilence(data, { fs }) // → one Float32Array per phrase
358
+ ```
359
+
360
+ | Param | Default | |
361
+ |---|---|---|
362
+ | `mode` | `'shorten'` | `'shorten' \| 'remove' \| 'trim'` |
363
+ | `minSilence` | `0.5` | s — pauses shorter than this are never touched |
364
+ | `maxSilence` | `0.25` | s — `shorten` target length of any remaining pause (cut from the middle, onsets kept) |
365
+ | `pad` | `0.1` | s — silence kept on each side of speech in `remove` mode |
366
+ | `merge` | `0.15` | s — speech gaps shorter than this join one segment |
367
+ | `fade` | `0.01` | s — crossfade at every cut |
368
+
369
+ Returns `{ data, segments, removed, map }`; `project(map, t)` re-times markers/subtitles (`@audio/subtitle` `project()` takes the same map).
370
+
371
+ **Use when:** podcast/lecture pause tightening, split-by-silence, auto-trim.<br>
372
+ **Not for:** music (a rest is a pause to this VAD); overlapping speech.
373
+
374
+
316
375
  ## Quality measurement
317
376
 
318
377
  ```js
package/index.js CHANGED
@@ -16,6 +16,8 @@ export { default as debreath } from '@audio/denoise-debreath'
16
16
  export { default as dereverb } from '@audio/denoise-dereverb'
17
17
  export { default as denoise, classify, deesser } from '@audio/denoise-detect'
18
18
  export { default as repair } from '@audio/denoise-repair'
19
+ export { default as desilence, segments as silenceSegments, split as splitSilence } from '@audio/denoise-desilence'
20
+ export { default as dewow, analyze as wowFlutter } from '@audio/denoise-dewow'
19
21
 
20
22
  export { snr, segSnr, lsd, nrr, speechAttenuation } from '@audio/quality'
21
23
  export { vad, spp, ddSnr } from '@audio/vad'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/denoise",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
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,
@@ -63,7 +63,9 @@
63
63
  "@audio/dynamics-gate": "^0.1.4",
64
64
  "@audio/denoise-repair": "^0.1.0",
65
65
  "@audio/quality": "^1.0.0",
66
- "@audio/stft": "^1.0.3"
66
+ "@audio/stft": "^1.0.3",
67
+ "@audio/denoise-desilence": "^0.1.0",
68
+ "@audio/denoise-dewow": "^0.1.0"
67
69
  },
68
70
  "devDependencies": {
69
71
  "audio-lena": "^3.0.0",