@audio/denoise-detect 0.1.6 → 0.1.8
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/denoise.js +3 -2
- package/index.d.ts +69 -0
- package/package.json +6 -3
package/denoise.js
CHANGED
|
@@ -24,8 +24,9 @@ import deesser_ from '@audio/dynamics-deesser'
|
|
|
24
24
|
import dereverb from '@audio/denoise-dereverb'
|
|
25
25
|
|
|
26
26
|
// deesser — @audio/dynamics-deesser mode 'band' behind this family's seconds/fs
|
|
27
|
-
// API (2026-07 near-dupe merge
|
|
28
|
-
|
|
27
|
+
// API (2026-07 near-dupe merge). Exported: the umbrella index.js re-exports this
|
|
28
|
+
// same adapter instead of carrying its own copy.
|
|
29
|
+
export const deesser = (data, params = {}) => {
|
|
29
30
|
data.set(deesser_(data, {
|
|
30
31
|
sampleRate: params.fs || 44100,
|
|
31
32
|
mode: 'band',
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
freq?: number
|
|
55
|
+
/** notch Q, default 1.4 */
|
|
56
|
+
Q?: number
|
|
57
|
+
/** dB, default -30 */
|
|
58
|
+
threshold?: number
|
|
59
|
+
/** default 4 */
|
|
60
|
+
ratio?: number
|
|
61
|
+
/** seconds, default 0.001 */
|
|
62
|
+
attack?: number
|
|
63
|
+
/** seconds, default 0.05 */
|
|
64
|
+
release?: number
|
|
65
|
+
block?: number
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** De-esser adapter over @audio/dynamics-deesser (band mode). Processes in place; returns the same buffer. */
|
|
69
|
+
export function deesser(data: Float32Array, params?: DeesserOptions): Float32Array
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/denoise-detect",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "denoise — content-aware auto-selector that classifies the dominant noise type",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
"./package.json": "./package.json"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
|
-
"denoise.js"
|
|
13
|
+
"denoise.js",
|
|
14
|
+
"index.d.ts"
|
|
14
15
|
],
|
|
16
|
+
"types": "index.d.ts",
|
|
15
17
|
"dependencies": {
|
|
16
18
|
"@audio/denoise-wiener": "^0.1.0",
|
|
17
19
|
"@audio/denoise-omlsa": "^0.1.0",
|
|
@@ -46,5 +48,6 @@
|
|
|
46
48
|
},
|
|
47
49
|
"publishConfig": {
|
|
48
50
|
"access": "public"
|
|
49
|
-
}
|
|
51
|
+
},
|
|
52
|
+
"funding": "https://github.com/sponsors/audiojs"
|
|
50
53
|
}
|