echogarden 2.5.2 → 2.7.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/lexicons/heteronyms.en.json +39 -5
- package/data/lexicons/words.en.json +1336 -1470
- package/dist/api/SourceSeparation.js +1 -1
- package/dist/audio/AudioBufferConversion.d.ts +5 -6
- package/dist/audio/AudioBufferConversion.js +16 -248
- package/dist/audio/AudioBufferConversion.js.map +1 -1
- package/dist/audio/AudioPlayer.js.map +1 -1
- package/dist/audio/AudioRecorder.js +1 -1
- package/dist/audio/AudioRecorder.js.map +1 -1
- package/dist/audio/AudioUtilities.d.ts +3 -9
- package/dist/audio/AudioUtilities.js +4 -3
- package/dist/audio/AudioUtilities.js.map +1 -1
- package/dist/codecs/FFMpegTranscoder.d.ts +1 -4
- package/dist/codecs/TIMITCodec.js +1 -2
- package/dist/codecs/TIMITCodec.js.map +1 -1
- package/dist/encodings/Ascii.js +1 -1
- package/dist/encodings/Ascii.js.map +1 -1
- package/dist/encodings/Utf16.js +1 -1
- package/dist/encodings/Utf16.js.map +1 -1
- package/dist/encodings/Utf8.js +1 -1
- package/dist/encodings/Utf8.js.map +1 -1
- package/dist/math/VectorMath.js +8 -7
- package/dist/math/VectorMath.js.map +1 -1
- package/dist/nlp/CompromiseNLP.js +4 -1
- package/dist/nlp/CompromiseNLP.js.map +1 -1
- package/dist/nlp/Lexicon.d.ts +1 -1
- package/dist/nlp/Lexicon.js +4 -1
- package/dist/nlp/Lexicon.js.map +1 -1
- package/dist/nlp/PhoneConversion.js +17 -5
- package/dist/nlp/PhoneConversion.js.map +1 -1
- package/dist/recognition/WhisperCppSTT.js +6 -3
- package/dist/recognition/WhisperCppSTT.js.map +1 -1
- package/dist/recognition/WhisperSTT.js +18 -17
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/synthesis/AwsPollyTTS.d.ts +1 -4
- package/dist/synthesis/CoquiServerTTS.d.ts +1 -4
- package/dist/synthesis/DeepgramTTS.d.ts +1 -4
- package/dist/synthesis/ElevenLabsTTS.d.ts +1 -4
- package/dist/synthesis/FliteTTS.d.ts +1 -4
- package/dist/synthesis/GnuSpeechTTS.d.ts +1 -7
- package/dist/synthesis/GoogleCloudTTS.d.ts +1 -4
- package/dist/synthesis/SapiTTS.js +1 -2
- package/dist/synthesis/SapiTTS.js.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.js +1 -2
- package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
- package/dist/utilities/PackageManager.js +4 -3
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/StringUtilities.d.ts +2 -2
- package/dist/utilities/StringUtilities.js +7 -7
- package/dist/utilities/StringUtilities.js.map +1 -1
- package/dist/utilities/Utilities.d.ts +1 -0
- package/dist/utilities/Utilities.js +48 -0
- package/dist/utilities/Utilities.js.map +1 -1
- package/dist/utilities/WasmMemoryManager.d.ts +1 -1
- package/docs/Options.md +2 -2
- package/package.json +7 -7
- package/src/api/SourceSeparation.ts +1 -1
- package/src/audio/AudioBufferConversion.ts +17 -263
- package/src/audio/AudioPlayer.ts +1 -1
- package/src/audio/AudioRecorder.ts +1 -1
- package/src/audio/AudioUtilities.ts +5 -3
- package/src/codecs/TIMITCodec.ts +1 -2
- package/src/encodings/Ascii.ts +1 -1
- package/src/encodings/Utf16.ts +1 -1
- package/src/encodings/Utf8.ts +1 -1
- package/src/math/VectorMath.ts +9 -7
- package/src/nlp/CompromiseNLP.ts +5 -1
- package/src/nlp/Lexicon.ts +6 -2
- package/src/nlp/PhoneConversion.ts +20 -6
- package/src/recognition/WhisperCppSTT.ts +5 -3
- package/src/recognition/WhisperSTT.ts +19 -18
- package/src/synthesis/SapiTTS.ts +1 -2
- package/src/synthesis/SvoxPicoTTS.ts +1 -2
- package/src/utilities/PackageManager.ts +4 -3
- package/src/utilities/StringUtilities.ts +7 -7
- package/src/utilities/Utilities.ts +64 -0
- package/dist/codecs/WaveCodec.d.ts +0 -19
- package/dist/codecs/WaveCodec.js +0 -224
- package/dist/codecs/WaveCodec.js.map +0 -1
- package/dist/utilities/BinaryArrayConversion.d.ts +0 -14
- package/dist/utilities/BinaryArrayConversion.js +0 -92
- package/dist/utilities/BinaryArrayConversion.js.map +0 -1
- package/src/codecs/WaveCodec.ts +0 -281
- package/src/utilities/BinaryArrayConversion.ts +0 -117
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
// Typed arrays to Uint8Array buffers (little endian) conversions
|
|
2
|
-
//
|
|
3
|
-
// The conversion methods (other than the methods for int8 and int24) would only work correctly
|
|
4
|
-
// on little-endian architectures, since they assume the byte order of the underlying architecture.
|
|
5
|
-
//
|
|
6
|
-
// Since Echogarden only supports little-endian architectures, this shouldn't matter.
|
|
7
|
-
|
|
8
|
-
// int8 <-> bufferLE
|
|
9
|
-
export function int8ToBuffer(int8s: Int8Array) {
|
|
10
|
-
return new Uint8Array(int8s.buffer, int8s.byteOffset, int8s.byteLength)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function bufferToInt8(buffer: Uint8Array) {
|
|
14
|
-
return new Int8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// int16 <-> bufferLE
|
|
18
|
-
export function int16ToBufferLE(int16s: Int16Array) {
|
|
19
|
-
return new Uint8Array(int16s.buffer, int16s.byteOffset, int16s.byteLength)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function bufferLEToInt16(buffer: Uint8Array) {
|
|
23
|
-
return new Int16Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / 2)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// int24 <-> bufferLE (uses int32 for storage)
|
|
27
|
-
export function int24ToBufferLE(int24s: Int32Array) {
|
|
28
|
-
const buffer = new Uint8Array(int24s.length * 3)
|
|
29
|
-
|
|
30
|
-
let readOffset = 0
|
|
31
|
-
let writeOffset = 0
|
|
32
|
-
|
|
33
|
-
while (readOffset < int24s.length) {
|
|
34
|
-
const signedValue = int24s[readOffset++]
|
|
35
|
-
|
|
36
|
-
let unsignedValue: number
|
|
37
|
-
|
|
38
|
-
if (signedValue >= 0) {
|
|
39
|
-
unsignedValue = signedValue
|
|
40
|
-
} else {
|
|
41
|
-
unsignedValue = signedValue + (2 ** 24)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
buffer[writeOffset++] = (unsignedValue) & 0xff
|
|
45
|
-
buffer[writeOffset++] = (unsignedValue >> 8) & 0xff
|
|
46
|
-
buffer[writeOffset++] = (unsignedValue >> 16) & 0xff
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return buffer
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function bufferLEToInt24(buffer: Uint8Array) {
|
|
53
|
-
if (buffer.length % 3 !== 0) {
|
|
54
|
-
throw new Error(`Buffer has a length of ${buffer.length}, which is not a multiple of 3`)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const result = new Int32Array(buffer.length / 3)
|
|
58
|
-
|
|
59
|
-
let readOffset = 0
|
|
60
|
-
let writeOffset = 0
|
|
61
|
-
|
|
62
|
-
while (writeOffset < result.length) {
|
|
63
|
-
const b0 = buffer[readOffset++]
|
|
64
|
-
const b1 = buffer[readOffset++]
|
|
65
|
-
const b2 = buffer[readOffset++]
|
|
66
|
-
|
|
67
|
-
const unsignedValue = (b0) | (b1 << 8) | (b2 << 16)
|
|
68
|
-
|
|
69
|
-
let signedValue: number
|
|
70
|
-
|
|
71
|
-
if (unsignedValue < 2 ** 23) {
|
|
72
|
-
signedValue = unsignedValue
|
|
73
|
-
} else {
|
|
74
|
-
signedValue = unsignedValue - (2 ** 24)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
result[writeOffset++] = signedValue
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return result
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// int32 <-> bufferLE
|
|
84
|
-
export function int32ToBufferLE(int32s: Int32Array) {
|
|
85
|
-
return new Uint8Array(int32s.buffer, int32s.byteOffset, int32s.byteLength)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function bufferLEToInt32(buffer: Uint8Array) {
|
|
89
|
-
return new Int32Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / 4)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// float32 <-> bufferLE
|
|
93
|
-
export function float32ToBufferLE(float32s: Float32Array) {
|
|
94
|
-
return new Uint8Array(float32s.buffer, float32s.byteOffset, float32s.byteLength)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function bufferLEToFloat32(buffer: Uint8Array) {
|
|
98
|
-
return new Float32Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / 4)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// float64 <-> bufferLE
|
|
102
|
-
export function float64ToBufferLE(float64s: Float64Array) {
|
|
103
|
-
return new Uint8Array(float64s.buffer, float64s.byteOffset, float64s.byteLength)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export function bufferLEToFloat64(buffer: Uint8Array) {
|
|
107
|
-
return new Float64Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / 8)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// float64 <-> float32
|
|
111
|
-
export function float64Tofloat32(float64s: Float64Array) {
|
|
112
|
-
return Float32Array.from(float64s)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export function float32Tofloat64(float32s: Float32Array) {
|
|
116
|
-
return Float64Array.from(float32s)
|
|
117
|
-
}
|