deepfilternet3-assets 1.0.1 → 1.0.2
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/package.json +1 -1
- package/pkg/df.d.ts +81 -73
- package/pkg/df.js +20 -29
- package/pkg/df_bg.wasm +0 -0
package/package.json
CHANGED
package/pkg/df.d.ts
CHANGED
|
@@ -1,78 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
free(): void;
|
|
69
|
-
}
|
|
70
|
-
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Create a DeepFilterNet Model
|
|
5
|
+
*
|
|
6
|
+
* Args:
|
|
7
|
+
* - path: File path to a DeepFilterNet tar.gz onnx model
|
|
8
|
+
* - atten_lim: Attenuation limit in dB.
|
|
9
|
+
*
|
|
10
|
+
* Returns:
|
|
11
|
+
* - DF state doing the full processing: stft, DNN noise reduction, istft.
|
|
12
|
+
* @param {Uint8Array} model_bytes
|
|
13
|
+
* @param {number} atten_lim
|
|
14
|
+
* @returns {number}
|
|
15
|
+
*/
|
|
16
|
+
export function df_create(model_bytes: Uint8Array, atten_lim: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* Get DeepFilterNet frame size in samples.
|
|
19
|
+
* @param {number} st
|
|
20
|
+
* @returns {number}
|
|
21
|
+
*/
|
|
22
|
+
export function df_get_frame_length(st: number): number;
|
|
23
|
+
/**
|
|
24
|
+
* @param {number} st
|
|
25
|
+
* @param {boolean} enabled
|
|
26
|
+
* @param {number} desired_output_rms
|
|
27
|
+
* @param {number} distortion_factor
|
|
28
|
+
* @param {number} snr_thresh
|
|
29
|
+
*/
|
|
30
|
+
export function df_set_agc_params(st: number, enabled: boolean, desired_output_rms: number, distortion_factor: number, snr_thresh: number): void;
|
|
31
|
+
/**
|
|
32
|
+
* Set DeepFilterNet attenuation limit.
|
|
33
|
+
*
|
|
34
|
+
* Args:
|
|
35
|
+
* - lim_db: New attenuation limit in dB.
|
|
36
|
+
* @param {number} st
|
|
37
|
+
* @param {number} lim_db
|
|
38
|
+
*/
|
|
39
|
+
export function df_set_atten_lim(st: number, lim_db: number): void;
|
|
40
|
+
/**
|
|
41
|
+
* Set DeepFilterNet post filter beta. A beta of 0 disables the post filter.
|
|
42
|
+
*
|
|
43
|
+
* Args:
|
|
44
|
+
* - beta: Post filter attenuation. Suitable range between 0.05 and 0;
|
|
45
|
+
* @param {number} st
|
|
46
|
+
* @param {number} beta
|
|
47
|
+
*/
|
|
48
|
+
export function df_set_post_filter_beta(st: number, beta: number): void;
|
|
49
|
+
/**
|
|
50
|
+
* Processes a chunk of samples.
|
|
51
|
+
*
|
|
52
|
+
* Args:
|
|
53
|
+
* - df_state: Created via df_create()
|
|
54
|
+
* - input: Input buffer of length df_get_frame_length()
|
|
55
|
+
* - output: Output buffer of length df_get_frame_length()
|
|
56
|
+
*
|
|
57
|
+
* Returns:
|
|
58
|
+
* - Local SNR of the current frame.
|
|
59
|
+
* @param {number} st
|
|
60
|
+
* @param {Float32Array} input
|
|
61
|
+
* @returns {Float32Array}
|
|
62
|
+
*/
|
|
63
|
+
export function df_process_frame(st: number, input: Float32Array): Float32Array;
|
|
64
|
+
/**
|
|
65
|
+
*/
|
|
66
|
+
export class DFState {
|
|
67
|
+
free(): void;
|
|
71
68
|
}
|
|
72
69
|
|
|
73
|
-
|
|
70
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
74
71
|
|
|
75
|
-
|
|
72
|
+
export interface InitOutput {
|
|
76
73
|
readonly memory: WebAssembly.Memory;
|
|
77
74
|
readonly __wbg_dfstate_free: (a: number) => void;
|
|
78
75
|
readonly df_create: (a: number, b: number, c: number) => number;
|
|
@@ -85,6 +82,17 @@ declare interface InitOutput {
|
|
|
85
82
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
86
83
|
}
|
|
87
84
|
|
|
85
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
86
|
+
/**
|
|
87
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
88
|
+
* a precompiled `WebAssembly.Module`.
|
|
89
|
+
*
|
|
90
|
+
* @param {SyncInitInput} module
|
|
91
|
+
*
|
|
92
|
+
* @returns {InitOutput}
|
|
93
|
+
*/
|
|
94
|
+
export function initSync(module: SyncInitInput): InitOutput;
|
|
95
|
+
|
|
88
96
|
/**
|
|
89
97
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
90
98
|
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
@@ -93,4 +101,4 @@ declare interface InitOutput {
|
|
|
93
101
|
*
|
|
94
102
|
* @returns {Promise<InitOutput>}
|
|
95
103
|
*/
|
|
96
|
-
|
|
104
|
+
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/pkg/df.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
let
|
|
2
|
-
(function() {
|
|
3
|
-
const __exports = {};
|
|
4
|
-
let script_src;
|
|
5
|
-
if (typeof document !== 'undefined' && document.currentScript !== null) {
|
|
6
|
-
script_src = new URL(document.currentScript.src, location.href).toString();
|
|
7
|
-
}
|
|
8
|
-
let wasm = undefined;
|
|
1
|
+
let wasm;
|
|
9
2
|
|
|
10
|
-
|
|
3
|
+
const heap = new Array(128).fill(undefined);
|
|
11
4
|
|
|
12
|
-
|
|
5
|
+
heap.push(undefined, null, true, false);
|
|
13
6
|
|
|
14
7
|
function getObject(idx) { return heap[idx]; }
|
|
15
8
|
|
|
@@ -75,22 +68,22 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
75
68
|
* @param {number} atten_lim
|
|
76
69
|
* @returns {number}
|
|
77
70
|
*/
|
|
78
|
-
|
|
71
|
+
export function df_create(model_bytes, atten_lim) {
|
|
79
72
|
const ptr0 = passArray8ToWasm0(model_bytes, wasm.__wbindgen_malloc);
|
|
80
73
|
const len0 = WASM_VECTOR_LEN;
|
|
81
74
|
const ret = wasm.df_create(ptr0, len0, atten_lim);
|
|
82
75
|
return ret >>> 0;
|
|
83
|
-
}
|
|
76
|
+
}
|
|
84
77
|
|
|
85
78
|
/**
|
|
86
79
|
* Get DeepFilterNet frame size in samples.
|
|
87
80
|
* @param {number} st
|
|
88
81
|
* @returns {number}
|
|
89
82
|
*/
|
|
90
|
-
|
|
83
|
+
export function df_get_frame_length(st) {
|
|
91
84
|
const ret = wasm.df_get_frame_length(st);
|
|
92
85
|
return ret >>> 0;
|
|
93
|
-
}
|
|
86
|
+
}
|
|
94
87
|
|
|
95
88
|
/**
|
|
96
89
|
* @param {number} st
|
|
@@ -99,9 +92,9 @@ __exports.df_get_frame_length = function(st) {
|
|
|
99
92
|
* @param {number} distortion_factor
|
|
100
93
|
* @param {number} snr_thresh
|
|
101
94
|
*/
|
|
102
|
-
|
|
95
|
+
export function df_set_agc_params(st, enabled, desired_output_rms, distortion_factor, snr_thresh) {
|
|
103
96
|
wasm.df_set_agc_params(st, enabled, desired_output_rms, distortion_factor, snr_thresh);
|
|
104
|
-
}
|
|
97
|
+
}
|
|
105
98
|
|
|
106
99
|
/**
|
|
107
100
|
* Set DeepFilterNet attenuation limit.
|
|
@@ -111,9 +104,9 @@ __exports.df_set_agc_params = function(st, enabled, desired_output_rms, distorti
|
|
|
111
104
|
* @param {number} st
|
|
112
105
|
* @param {number} lim_db
|
|
113
106
|
*/
|
|
114
|
-
|
|
107
|
+
export function df_set_atten_lim(st, lim_db) {
|
|
115
108
|
wasm.df_set_atten_lim(st, lim_db);
|
|
116
|
-
}
|
|
109
|
+
}
|
|
117
110
|
|
|
118
111
|
/**
|
|
119
112
|
* Set DeepFilterNet post filter beta. A beta of 0 disables the post filter.
|
|
@@ -123,9 +116,9 @@ __exports.df_set_atten_lim = function(st, lim_db) {
|
|
|
123
116
|
* @param {number} st
|
|
124
117
|
* @param {number} beta
|
|
125
118
|
*/
|
|
126
|
-
|
|
119
|
+
export function df_set_post_filter_beta(st, beta) {
|
|
127
120
|
wasm.df_set_post_filter_beta(st, beta);
|
|
128
|
-
}
|
|
121
|
+
}
|
|
129
122
|
|
|
130
123
|
let cachedFloat32Memory0 = null;
|
|
131
124
|
|
|
@@ -156,12 +149,12 @@ function passArrayF32ToWasm0(arg, malloc) {
|
|
|
156
149
|
* @param {Float32Array} input
|
|
157
150
|
* @returns {Float32Array}
|
|
158
151
|
*/
|
|
159
|
-
|
|
152
|
+
export function df_process_frame(st, input) {
|
|
160
153
|
const ptr0 = passArrayF32ToWasm0(input, wasm.__wbindgen_malloc);
|
|
161
154
|
const len0 = WASM_VECTOR_LEN;
|
|
162
155
|
const ret = wasm.df_process_frame(st, ptr0, len0);
|
|
163
156
|
return takeObject(ret);
|
|
164
|
-
}
|
|
157
|
+
}
|
|
165
158
|
|
|
166
159
|
function handleError(f, args) {
|
|
167
160
|
try {
|
|
@@ -176,7 +169,7 @@ const DFStateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
176
169
|
: new FinalizationRegistry(ptr => wasm.__wbg_dfstate_free(ptr >>> 0));
|
|
177
170
|
/**
|
|
178
171
|
*/
|
|
179
|
-
class DFState {
|
|
172
|
+
export class DFState {
|
|
180
173
|
|
|
181
174
|
__destroy_into_raw() {
|
|
182
175
|
const ptr = this.__wbg_ptr;
|
|
@@ -190,7 +183,6 @@ class DFState {
|
|
|
190
183
|
wasm.__wbg_dfstate_free(ptr);
|
|
191
184
|
}
|
|
192
185
|
}
|
|
193
|
-
__exports.DFState = DFState;
|
|
194
186
|
|
|
195
187
|
async function __wbg_load(module, imports) {
|
|
196
188
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
@@ -387,8 +379,8 @@ function initSync(module) {
|
|
|
387
379
|
async function __wbg_init(input) {
|
|
388
380
|
if (wasm !== undefined) return wasm;
|
|
389
381
|
|
|
390
|
-
if (typeof input === 'undefined'
|
|
391
|
-
input =
|
|
382
|
+
if (typeof input === 'undefined') {
|
|
383
|
+
input = new URL('df_bg.wasm', import.meta.url);
|
|
392
384
|
}
|
|
393
385
|
const imports = __wbg_get_imports();
|
|
394
386
|
|
|
@@ -403,6 +395,5 @@ async function __wbg_init(input) {
|
|
|
403
395
|
return __wbg_finalize_init(instance, module);
|
|
404
396
|
}
|
|
405
397
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
})();
|
|
398
|
+
export { initSync }
|
|
399
|
+
export default __wbg_init;
|
package/pkg/df_bg.wasm
CHANGED
|
Binary file
|