@audio/denoise-detect 0.1.7 → 0.1.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/denoise.js +2 -2
  2. package/index.d.ts +71 -0
  3. package/package.json +11 -5
package/denoise.js CHANGED
@@ -30,8 +30,8 @@ export const deesser = (data, params = {}) => {
30
30
  data.set(deesser_(data, {
31
31
  sampleRate: params.fs || 44100,
32
32
  mode: 'band',
33
- freq: params.freq ?? 6000,
34
- q: params.Q ?? 1.4,
33
+ fc: params.fc ?? params.freq ?? 6000, // `freq`: former name
34
+ Q: params.Q ?? 1.4,
35
35
  threshold: params.threshold ?? -30,
36
36
  ratio: params.ratio ?? 4,
37
37
  attack: (params.attack ?? 0.001) * 1000,
package/index.d.ts ADDED
@@ -0,0 +1,71 @@
1
+ /** Content-aware auto-selector — classifies the dominant noise type and dispatches to the matching method. */
2
+ export type DenoiseMethod = 'dehum' | 'declick' | 'dewind' | 'deesser' | 'dereverb' | 'omlsa' | 'wiener'
3
+
4
+ export interface ClassifyScores {
5
+ /** hit count (0-3) of mains harmonics with ≥50× line/off-line ratio */
6
+ hum: number
7
+ /** 50 or 60 */
8
+ humFreq: number
9
+ /** peak excess kurtosis of AR residual across scanned windows */
10
+ click: number
11
+ /** low/mid band power ratio */
12
+ lf: number
13
+ /** high/mid (sibilance) band power ratio */
14
+ hi: number
15
+ /** CV of the frame-energy floor — low = stationary noise bed */
16
+ stationarity: number
17
+ }
18
+
19
+ export interface Plan {
20
+ method: DenoiseMethod
21
+ /** empty when `force` skipped classification */
22
+ scores: ClassifyScores | Record<string, never>
23
+ /** present only when classification ran */
24
+ humFreq?: number
25
+ }
26
+
27
+ export interface DenoiseOptions {
28
+ /** sample rate (Hz), default 44100 */
29
+ fs?: number
30
+ /** skip classification, force a method */
31
+ force?: DenoiseMethod
32
+ /** return { out, plan } instead of just the cleaned buffer */
33
+ returnPlan?: boolean
34
+ /** additional per-method params, passed through to the dispatched method */
35
+ [param: string]: unknown
36
+ }
37
+
38
+ export interface DenoiseResult {
39
+ out: Float32Array
40
+ plan: Plan
41
+ }
42
+
43
+ /** Classify the dominant noise type and clean it with the matching method. */
44
+ export default function denoise(data: Float32Array, params?: DenoiseOptions & { returnPlan?: false }): Float32Array
45
+ export default function denoise(data: Float32Array, params: DenoiseOptions & { returnPlan: true }): DenoiseResult
46
+
47
+ /** Run the classification sweep only (no cleaning). */
48
+ export function classify(data: Float32Array, fs?: number): Plan
49
+
50
+ export interface DeesserOptions {
51
+ /** sample rate (Hz), default 44100 */
52
+ fs?: number
53
+ /** center frequency (Hz), default 6000 */
54
+ fc?: number
55
+ /** @deprecated former name of `fc` */
56
+ freq?: number
57
+ /** notch Q, default 1.4 */
58
+ Q?: number
59
+ /** dB, default -30 */
60
+ threshold?: number
61
+ /** default 4 */
62
+ ratio?: number
63
+ /** seconds, default 0.001 */
64
+ attack?: number
65
+ /** seconds, default 0.05 */
66
+ release?: number
67
+ block?: number
68
+ }
69
+
70
+ /** De-esser adapter over @audio/dynamics-deesser (band mode). Processes in place; returns the same buffer. */
71
+ export function deesser(data: Float32Array, params?: DeesserOptions): Float32Array
package/package.json CHANGED
@@ -1,24 +1,29 @@
1
1
  {
2
2
  "name": "@audio/denoise-detect",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "denoise — content-aware auto-selector that classifies the dominant noise type",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "main": "denoise.js",
8
8
  "exports": {
9
- ".": "./denoise.js",
9
+ ".": {
10
+ "types": "./index.d.ts",
11
+ "default": "./denoise.js"
12
+ },
10
13
  "./package.json": "./package.json"
11
14
  },
12
15
  "files": [
13
- "denoise.js"
16
+ "denoise.js",
17
+ "index.d.ts"
14
18
  ],
19
+ "types": "index.d.ts",
15
20
  "dependencies": {
16
21
  "@audio/denoise-wiener": "^0.1.0",
17
22
  "@audio/denoise-omlsa": "^0.1.0",
18
23
  "@audio/denoise-dehum": "^0.1.0",
19
24
  "@audio/denoise-declick": "^0.1.0",
20
25
  "@audio/denoise-dewind": "^0.1.0",
21
- "@audio/dynamics-deesser": "^0.2.3",
26
+ "@audio/dynamics-deesser": "^0.2.7",
22
27
  "@audio/denoise-dereverb": "^0.1.0",
23
28
  "@audio/lpc": "^1.0.0",
24
29
  "@audio/stft": "^1.0.3"
@@ -46,5 +51,6 @@
46
51
  },
47
52
  "publishConfig": {
48
53
  "access": "public"
49
- }
54
+ },
55
+ "funding": "https://github.com/sponsors/audiojs"
50
56
  }