@audio/denoise 0.3.8 → 0.3.10

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 CHANGED
@@ -1,4 +1,4 @@
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)
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)](https://spdx.org/licenses/MIT.html)
2
2
 
3
3
  Try it in the browser: [Noise remover](https://audiojs.dev/util/denoise/). Runs on this package, nothing is uploaded.
4
4
 
@@ -19,7 +19,9 @@ Single-pass noise reduction. 13 specialised methods + an auto-classifier.
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
+ | [desilence](#desilence) | time | pauses | ★★★ | low | remove / shorten / trim silence, split by pause |
22
23
  | [dereverb](#dereverb) | freq | late reverb | ★★ | medium | moderate room reverb |
24
+ | [dewow](#dewow) | time + freq | pitch drift | ★★★ | medium | tape / vinyl / cassette wow & flutter |
23
25
 
24
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).
25
27
 
@@ -137,15 +139,15 @@ deplosive(data, { triggerRatio: 4, attack: 0.005, release: 0.08 })
137
139
 
138
140
  ### `deesser`
139
141
 
140
- 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 `freq` 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.
142
+ 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.
141
143
 
142
144
  ```js
143
- deesser(data, { freq: 6500, threshold: -28, ratio: 4 })
145
+ deesser(data, { fc: 6500, threshold: -28, ratio: 4 })
144
146
  ```
145
147
 
146
148
  | Param | Default | |
147
149
  |---|---|---|
148
- | `freq` | `6000` | Sibilance centre (Hz) |
150
+ | `fc` | `6000` | Sibilance centre (Hz; `freq` still accepted) |
149
151
  | `threshold` | `-30` | dBFS — engagement level |
150
152
  | `ratio` | `4` | Compression ratio above threshold |
151
153
  | `attack` | `0.001` | s — how fast the cut engages |
@@ -290,6 +292,34 @@ dereverb(data, { t60: 0.6, predelay: 0.04 })
290
292
  **Not for:** heavy reverb or convolutive distortion — use multi-channel WPE (out of scope).
291
293
 
292
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
+
293
323
  ## Gates & inter-word
294
324
 
295
325
  ### `gate`
@@ -315,6 +345,33 @@ debreath(data, { range: -10 }) // -10 dB on non-s
315
345
  **Use when:** breath, mouth noise, hiss in pauses on a voiceover.
316
346
 
317
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
+
318
375
  ## Quality measurement
319
376
 
320
377
  ```js
package/index.d.ts ADDED
@@ -0,0 +1,51 @@
1
+ export { default as dehum } from '@audio/denoise-dehum'
2
+ export { default as specsub } from '@audio/denoise-spectral'
3
+ export { default as wiener } from '@audio/denoise-wiener'
4
+ export { default as omlsa } from '@audio/denoise-omlsa'
5
+ export { default as declick } from '@audio/denoise-declick'
6
+ export { default as decrackle } from '@audio/denoise-decrackle'
7
+ export { default as declip } from '@audio/denoise-declip'
8
+ export { default as dewind } from '@audio/denoise-dewind'
9
+ export { default as deplosive } from '@audio/denoise-deplosive'
10
+ export { default as debreath } from '@audio/denoise-debreath'
11
+ export { default as dereverb } from '@audio/denoise-dereverb'
12
+ export { default as denoise, classify, deesser } from '@audio/denoise-detect'
13
+ export { default as repair } from '@audio/denoise-repair'
14
+ export { default as desilence, segments as silenceSegments, split as splitSilence } from '@audio/denoise-desilence'
15
+ export { default as dewow, analyze as wowFlutter } from '@audio/denoise-dewow'
16
+ export { snr, segSnr, lsd, nrr, speechAttenuation } from '@audio/quality'
17
+ export { vad, spp, ddSnr } from '@audio/vad'
18
+ export { noiseProfile, minStats, imcra } from '@audio/noise-estimate'
19
+ export { stftBatch, stftStream, stftAnalyse } from '@audio/stft'
20
+
21
+ export interface GateOptions {
22
+ fs?: number
23
+ /** Threshold and range are in dB; times are in seconds. */
24
+ threshold?: number
25
+ closeThreshold?: number
26
+ attack?: number
27
+ release?: number
28
+ hold?: number
29
+ range?: number
30
+ lookahead?: number
31
+ }
32
+ /** Whole-buffer, in-place adapter; use @audio/dynamics-gate for streaming. */
33
+ export function gate<T extends Float32Array | Float64Array>(data: T, params?: GateOptions): T
34
+ export type { DebreathOptions } from '@audio/denoise-debreath'
35
+ export type { DeclickOptions } from '@audio/denoise-declick'
36
+ export type { DeclipOptions } from '@audio/denoise-declip'
37
+ export type { DecrackleOptions } from '@audio/denoise-decrackle'
38
+ export type { DehumOptions } from '@audio/denoise-dehum'
39
+ export type { DeplosiveOptions } from '@audio/denoise-deplosive'
40
+ export type { DereverbOptions } from '@audio/denoise-dereverb'
41
+ export type { DesilenceOptions, TimeSegment, MapPoint, DesilenceResult, SegmentsResult } from '@audio/denoise-desilence'
42
+ export type { DenoiseMethod, ClassifyScores, Plan, DenoiseOptions, DenoiseResult, DeesserOptions } from '@audio/denoise-detect'
43
+ export type { DewindOptions } from '@audio/denoise-dewind'
44
+ export type { DewowOptions, DewowTrack, DewowAnalysis } from '@audio/denoise-dewow'
45
+ export type { OmlsaOptions } from '@audio/denoise-omlsa'
46
+ export type { RepairRegion, RepairOptions } from '@audio/denoise-repair'
47
+ export type { SpecsubOptions } from '@audio/denoise-spectral'
48
+ export type { WienerOptions } from '@audio/denoise-wiener'
49
+ export type { NoiseProfileOptions, MinStatsOptions, Estimator, ImcraOptions, ImcraEstimator } from '@audio/noise-estimate'
50
+ export type { SegSnrOptions, LsdOptions, SpectralSimOptions, ModulationDepthOptions } from '@audio/quality'
51
+ export type { VadOptions, VadResult, SppOptions } from '@audio/vad'
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,15 +1,19 @@
1
1
  {
2
2
  "name": "@audio/denoise",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "type": "module",
5
- "description": "Noise reduction \u2014 gate, spectral subtraction, Wiener, OM-LSA, dehum, declick, decrackle, declip, deesser, dereverb",
5
+ "description": "Noise reduction — gate, spectral subtraction, Wiener, OM-LSA, dehum, declick, decrackle, declip, deesser, dereverb",
6
6
  "sideEffects": false,
7
7
  "exports": {
8
- ".": "./index.js",
8
+ ".": {
9
+ "types": "./index.d.ts",
10
+ "default": "./index.js"
11
+ },
9
12
  "./package.json": "./package.json"
10
13
  },
11
14
  "files": [
12
- "index.js"
15
+ "index.js",
16
+ "*.d.ts"
13
17
  ],
14
18
  "scripts": {
15
19
  "test": "node test.js",
@@ -63,7 +67,9 @@
63
67
  "@audio/dynamics-gate": "^0.1.4",
64
68
  "@audio/denoise-repair": "^0.1.0",
65
69
  "@audio/quality": "^1.0.0",
66
- "@audio/stft": "^1.0.3"
70
+ "@audio/stft": "^1.0.3",
71
+ "@audio/denoise-desilence": "^0.1.0",
72
+ "@audio/denoise-dewow": "^0.1.0"
67
73
  },
68
74
  "devDependencies": {
69
75
  "audio-lena": "^3.0.0",
@@ -81,5 +87,6 @@
81
87
  },
82
88
  "homepage": "https://github.com/audiojs/denoise#readme",
83
89
  "main": "index.js",
84
- "funding": "https://github.com/sponsors/audiojs"
90
+ "funding": "https://github.com/sponsors/audiojs",
91
+ "types": "./index.d.ts"
85
92
  }