echogarden 2.1.2 → 2.2.1
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/README.md +6 -1
- package/data/lexicons/heteronyms.en.json +31 -6
- package/data/lexicons/words.en.json +60 -0
- package/data/schemas/options.json +20 -4
- package/dist/api/Recognition.d.ts +3 -1
- package/dist/api/Recognition.js +17 -0
- package/dist/api/Recognition.js.map +1 -1
- package/dist/api/Synthesis.d.ts +2 -2
- package/dist/api/Synthesis.js +3 -3
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/codecs/FFMpegTranscoder.js +2 -0
- package/dist/codecs/FFMpegTranscoder.js.map +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts +2 -2
- package/dist/nlp/EspeakPhonemizer.js +36 -36
- package/dist/nlp/PhoneConversion.d.ts +1 -0
- package/dist/nlp/PhoneConversion.js +151 -222
- package/dist/nlp/PhoneConversion.js.map +1 -1
- package/dist/recognition/DeepgramSTT.d.ts +11 -0
- package/dist/recognition/DeepgramSTT.js +64 -0
- package/dist/recognition/DeepgramSTT.js.map +1 -0
- package/dist/recognition/GoogleCloudSTT.js.map +1 -1
- package/dist/synthesis/{ElevenlabsTTS.d.ts → ElevenLabsTTS.d.ts} +3 -3
- package/dist/synthesis/{ElevenlabsTTS.js → ElevenLabsTTS.js} +3 -3
- package/dist/synthesis/{ElevenlabsTTS.js.map → ElevenLabsTTS.js.map} +1 -1
- package/dist/synthesis/EspeakTTS.d.ts +1 -1
- package/dist/synthesis/EspeakTTS.js +11 -7
- package/dist/synthesis/EspeakTTS.js.map +1 -1
- package/dist/synthesis/KokoroTTS.js +14 -14
- package/dist/synthesis/VitsTTS.js +9 -9
- package/dist/utilities/Utilities.d.ts +1 -0
- package/dist/utilities/Utilities.js +5 -0
- package/dist/utilities/Utilities.js.map +1 -1
- package/dist/utilities/WasmMemoryManager.d.ts +1 -1
- package/docs/CUDA.md +6 -6
- package/docs/Development.md +1 -1
- package/docs/Engines.md +1 -0
- package/docs/Options.md +5 -1
- package/package.json +6 -6
- package/src/api/Recognition.ts +29 -1
- package/src/api/Synthesis.ts +7 -7
- package/src/codecs/FFMpegTranscoder.ts +2 -0
- package/src/nlp/EspeakPhonemizer.ts +36 -36
- package/src/nlp/PhoneConversion.ts +176 -225
- package/src/recognition/DeepgramSTT.ts +136 -0
- package/src/recognition/GoogleCloudSTT.ts +0 -1
- package/src/synthesis/{ElevenlabsTTS.ts → ElevenLabsTTS.ts} +4 -4
- package/src/synthesis/EspeakTTS.ts +12 -7
- package/src/synthesis/KokoroTTS.ts +15 -15
- package/src/synthesis/VitsTTS.ts +9 -9
- package/src/utilities/Utilities.ts +6 -0
|
@@ -111,7 +111,7 @@ export class KokoroTTS {
|
|
|
111
111
|
|
|
112
112
|
logger.end()
|
|
113
113
|
|
|
114
|
-
const
|
|
114
|
+
const phraseBreakTokenId = charToTokenIDLookup[',']
|
|
115
115
|
const wordBreakTokenId = charToTokenIDLookup[' ']
|
|
116
116
|
|
|
117
117
|
let sentenceEndChar: string
|
|
@@ -128,11 +128,11 @@ export class KokoroTTS {
|
|
|
128
128
|
|
|
129
129
|
const allTokenIds: number[] = []
|
|
130
130
|
|
|
131
|
-
for (let
|
|
132
|
-
const
|
|
131
|
+
for (let phraseIndex = 0; phraseIndex < phonemizedSentence.length; phraseIndex++) {
|
|
132
|
+
const phrase = phonemizedSentence[phraseIndex]
|
|
133
133
|
|
|
134
|
-
for (let wordIndex = 0; wordIndex <
|
|
135
|
-
const word =
|
|
134
|
+
for (let wordIndex = 0; wordIndex < phrase.length; wordIndex++) {
|
|
135
|
+
const word = phrase[wordIndex]
|
|
136
136
|
|
|
137
137
|
for (const phoneme of word) {
|
|
138
138
|
let processedPhoneme = phoneme
|
|
@@ -154,11 +154,11 @@ export class KokoroTTS {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
if (wordIndex <
|
|
157
|
+
if (wordIndex < phrase.length - 1) {
|
|
158
158
|
allTokenIds.push(wordBreakTokenId)
|
|
159
159
|
} else {
|
|
160
|
-
if (
|
|
161
|
-
allTokenIds.push(
|
|
160
|
+
if (phraseIndex < phonemizedSentence.length - 1) {
|
|
161
|
+
allTokenIds.push(phraseBreakTokenId)
|
|
162
162
|
allTokenIds.push(wordBreakTokenId)
|
|
163
163
|
}
|
|
164
164
|
}
|
|
@@ -181,10 +181,10 @@ export class KokoroTTS {
|
|
|
181
181
|
if (endIndex >= allTokenIds.length) {
|
|
182
182
|
endIndex = allTokenIds.length
|
|
183
183
|
} else {
|
|
184
|
-
const
|
|
184
|
+
const indexOfLastPhraseBreak = indexOfLastMatchingNumberInRange(allTokenIds, phraseBreakTokenId, startIndex, endIndex)
|
|
185
185
|
|
|
186
|
-
if (
|
|
187
|
-
endIndex =
|
|
186
|
+
if (indexOfLastPhraseBreak !== -1) {
|
|
187
|
+
endIndex = indexOfLastPhraseBreak + 1
|
|
188
188
|
} else {
|
|
189
189
|
const indexOfLastWordBreak = indexOfLastMatchingNumberInRange(allTokenIds, wordBreakTokenId, startIndex, endIndex)
|
|
190
190
|
|
|
@@ -196,14 +196,14 @@ export class KokoroTTS {
|
|
|
196
196
|
|
|
197
197
|
const partTokenIds = allTokenIds.slice(startIndex, endIndex)
|
|
198
198
|
|
|
199
|
-
if (partTokenIds[partTokenIds.length - 1] ===
|
|
199
|
+
if (partTokenIds[partTokenIds.length - 1] === phraseBreakTokenId) {
|
|
200
200
|
partTokenIds.pop()
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
|
|
204
204
|
if (partTokenIds.find(
|
|
205
|
-
tokenId => ![wordBreakTokenId,
|
|
206
|
-
|
|
205
|
+
tokenId => ![wordBreakTokenId, phraseBreakTokenId, sentenceEndTokenId].includes(tokenId))) {
|
|
206
|
+
|
|
207
207
|
parts.push([0, ...partTokenIds, 0])
|
|
208
208
|
}
|
|
209
209
|
|
|
@@ -252,7 +252,7 @@ export class KokoroTTS {
|
|
|
252
252
|
|
|
253
253
|
const { alignUsingDtw } = await import('../alignment/SpeechAlignment.js')
|
|
254
254
|
|
|
255
|
-
const referenceWordTimeline = referenceTimeline.flatMap(
|
|
255
|
+
const referenceWordTimeline = referenceTimeline.flatMap(phrase => phrase.timeline!)
|
|
256
256
|
|
|
257
257
|
const dtwWindowDuration = Math.max(5, Math.ceil(0.2 * getRawAudioDuration(synthesizedAudio)))
|
|
258
258
|
const mappedTimeline = await alignUsingDtw(synthesizedAudio, referenceSynthesizedAudio, referenceWordTimeline, ['high'], [dtwWindowDuration])
|
package/src/synthesis/VitsTTS.ts
CHANGED
|
@@ -94,7 +94,7 @@ export class VitsTTS {
|
|
|
94
94
|
|
|
95
95
|
await logger.startAsync('Encode phonemes to identifiers')
|
|
96
96
|
|
|
97
|
-
const
|
|
97
|
+
const phraseEndBreaker = ','
|
|
98
98
|
let sentenceEndBreaker = '.'
|
|
99
99
|
|
|
100
100
|
if (sentence.endsWith('?') || sentence.endsWith(`?"`)) {
|
|
@@ -108,15 +108,15 @@ export class VitsTTS {
|
|
|
108
108
|
const startId = phonemeMap.get('^')!
|
|
109
109
|
const endId = phonemeMap.get('$')!
|
|
110
110
|
|
|
111
|
-
const
|
|
111
|
+
const phraseEndBreakerId = phonemeMap.get(phraseEndBreaker)!
|
|
112
112
|
const sentenceEndBreakerId = phonemeMap.get(sentenceEndBreaker)!
|
|
113
113
|
|
|
114
114
|
const ids: number[] = [...startId, ...phonemeCharacterSeparatorId]
|
|
115
115
|
|
|
116
|
-
for (let
|
|
117
|
-
const
|
|
116
|
+
for (let phraseIndex = 0; phraseIndex < phonemizedSentence.length; phraseIndex++) {
|
|
117
|
+
const phrase = phonemizedSentence[phraseIndex]
|
|
118
118
|
|
|
119
|
-
for (const word of
|
|
119
|
+
for (const word of phrase) {
|
|
120
120
|
for (const phoneme of word) {
|
|
121
121
|
for (const phonemeCharacter of phoneme) {
|
|
122
122
|
const id = phonemeMap.get(phonemeCharacter)
|
|
@@ -130,13 +130,13 @@ export class VitsTTS {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
if (
|
|
133
|
+
if (phraseIndex < phonemizedSentence.length - 1) {
|
|
134
134
|
ids.push(...wordSeparatorId, ...phonemeCharacterSeparatorId)
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
if (
|
|
139
|
-
ids.push(...
|
|
138
|
+
if (phraseIndex < phonemizedSentence.length - 1) {
|
|
139
|
+
ids.push(...phraseEndBreakerId, ...phonemeCharacterSeparatorId)
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -174,7 +174,7 @@ export class VitsTTS {
|
|
|
174
174
|
|
|
175
175
|
const { alignUsingDtw } = await import('../alignment/SpeechAlignment.js')
|
|
176
176
|
|
|
177
|
-
const referenceWordTimeline = referenceTimeline.flatMap(
|
|
177
|
+
const referenceWordTimeline = referenceTimeline.flatMap(phrase => phrase.timeline!)
|
|
178
178
|
|
|
179
179
|
const dtwWindowDuration = Math.max(5, Math.ceil(0.2 * getRawAudioDuration(synthesizedAudio)))
|
|
180
180
|
const mappedTimeline = await alignUsingDtw(synthesizedAudio, referenceSynthesizedAudio, referenceWordTimeline, ['high'], [dtwWindowDuration])
|
|
@@ -505,3 +505,9 @@ export function indexOfLastMatchingNumberInRange(values: number[], targetValue:
|
|
|
505
505
|
|
|
506
506
|
return -1
|
|
507
507
|
}
|
|
508
|
+
|
|
509
|
+
export function encodeHTMLAngleBrackets(text: string) {
|
|
510
|
+
return text.replaceAll('<', '<')
|
|
511
|
+
.replaceAll('>', '>')
|
|
512
|
+
.replaceAll('&', '&')
|
|
513
|
+
}
|