echogarden 1.7.0 → 1.8.0
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/data/schemas/options.json +22 -10
- package/dist/api/Alignment.js +2 -2
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/Denoising.js +5 -4
- package/dist/api/Denoising.js.map +1 -1
- package/dist/api/Recognition.js +2 -2
- package/dist/api/Recognition.js.map +1 -1
- package/dist/api/SourceSeparation.d.ts +2 -6
- package/dist/api/SourceSeparation.js +8 -9
- package/dist/api/SourceSeparation.js.map +1 -1
- package/dist/api/SpeechLanguageDetection.js +2 -2
- package/dist/api/SpeechLanguageDetection.js.map +1 -1
- package/dist/api/SpeechTranslation.js +2 -2
- package/dist/api/SpeechTranslation.js.map +1 -1
- package/dist/api/Synthesis.js +5 -5
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/api/TranslationAlignment.js +2 -2
- package/dist/api/TranslationAlignment.js.map +1 -1
- package/dist/audio/AudioUtilities.d.ts +5 -3
- package/dist/audio/AudioUtilities.js +39 -25
- package/dist/audio/AudioUtilities.js.map +1 -1
- package/dist/dsp/FFT.d.ts +2 -1
- package/dist/dsp/FFT.js +37 -18
- package/dist/dsp/FFT.js.map +1 -1
- package/dist/nlp/IPA.d.ts +3 -3
- package/dist/recognition/WhisperSTT.d.ts +3 -0
- package/dist/recognition/WhisperSTT.js +12 -5
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.d.ts +8 -3
- package/dist/source-separation/MDXNetSourceSeparation.js +35 -13
- package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -1
- package/dist/utilities/PackageManager.js +3 -6
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/WasmMemoryManager.d.ts +9 -1
- package/dist/utilities/WasmMemoryManager.js +24 -3
- package/dist/utilities/WasmMemoryManager.js.map +1 -1
- package/docs/Options.md +9 -9
- package/package.json +6 -5
- package/src/alignment/SpeechAlignment.ts +1 -1
- package/src/api/Alignment.ts +2 -2
- package/src/api/Denoising.ts +5 -4
- package/src/api/Recognition.ts +3 -3
- package/src/api/SourceSeparation.ts +12 -16
- package/src/api/SpeechLanguageDetection.ts +2 -2
- package/src/api/SpeechTranslation.ts +2 -2
- package/src/api/Synthesis.ts +5 -5
- package/src/api/TranslationAlignment.ts +2 -2
- package/src/audio/AudioUtilities.ts +53 -33
- package/src/dsp/FFT.ts +45 -19
- package/src/recognition/WhisperSTT.ts +18 -6
- package/src/source-separation/MDXNetSourceSeparation.ts +44 -12
- package/src/typings/Fillers.d.ts +2 -0
- package/src/utilities/PackageManager.ts +3 -7
- package/src/utilities/WasmMemoryManager.ts +38 -4
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
export class WasmMemoryManager {
|
|
2
2
|
wasmModule: any
|
|
3
3
|
|
|
4
|
+
private wasmAlloc: WasmAllocMethod
|
|
5
|
+
private wasmFree: WasmFreeMethod
|
|
6
|
+
|
|
4
7
|
private allocatedReferences = new Set<WasmRef>()
|
|
5
8
|
|
|
6
|
-
constructor(wasmModule: any) {
|
|
9
|
+
constructor(wasmModule: any, options?: WasmMemoryManagerOptions) {
|
|
10
|
+
options = options ?? {}
|
|
11
|
+
|
|
7
12
|
this.wasmModule = wasmModule
|
|
13
|
+
|
|
14
|
+
if (options.wasmAlloc) {
|
|
15
|
+
this.wasmAlloc = options.wasmAlloc
|
|
16
|
+
} else {
|
|
17
|
+
if (!wasmModule._malloc) {
|
|
18
|
+
throw new Error(`Couldn't find a '_malloc' function in the module and no custom 'wasmAlloc' was provided in the options`)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
this.wasmAlloc = wasmModule._malloc
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (options.wasmFree) {
|
|
25
|
+
this.wasmFree = options.wasmFree
|
|
26
|
+
} else {
|
|
27
|
+
if (!wasmModule._free) {
|
|
28
|
+
throw new Error(`Couldn't find a '_malloc' function in the module and no custom 'wasmFree' was provided in the options`)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
this.wasmFree = wasmModule._free
|
|
32
|
+
}
|
|
8
33
|
}
|
|
9
34
|
|
|
10
35
|
allocInt8() {
|
|
@@ -209,8 +234,9 @@ export class WasmMemoryManager {
|
|
|
209
234
|
}
|
|
210
235
|
|
|
211
236
|
private alloc(size: number) {
|
|
212
|
-
const ptr = this.
|
|
213
|
-
|
|
237
|
+
const ptr = this.wasmAlloc(size)
|
|
238
|
+
|
|
239
|
+
return ptr
|
|
214
240
|
}
|
|
215
241
|
|
|
216
242
|
free(wasmReference: WasmRef) {
|
|
@@ -218,7 +244,7 @@ export class WasmMemoryManager {
|
|
|
218
244
|
return
|
|
219
245
|
}
|
|
220
246
|
|
|
221
|
-
this.
|
|
247
|
+
this.wasmFree(wasmReference.address)
|
|
222
248
|
|
|
223
249
|
this.allocatedReferences.delete(wasmReference)
|
|
224
250
|
wasmReference.clearAddress()
|
|
@@ -514,3 +540,11 @@ export class Float64ArrayRef extends TypedArrayRef<Float64Array> {
|
|
|
514
540
|
|
|
515
541
|
export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array
|
|
516
542
|
export type WasmRef = ValueRef<number> | ValueRef<string> | TypedArrayRef<TypedArray>
|
|
543
|
+
|
|
544
|
+
export interface WasmMemoryManagerOptions {
|
|
545
|
+
wasmAlloc?: WasmAllocMethod
|
|
546
|
+
wasmFree?: WasmFreeMethod
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export type WasmAllocMethod = (size: number) => number
|
|
550
|
+
export type WasmFreeMethod = (address: number) => void
|