echogarden 2.10.2 → 3.0.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.
Files changed (496) hide show
  1. package/LICENSE.MIT.md +7 -0
  2. package/README.md +9 -1
  3. package/data/lexicons/heteronyms.en.json +44 -10
  4. package/data/lexicons/words.en.json +726 -22
  5. package/data/schemas/options.json +91 -153
  6. package/dist/alignment/DTWMfccSequenceAlignment.js.map +1 -1
  7. package/dist/alignment/SemanticTextAlignment.d.ts +4 -2
  8. package/dist/alignment/SemanticTextAlignment.d.ts.map +1 -1
  9. package/dist/alignment/SemanticTextAlignment.js +7 -7
  10. package/dist/alignment/SemanticTextAlignment.js.map +1 -1
  11. package/dist/alignment/SpeechAlignment.d.ts +9 -10
  12. package/dist/alignment/SpeechAlignment.d.ts.map +1 -1
  13. package/dist/alignment/SpeechAlignment.js +23 -96
  14. package/dist/alignment/SpeechAlignment.js.map +1 -1
  15. package/dist/api/APIOptions.d.ts +1 -1
  16. package/dist/api/APIOptions.d.ts.map +1 -1
  17. package/dist/api/Alignment.d.ts +8 -6
  18. package/dist/api/Alignment.d.ts.map +1 -1
  19. package/dist/api/Alignment.js +31 -40
  20. package/dist/api/Alignment.js.map +1 -1
  21. package/dist/api/Common.d.ts +7 -0
  22. package/dist/api/Common.d.ts.map +1 -1
  23. package/dist/api/Common.js.map +1 -1
  24. package/dist/api/Denoising.d.ts +5 -2
  25. package/dist/api/Denoising.d.ts.map +1 -1
  26. package/dist/api/Denoising.js +15 -15
  27. package/dist/api/Denoising.js.map +1 -1
  28. package/dist/api/GlobalOptions.d.ts +2 -8
  29. package/dist/api/GlobalOptions.d.ts.map +1 -1
  30. package/dist/api/GlobalOptions.js +2 -13
  31. package/dist/api/GlobalOptions.js.map +1 -1
  32. package/dist/api/Recognition.d.ts +11 -12
  33. package/dist/api/Recognition.d.ts.map +1 -1
  34. package/dist/api/Recognition.js +32 -82
  35. package/dist/api/Recognition.js.map +1 -1
  36. package/dist/api/SourceSeparation.d.ts +7 -2
  37. package/dist/api/SourceSeparation.d.ts.map +1 -1
  38. package/dist/api/SourceSeparation.js +12 -10
  39. package/dist/api/SourceSeparation.js.map +1 -1
  40. package/dist/api/SpeechLanguageDetection.d.ts +11 -7
  41. package/dist/api/SpeechLanguageDetection.d.ts.map +1 -1
  42. package/dist/api/SpeechLanguageDetection.js +37 -30
  43. package/dist/api/SpeechLanguageDetection.js.map +1 -1
  44. package/dist/api/SpeechSearch.d.ts +4 -1
  45. package/dist/api/SpeechSearch.d.ts.map +1 -1
  46. package/dist/api/SpeechSearch.js.map +1 -1
  47. package/dist/api/SpeechTranslation.d.ts +10 -6
  48. package/dist/api/SpeechTranslation.d.ts.map +1 -1
  49. package/dist/api/SpeechTranslation.js +28 -26
  50. package/dist/api/SpeechTranslation.js.map +1 -1
  51. package/dist/api/Synthesis.d.ts +13 -8
  52. package/dist/api/Synthesis.d.ts.map +1 -1
  53. package/dist/api/Synthesis.js +67 -89
  54. package/dist/api/Synthesis.js.map +1 -1
  55. package/dist/api/TextLanguageDetection.d.ts +4 -2
  56. package/dist/api/TextLanguageDetection.d.ts.map +1 -1
  57. package/dist/api/TextLanguageDetection.js +4 -7
  58. package/dist/api/TextLanguageDetection.js.map +1 -1
  59. package/dist/api/TextTranslation.d.ts +4 -2
  60. package/dist/api/TextTranslation.d.ts.map +1 -1
  61. package/dist/api/TextTranslation.js +13 -24
  62. package/dist/api/TextTranslation.js.map +1 -1
  63. package/dist/api/TimelineTranslationAlignment.d.ts +6 -3
  64. package/dist/api/TimelineTranslationAlignment.d.ts.map +1 -1
  65. package/dist/api/TimelineTranslationAlignment.js +20 -11
  66. package/dist/api/TimelineTranslationAlignment.js.map +1 -1
  67. package/dist/api/TranscriptAndTranslationAlignment.d.ts +6 -4
  68. package/dist/api/TranscriptAndTranslationAlignment.d.ts.map +1 -1
  69. package/dist/api/TranscriptAndTranslationAlignment.js +11 -12
  70. package/dist/api/TranscriptAndTranslationAlignment.js.map +1 -1
  71. package/dist/api/TranslationAlignment.d.ts +6 -4
  72. package/dist/api/TranslationAlignment.d.ts.map +1 -1
  73. package/dist/api/TranslationAlignment.js +20 -21
  74. package/dist/api/TranslationAlignment.js.map +1 -1
  75. package/dist/api/VoiceActivityDetection.d.ts +9 -8
  76. package/dist/api/VoiceActivityDetection.d.ts.map +1 -1
  77. package/dist/api/VoiceActivityDetection.js +20 -43
  78. package/dist/api/VoiceActivityDetection.js.map +1 -1
  79. package/dist/audio/AudioBufferConversion.js.map +1 -1
  80. package/dist/audio/AudioPlayer.d.ts +1 -3
  81. package/dist/audio/AudioPlayer.d.ts.map +1 -1
  82. package/dist/audio/AudioPlayer.js +3 -188
  83. package/dist/audio/AudioPlayer.js.map +1 -1
  84. package/dist/audio/AudioUtilities.d.ts +2 -1
  85. package/dist/audio/AudioUtilities.d.ts.map +1 -1
  86. package/dist/audio/AudioUtilities.js +2 -2
  87. package/dist/audio/AudioUtilities.js.map +1 -1
  88. package/dist/build-tools/MakeTarballsForInstalledPackages.js +3 -3
  89. package/dist/build-tools/MakeTarballsForInstalledPackages.js.map +1 -1
  90. package/dist/cli/CLI.d.ts.map +1 -1
  91. package/dist/cli/CLI.js +139 -92
  92. package/dist/cli/CLI.js.map +1 -1
  93. package/dist/codecs/FFMpegTranscoder.d.ts +4 -3
  94. package/dist/codecs/FFMpegTranscoder.d.ts.map +1 -1
  95. package/dist/codecs/FFMpegTranscoder.js +16 -14
  96. package/dist/codecs/FFMpegTranscoder.js.map +1 -1
  97. package/dist/codecs/TIMITCodec.d.ts.map +1 -1
  98. package/dist/data-structures/DynamicTypedArray.d.ts.map +1 -1
  99. package/dist/data-structures/DynamicTypedArray.js.map +1 -1
  100. package/dist/data-structures/Queue.d.ts.map +1 -1
  101. package/dist/data-structures/WindowedList.d.ts.map +1 -1
  102. package/dist/data-structures/WindowedList.js.map +1 -1
  103. package/dist/denoising/NSNet2.d.ts +3 -2
  104. package/dist/denoising/NSNet2.d.ts.map +1 -1
  105. package/dist/denoising/NSNet2.js +4 -4
  106. package/dist/denoising/NSNet2.js.map +1 -1
  107. package/dist/denoising/RNNoise.d.ts +2 -1
  108. package/dist/denoising/RNNoise.d.ts.map +1 -1
  109. package/dist/denoising/RNNoise.js +10 -6
  110. package/dist/denoising/RNNoise.js.map +1 -1
  111. package/dist/dsp/BiquadFilter.d.ts.map +1 -1
  112. package/dist/dsp/DecayingPeakEstimator.d.ts.map +1 -1
  113. package/dist/dsp/DecayingPeakEstimator.js.map +1 -1
  114. package/dist/dsp/FFT.d.ts.map +1 -1
  115. package/dist/dsp/FFT.js +2 -1
  116. package/dist/dsp/FFT.js.map +1 -1
  117. package/dist/dsp/KWeightingFilter.d.ts.map +1 -1
  118. package/dist/dsp/KWeightingFilter.js.map +1 -1
  119. package/dist/dsp/LoudnessEstimator.d.ts.map +1 -1
  120. package/dist/dsp/LoudnessEstimator.js.map +1 -1
  121. package/dist/dsp/MFCC.d.ts +3 -2
  122. package/dist/dsp/MFCC.d.ts.map +1 -1
  123. package/dist/dsp/MFCC.js +4 -4
  124. package/dist/dsp/MFCC.js.map +1 -1
  125. package/dist/dsp/MelSpectrogram.d.ts +10 -8
  126. package/dist/dsp/MelSpectrogram.d.ts.map +1 -1
  127. package/dist/dsp/MelSpectrogram.js +31 -34
  128. package/dist/dsp/MelSpectrogram.js.map +1 -1
  129. package/dist/dsp/Rubberband.d.ts.map +1 -1
  130. package/dist/dsp/Rubberband.js +8 -3
  131. package/dist/dsp/Rubberband.js.map +1 -1
  132. package/dist/dsp/Sonic.d.ts.map +1 -1
  133. package/dist/dsp/Sonic.js +1 -1
  134. package/dist/dsp/Sonic.js.map +1 -1
  135. package/dist/dsp/SpeexResampler.d.ts.map +1 -1
  136. package/dist/dsp/SpeexResampler.js +1 -1
  137. package/dist/dsp/SpeexResampler.js.map +1 -1
  138. package/dist/encodings/Ascii.d.ts +1 -1
  139. package/dist/encodings/Ascii.d.ts.map +1 -1
  140. package/dist/encodings/Base64.js.map +1 -1
  141. package/dist/encodings/Utf16.d.ts.map +1 -1
  142. package/dist/encodings/Utf8.d.ts.map +1 -1
  143. package/dist/math/VectorMath.d.ts +1 -0
  144. package/dist/math/VectorMath.d.ts.map +1 -1
  145. package/dist/math/VectorMath.js +9 -5
  146. package/dist/math/VectorMath.js.map +1 -1
  147. package/dist/nlp/ChineseSegmentation.d.ts +1 -1
  148. package/dist/nlp/ChineseSegmentation.d.ts.map +1 -1
  149. package/dist/nlp/EspeakPhonemizer.d.ts +1 -1
  150. package/dist/nlp/EspeakPhonemizer.d.ts.map +1 -1
  151. package/dist/nlp/EspeakPhonemizer.js +2 -2
  152. package/dist/nlp/EspeakPhonemizer.js.map +1 -1
  153. package/dist/nlp/IPA.d.ts +2 -2
  154. package/dist/nlp/Segmentation.d.ts +1 -1
  155. package/dist/nlp/Segmentation.d.ts.map +1 -1
  156. package/dist/nlp/Segmentation.js +8 -4
  157. package/dist/nlp/Segmentation.js.map +1 -1
  158. package/dist/recognition/AmazonTranscribeSTT.d.ts +2 -1
  159. package/dist/recognition/AmazonTranscribeSTT.d.ts.map +1 -1
  160. package/dist/recognition/AmazonTranscribeSTT.js +3 -3
  161. package/dist/recognition/AmazonTranscribeSTT.js.map +1 -1
  162. package/dist/recognition/AzureCognitiveServicesSTT.d.ts +2 -1
  163. package/dist/recognition/AzureCognitiveServicesSTT.d.ts.map +1 -1
  164. package/dist/recognition/AzureCognitiveServicesSTT.js +4 -4
  165. package/dist/recognition/AzureCognitiveServicesSTT.js.map +1 -1
  166. package/dist/recognition/DeepgramSTT.d.ts +2 -1
  167. package/dist/recognition/DeepgramSTT.d.ts.map +1 -1
  168. package/dist/recognition/DeepgramSTT.js +12 -13
  169. package/dist/recognition/DeepgramSTT.js.map +1 -1
  170. package/dist/recognition/GoogleCloudSTT.d.ts +2 -1
  171. package/dist/recognition/GoogleCloudSTT.d.ts.map +1 -1
  172. package/dist/recognition/GoogleCloudSTT.js +11 -10
  173. package/dist/recognition/GoogleCloudSTT.js.map +1 -1
  174. package/dist/recognition/OpenAICloudSTT.d.ts +2 -1
  175. package/dist/recognition/OpenAICloudSTT.d.ts.map +1 -1
  176. package/dist/recognition/OpenAICloudSTT.js +6 -6
  177. package/dist/recognition/OpenAICloudSTT.js.map +1 -1
  178. package/dist/recognition/WhisperCommon.d.ts +9 -0
  179. package/dist/recognition/WhisperCommon.d.ts.map +1 -0
  180. package/dist/recognition/WhisperCommon.js +52 -0
  181. package/dist/recognition/WhisperCommon.js.map +1 -0
  182. package/dist/recognition/{WhisperCppSTT.d.ts → WhisperCppCliSTT.d.ts} +14 -16
  183. package/dist/recognition/WhisperCppCliSTT.d.ts.map +1 -0
  184. package/dist/recognition/{WhisperCppSTT.js → WhisperCppCliSTT.js} +55 -84
  185. package/dist/recognition/WhisperCppCliSTT.js.map +1 -0
  186. package/dist/recognition/WhisperSTT.d.ts +72 -85
  187. package/dist/recognition/WhisperSTT.d.ts.map +1 -1
  188. package/dist/recognition/WhisperSTT.js +384 -519
  189. package/dist/recognition/WhisperSTT.js.map +1 -1
  190. package/dist/server/Client.d.ts +2 -2
  191. package/dist/server/Client.d.ts.map +1 -1
  192. package/dist/server/Client.js.map +1 -1
  193. package/dist/server/Worker.d.ts +6 -7
  194. package/dist/server/Worker.d.ts.map +1 -1
  195. package/dist/server/Worker.js +42 -44
  196. package/dist/server/Worker.js.map +1 -1
  197. package/dist/source-separation/MDXNetSourceSeparation.d.ts +3 -2
  198. package/dist/source-separation/MDXNetSourceSeparation.d.ts.map +1 -1
  199. package/dist/source-separation/MDXNetSourceSeparation.js +10 -8
  200. package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -1
  201. package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts +3 -2
  202. package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts.map +1 -1
  203. package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js +5 -5
  204. package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js.map +1 -1
  205. package/dist/speech-language-detection/SileroLanguageDetection.d.ts +5 -3
  206. package/dist/speech-language-detection/SileroLanguageDetection.d.ts.map +1 -1
  207. package/dist/speech-language-detection/SileroLanguageDetection.js +8 -8
  208. package/dist/speech-language-detection/SileroLanguageDetection.js.map +1 -1
  209. package/dist/speech-search/DTWSpeechSearch.d.ts +2 -1
  210. package/dist/speech-search/DTWSpeechSearch.d.ts.map +1 -1
  211. package/dist/speech-search/DTWSpeechSearch.js +4 -4
  212. package/dist/speech-search/DTWSpeechSearch.js.map +1 -1
  213. package/dist/subtitles/Subtitles.d.ts +13 -1
  214. package/dist/subtitles/Subtitles.d.ts.map +1 -1
  215. package/dist/subtitles/Subtitles.js +22 -22
  216. package/dist/subtitles/Subtitles.js.map +1 -1
  217. package/dist/synthesis/AwsPollyTTS.d.ts +3 -2
  218. package/dist/synthesis/AwsPollyTTS.d.ts.map +1 -1
  219. package/dist/synthesis/AwsPollyTTS.js +5 -5
  220. package/dist/synthesis/AwsPollyTTS.js.map +1 -1
  221. package/dist/synthesis/AzureCognitiveServicesTTS.d.ts +2 -1
  222. package/dist/synthesis/AzureCognitiveServicesTTS.d.ts.map +1 -1
  223. package/dist/synthesis/AzureCognitiveServicesTTS.js +3 -3
  224. package/dist/synthesis/AzureCognitiveServicesTTS.js.map +1 -1
  225. package/dist/synthesis/CoquiServerTTS.d.ts +2 -1
  226. package/dist/synthesis/CoquiServerTTS.d.ts.map +1 -1
  227. package/dist/synthesis/CoquiServerTTS.js +7 -8
  228. package/dist/synthesis/CoquiServerTTS.js.map +1 -1
  229. package/dist/synthesis/DeepgramTTS.d.ts +2 -2
  230. package/dist/synthesis/DeepgramTTS.d.ts.map +1 -1
  231. package/dist/synthesis/DeepgramTTS.js +13 -13
  232. package/dist/synthesis/DeepgramTTS.js.map +1 -1
  233. package/dist/synthesis/ElevenLabsTTS.d.ts +3 -3
  234. package/dist/synthesis/ElevenLabsTTS.d.ts.map +1 -1
  235. package/dist/synthesis/ElevenLabsTTS.js +22 -21
  236. package/dist/synthesis/ElevenLabsTTS.js.map +1 -1
  237. package/dist/synthesis/EspeakTTS.d.ts +11 -9
  238. package/dist/synthesis/EspeakTTS.d.ts.map +1 -1
  239. package/dist/synthesis/EspeakTTS.js +118 -68
  240. package/dist/synthesis/EspeakTTS.js.map +1 -1
  241. package/dist/synthesis/FliteTTS.d.ts +2 -2
  242. package/dist/synthesis/FliteTTS.d.ts.map +1 -1
  243. package/dist/synthesis/FliteTTS.js +2 -2
  244. package/dist/synthesis/FliteTTS.js.map +1 -1
  245. package/dist/synthesis/GnuSpeechTTS.d.ts +2 -2
  246. package/dist/synthesis/GnuSpeechTTS.d.ts.map +1 -1
  247. package/dist/synthesis/GnuSpeechTTS.js +1 -1
  248. package/dist/synthesis/GnuSpeechTTS.js.map +1 -1
  249. package/dist/synthesis/GoogleCloudTTS.d.ts +3 -2
  250. package/dist/synthesis/GoogleCloudTTS.d.ts.map +1 -1
  251. package/dist/synthesis/GoogleCloudTTS.js +15 -14
  252. package/dist/synthesis/GoogleCloudTTS.js.map +1 -1
  253. package/dist/synthesis/GoogleTranslateTTS.d.ts +3 -2
  254. package/dist/synthesis/GoogleTranslateTTS.d.ts.map +1 -1
  255. package/dist/synthesis/GoogleTranslateTTS.js +11 -11
  256. package/dist/synthesis/GoogleTranslateTTS.js.map +1 -1
  257. package/dist/synthesis/KokoroTTS.d.ts +4 -4
  258. package/dist/synthesis/KokoroTTS.d.ts.map +1 -1
  259. package/dist/synthesis/KokoroTTS.js +11 -10
  260. package/dist/synthesis/KokoroTTS.js.map +1 -1
  261. package/dist/synthesis/MicrosoftEdgeTTS.d.ts +4 -3
  262. package/dist/synthesis/MicrosoftEdgeTTS.d.ts.map +1 -1
  263. package/dist/synthesis/MicrosoftEdgeTTS.js +41 -20
  264. package/dist/synthesis/MicrosoftEdgeTTS.js.map +1 -1
  265. package/dist/synthesis/OpenAICloudTTS.d.ts +2 -2
  266. package/dist/synthesis/OpenAICloudTTS.d.ts.map +1 -1
  267. package/dist/synthesis/OpenAICloudTTS.js +6 -5
  268. package/dist/synthesis/OpenAICloudTTS.js.map +1 -1
  269. package/dist/synthesis/SamTTS.d.ts +2 -1
  270. package/dist/synthesis/SamTTS.d.ts.map +1 -1
  271. package/dist/synthesis/SamTTS.js +2 -2
  272. package/dist/synthesis/SamTTS.js.map +1 -1
  273. package/dist/synthesis/SapiTTS.d.ts +2 -2
  274. package/dist/synthesis/SapiTTS.d.ts.map +1 -1
  275. package/dist/synthesis/SapiTTS.js +2 -2
  276. package/dist/synthesis/SapiTTS.js.map +1 -1
  277. package/dist/synthesis/SvoxPicoTTS.d.ts +2 -2
  278. package/dist/synthesis/SvoxPicoTTS.d.ts.map +1 -1
  279. package/dist/synthesis/SvoxPicoTTS.js +3 -3
  280. package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
  281. package/dist/synthesis/VitsTTS.d.ts +3 -3
  282. package/dist/synthesis/VitsTTS.d.ts.map +1 -1
  283. package/dist/synthesis/VitsTTS.js +14 -11
  284. package/dist/synthesis/VitsTTS.js.map +1 -1
  285. package/dist/text-translation/DeepLTextTranslation.d.ts +2 -2
  286. package/dist/text-translation/DeepLTextTranslation.d.ts.map +1 -1
  287. package/dist/text-translation/DeepLTextTranslation.js +10 -9
  288. package/dist/text-translation/DeepLTextTranslation.js.map +1 -1
  289. package/dist/text-translation/GoogleTranslateTextTranslation.d.ts +4 -4
  290. package/dist/text-translation/GoogleTranslateTextTranslation.d.ts.map +1 -1
  291. package/dist/text-translation/GoogleTranslateTextTranslation.js +20 -18
  292. package/dist/text-translation/GoogleTranslateTextTranslation.js.map +1 -1
  293. package/dist/text-translation/NLLBTextTranslation.d.ts +2 -2
  294. package/dist/text-translation/NLLBTextTranslation.d.ts.map +1 -1
  295. package/dist/text-translation/NLLBTextTranslation.js +4 -6
  296. package/dist/text-translation/NLLBTextTranslation.js.map +1 -1
  297. package/dist/typings/TypedArray.d.ts.map +1 -1
  298. package/dist/utilities/Compression.d.ts +4 -3
  299. package/dist/utilities/Compression.d.ts.map +1 -1
  300. package/dist/utilities/Compression.js +9 -9
  301. package/dist/utilities/Compression.js.map +1 -1
  302. package/dist/utilities/FileDownloader.d.ts +6 -3
  303. package/dist/utilities/FileDownloader.d.ts.map +1 -1
  304. package/dist/utilities/FileDownloader.js +25 -21
  305. package/dist/utilities/FileDownloader.js.map +1 -1
  306. package/dist/utilities/FileReader.d.ts.map +1 -1
  307. package/dist/utilities/FileReader.js.map +1 -1
  308. package/dist/utilities/FileSystem.js +1 -1
  309. package/dist/utilities/FileSystem.js.map +1 -1
  310. package/dist/utilities/FileWriter.d.ts.map +1 -1
  311. package/dist/utilities/FileWriter.js.map +1 -1
  312. package/dist/utilities/Hashing.d.ts.map +1 -1
  313. package/dist/utilities/Hashing.js.map +1 -1
  314. package/dist/utilities/Locale.js.map +1 -1
  315. package/dist/utilities/Logger.d.ts +17 -9
  316. package/dist/utilities/Logger.d.ts.map +1 -1
  317. package/dist/utilities/Logger.js +50 -35
  318. package/dist/utilities/Logger.js.map +1 -1
  319. package/dist/utilities/NpmUtilities.d.ts.map +1 -1
  320. package/dist/utilities/NpmUtilities.js +4 -5
  321. package/dist/utilities/NpmUtilities.js.map +1 -1
  322. package/dist/utilities/ObjectUtilities.js.map +1 -1
  323. package/dist/utilities/OpenPromise.d.ts.map +1 -1
  324. package/dist/utilities/OpenPromise.js.map +1 -1
  325. package/dist/utilities/PackageManager.d.ts +4 -1
  326. package/dist/utilities/PackageManager.d.ts.map +1 -1
  327. package/dist/utilities/PackageManager.js +37 -22
  328. package/dist/utilities/PackageManager.js.map +1 -1
  329. package/dist/utilities/PathUtilities.d.ts +2 -0
  330. package/dist/utilities/PathUtilities.d.ts.map +1 -1
  331. package/dist/utilities/PathUtilities.js +5 -2
  332. package/dist/utilities/PathUtilities.js.map +1 -1
  333. package/dist/utilities/RandomGenerator.d.ts.map +1 -1
  334. package/dist/utilities/SignalChannel.d.ts.map +1 -1
  335. package/dist/utilities/SmoothEstimator.d.ts.map +1 -1
  336. package/dist/utilities/SmoothEstimator.js.map +1 -1
  337. package/dist/utilities/StringBuilder.d.ts.map +1 -1
  338. package/dist/utilities/TarballMaker.d.ts +4 -3
  339. package/dist/utilities/TarballMaker.d.ts.map +1 -1
  340. package/dist/utilities/TarballMaker.js +6 -6
  341. package/dist/utilities/TarballMaker.js.map +1 -1
  342. package/dist/utilities/Timeline.js.map +1 -1
  343. package/dist/utilities/Timer.d.ts.map +1 -1
  344. package/dist/utilities/Utilities.d.ts +9 -7
  345. package/dist/utilities/Utilities.d.ts.map +1 -1
  346. package/dist/utilities/Utilities.js +49 -33
  347. package/dist/utilities/Utilities.js.map +1 -1
  348. package/dist/utilities/VirtualFileReadStream.d.ts.map +1 -1
  349. package/dist/utilities/WebReader.d.ts +2 -1
  350. package/dist/utilities/WebReader.d.ts.map +1 -1
  351. package/dist/utilities/WebReader.js +7 -6
  352. package/dist/utilities/WebReader.js.map +1 -1
  353. package/dist/utilities/WikipediaReader.d.ts +2 -1
  354. package/dist/utilities/WikipediaReader.d.ts.map +1 -1
  355. package/dist/utilities/WikipediaReader.js +1 -5
  356. package/dist/utilities/WikipediaReader.js.map +1 -1
  357. package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts +2 -1
  358. package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts.map +1 -1
  359. package/dist/voice-activity-detection/AdaptiveGateVAD.js +1 -1
  360. package/dist/voice-activity-detection/AdaptiveGateVAD.js.map +1 -1
  361. package/dist/voice-activity-detection/SileroVAD.d.ts.map +1 -1
  362. package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
  363. package/dist/voice-activity-detection/WebRtcVAD.d.ts.map +1 -1
  364. package/dist/voice-activity-detection/WebRtcVAD.js +1 -1
  365. package/dist/voice-activity-detection/WebRtcVAD.js.map +1 -1
  366. package/docs/API.md +62 -17
  367. package/docs/CUDA.md +4 -3
  368. package/docs/Engines.md +8 -7
  369. package/docs/Licenses.md +0 -3
  370. package/docs/Options.md +27 -31
  371. package/docs/Server.md +1 -0
  372. package/docs/Tasklist.md +2 -1
  373. package/docs/Technical.md +2 -2
  374. package/package.json +45 -35
  375. package/src/alignment/SemanticTextAlignment.ts +14 -7
  376. package/src/alignment/SpeechAlignment.ts +47 -150
  377. package/src/api/APIOptions.ts +1 -1
  378. package/src/api/Alignment.ts +95 -61
  379. package/src/api/Common.ts +11 -0
  380. package/src/api/Denoising.ts +22 -17
  381. package/src/api/GlobalOptions.ts +4 -20
  382. package/src/api/Recognition.ts +106 -123
  383. package/src/api/SourceSeparation.ts +39 -21
  384. package/src/api/SpeechLanguageDetection.ts +77 -37
  385. package/src/api/SpeechSearch.ts +6 -1
  386. package/src/api/SpeechTranslation.ts +75 -38
  387. package/src/api/Synthesis.ts +220 -116
  388. package/src/api/TextLanguageDetection.ts +10 -12
  389. package/src/api/TextTranslation.ts +43 -26
  390. package/src/api/TimelineTranslationAlignment.ts +41 -13
  391. package/src/api/TranscriptAndTranslationAlignment.ts +28 -15
  392. package/src/api/TranslationAlignment.ts +53 -24
  393. package/src/api/VoiceActivityDetection.ts +33 -68
  394. package/src/audio/AudioPlayer.ts +4 -232
  395. package/src/audio/AudioUtilities.ts +9 -2
  396. package/src/build-tools/MakeTarballsForInstalledPackages.ts +4 -3
  397. package/src/cli/CLI.ts +209 -101
  398. package/src/codecs/FFMpegTranscoder.ts +18 -16
  399. package/src/denoising/NSNet2.ts +5 -4
  400. package/src/denoising/RNNoise.ts +14 -6
  401. package/src/dsp/FFT.ts +2 -1
  402. package/src/dsp/MFCC.ts +7 -5
  403. package/src/dsp/MelSpectrogram.ts +56 -36
  404. package/src/dsp/Rubberband.ts +10 -3
  405. package/src/dsp/Sonic.ts +2 -1
  406. package/src/dsp/SpeexResampler.ts +2 -1
  407. package/src/encodings/Ascii.ts +1 -1
  408. package/src/encodings/Base64.ts +1 -1
  409. package/src/math/VectorMath.ts +10 -6
  410. package/src/nlp/EspeakPhonemizer.ts +2 -2
  411. package/src/nlp/Segmentation.ts +9 -4
  412. package/src/recognition/AmazonTranscribeSTT.ts +4 -3
  413. package/src/recognition/AzureCognitiveServicesSTT.ts +5 -4
  414. package/src/recognition/DeepgramSTT.ts +16 -16
  415. package/src/recognition/GoogleCloudSTT.ts +14 -12
  416. package/src/recognition/OpenAICloudSTT.ts +12 -6
  417. package/src/recognition/WhisperCommon.ts +130 -0
  418. package/src/recognition/{WhisperCppSTT.ts → WhisperCppCliSTT.ts} +73 -133
  419. package/src/recognition/WhisperSTT.ts +569 -718
  420. package/src/server/Client.ts +4 -4
  421. package/src/server/Worker.ts +59 -59
  422. package/src/source-separation/MDXNetSourceSeparation.ts +15 -10
  423. package/src/speech-embeddings/WavToVec2BertFeatureEmbeddings.ts +7 -5
  424. package/src/speech-language-detection/SileroLanguageDetection.ts +18 -9
  425. package/src/speech-search/DTWSpeechSearch.ts +6 -5
  426. package/src/subtitles/Subtitles.ts +22 -22
  427. package/src/synthesis/AwsPollyTTS.ts +12 -5
  428. package/src/synthesis/AzureCognitiveServicesTTS.ts +11 -3
  429. package/src/synthesis/CoquiServerTTS.ts +8 -7
  430. package/src/synthesis/DeepgramTTS.ts +21 -15
  431. package/src/synthesis/ElevenLabsTTS.ts +33 -23
  432. package/src/synthesis/EspeakTTS.ts +145 -69
  433. package/src/synthesis/FliteTTS.ts +3 -3
  434. package/src/synthesis/GnuSpeechTTS.ts +2 -2
  435. package/src/synthesis/GoogleCloudTTS.ts +23 -14
  436. package/src/synthesis/GoogleTranslateTTS.ts +19 -11
  437. package/src/synthesis/KokoroTTS.ts +37 -14
  438. package/src/synthesis/MicrosoftEdgeTTS.ts +71 -23
  439. package/src/synthesis/OpenAICloudTTS.ts +7 -6
  440. package/src/synthesis/SamTTS.ts +3 -2
  441. package/src/synthesis/SapiTTS.ts +3 -3
  442. package/src/synthesis/SvoxPicoTTS.ts +4 -5
  443. package/src/synthesis/VitsTTS.ts +43 -15
  444. package/src/text-translation/DeepLTextTranslation.ts +12 -10
  445. package/src/text-translation/GoogleTranslateTextTranslation.ts +35 -21
  446. package/src/text-translation/NLLBTextTranslation.ts +5 -9
  447. package/src/typings/Fillers.d.ts +0 -60
  448. package/src/typings/TypedArray.ts +12 -1
  449. package/src/utilities/Compression.ts +10 -9
  450. package/src/utilities/FileDownloader.ts +38 -23
  451. package/src/utilities/FileSystem.ts +1 -1
  452. package/src/utilities/Logger.ts +59 -42
  453. package/src/utilities/NpmUtilities.ts +4 -6
  454. package/src/utilities/OpenPromise.ts +1 -2
  455. package/src/utilities/PackageManager.ts +53 -26
  456. package/src/utilities/PathUtilities.ts +6 -2
  457. package/src/utilities/TarballMaker.ts +7 -7
  458. package/src/utilities/Utilities.ts +58 -41
  459. package/src/utilities/WebReader.ts +11 -6
  460. package/src/utilities/WikipediaReader.ts +2 -8
  461. package/src/voice-activity-detection/AdaptiveGateVAD.ts +13 -8
  462. package/src/voice-activity-detection/WebRtcVAD.ts +1 -2
  463. package/tsconfig.json +53 -54
  464. package/dist/audio/AudioRecorder.d.ts +0 -4
  465. package/dist/audio/AudioRecorder.d.ts.map +0 -1
  466. package/dist/audio/AudioRecorder.js +0 -68
  467. package/dist/audio/AudioRecorder.js.map +0 -1
  468. package/dist/audio/SoxPath.d.ts +0 -2
  469. package/dist/audio/SoxPath.d.ts.map +0 -1
  470. package/dist/audio/SoxPath.js +0 -24
  471. package/dist/audio/SoxPath.js.map +0 -1
  472. package/dist/recognition/SileroSTT.d.ts +0 -30
  473. package/dist/recognition/SileroSTT.d.ts.map +0 -1
  474. package/dist/recognition/SileroSTT.js +0 -152
  475. package/dist/recognition/SileroSTT.js.map +0 -1
  476. package/dist/recognition/VoskSTT.d.ts +0 -11
  477. package/dist/recognition/VoskSTT.d.ts.map +0 -1
  478. package/dist/recognition/VoskSTT.js +0 -72
  479. package/dist/recognition/VoskSTT.js.map +0 -1
  480. package/dist/recognition/WhisperCppSTT.d.ts.map +0 -1
  481. package/dist/recognition/WhisperCppSTT.js.map +0 -1
  482. package/dist/synthesis/StreamlabsPollyTTS.d.ts +0 -12
  483. package/dist/synthesis/StreamlabsPollyTTS.d.ts.map +0 -1
  484. package/dist/synthesis/StreamlabsPollyTTS.js +0 -88
  485. package/dist/synthesis/StreamlabsPollyTTS.js.map +0 -1
  486. package/dist/utilities/BinaryUtilities.d.ts +0 -14
  487. package/dist/utilities/BinaryUtilities.d.ts.map +0 -1
  488. package/dist/utilities/BinaryUtilities.js +0 -113
  489. package/dist/utilities/BinaryUtilities.js.map +0 -1
  490. package/src/audio/AudioRecorder.ts +0 -91
  491. package/src/audio/SoxPath.ts +0 -31
  492. package/src/recognition/SileroSTT.ts +0 -222
  493. package/src/recognition/VoskSTT.ts +0 -112
  494. package/src/synthesis/StreamlabsPollyTTS.ts +0 -114
  495. package/src/utilities/BinaryUtilities.ts +0 -138
  496. /package/{LICENSE.md → LICENSE.GPLv3.md} +0 -0
@@ -1,8 +1,12 @@
1
+ import chalk from 'chalk'
2
+
3
+ import * as API from './API.js'
4
+
1
5
  import { deepClone, extendDeep } from '../utilities/ObjectUtilities.js'
2
6
 
3
7
  import * as FFMpegTranscoder from '../codecs/FFMpegTranscoder.js'
4
8
 
5
- import { clip, sha256AsHex, stringifyAndFormatJson, logToStderr, yieldToEventLoop, runOperationWithRetries } from '../utilities/Utilities.js'
9
+ import { clip, sha256AsHex, stringifyAndFormatJson, yieldToEventLoop, runOperationWithRetries } from '../utilities/Utilities.js'
6
10
  import { RawAudio, concatAudioSegments, downmixToMono, encodeRawAudioToWave, getSamplePeakDecibels, getEmptyRawAudio, getRawAudioDuration, trimAudioEnd, trimAudioStart, attenuateIfClippingInPlace, normalizeAudioLevelInPlace } from '../audio/AudioUtilities.js'
7
11
  import { Logger } from '../utilities/Logger.js'
8
12
 
@@ -10,14 +14,11 @@ import { isWordOrSymbolWord, parseText, splitToParagraphs } from '../nlp/Segment
10
14
  import { type RubberbandOptions } from '../dsp/Rubberband.js'
11
15
  import { loadLexiconsForLanguage } from '../nlp/Lexicon.js'
12
16
 
13
- import * as API from './API.js'
14
17
  import { Timeline, TimelineEntry, addTimeOffsetToTimeline, multiplyTimelineByFactor } from '../utilities/Timeline.js'
15
18
  import { getAppDataDir, ensureDir, existsSync, isFileIsUpToDate, readAndParseJsonFile, writeFileSafe } from '../utilities/FileSystem.js'
16
- import { formatLanguageCodeWithName, getShortLanguageCode, normalizeLanguageCode, defaultDialectForLanguageCode, parseLangIdentifier, normalizeIdentifierToLanguageCode } from '../utilities/Locale.js'
19
+ import { formatLanguageCodeWithName, getShortLanguageCode, normalizeLanguageCode, defaultDialectForLanguageCode, normalizeIdentifierToLanguageCode } from '../utilities/Locale.js'
17
20
  import { loadPackage } from '../utilities/PackageManager.js'
18
21
  import { EngineMetadata, appName } from './Common.js'
19
- import { shouldCancelCurrentTask } from '../server/Worker.js'
20
- import chalk from 'chalk'
21
22
  import { type SubtitlesConfig } from '../subtitles/Subtitles.js'
22
23
  import { type EspeakOptions } from '../synthesis/EspeakTTS.js'
23
24
  import { type OpenAICloudTTSOptions } from '../synthesis/OpenAICloudTTS.js'
@@ -29,12 +30,10 @@ import { convertHtmlToText } from '../utilities/StringUtilities.js'
29
30
  import { joinPath, resolvePath } from '../utilities/PathUtilities.js'
30
31
  import { Timer } from '../utilities/Timer.js'
31
32
 
32
- const log = logToStderr
33
-
34
33
  /////////////////////////////////////////////////////////////////////////////////////////////
35
34
  // Synthesis
36
35
  /////////////////////////////////////////////////////////////////////////////////////////////
37
- export async function synthesize(input: string | string[], options: SynthesisOptions, onSegment?: SynthesisSegmentEvent, onSentence?: SynthesisSegmentEvent): Promise<SynthesisResult> {
36
+ export async function synthesize(input: string | string[], options: SynthesisOptions, callbacks?: SynthesisCallbacks): Promise<SynthesisResult> {
38
37
  options = extendDeep(defaultSynthesisOptions, options)
39
38
 
40
39
  let segments: string[]
@@ -49,12 +48,14 @@ export async function synthesize(input: string | string[], options: SynthesisOpt
49
48
  segments = splitToParagraphs(input, plainTextOptions.paragraphBreaks!, plainTextOptions.whitespace!)
50
49
  }
51
50
 
52
- return synthesizeSegments(segments, options, onSegment, onSentence)
51
+ return synthesizeSegments(segments, options, callbacks)
53
52
  }
54
53
 
55
- async function synthesizeSegments(segments: string[], options: SynthesisOptions, onSegment?: SynthesisSegmentEvent, onSentence?: SynthesisSegmentEvent): Promise<SynthesisResult> {
56
- const logger = new Logger()
54
+ async function synthesizeSegments(segments: string[], options: SynthesisOptions, callbacks?: SynthesisCallbacks): Promise<SynthesisResult> {
57
55
  options = extendDeep(defaultSynthesisOptions, options)
56
+ callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks }
57
+
58
+ const logger = new Logger(callbacks.logLevel)
58
59
 
59
60
  const totalSynthesisTimeTimer = new Timer()
60
61
 
@@ -71,7 +72,10 @@ async function synthesizeSegments(segments: string[], options: SynthesisOptions,
71
72
  }
72
73
  }
73
74
 
74
- const { detectedLanguage } = await API.detectTextLanguage(segmentsPlainText.join('\n\n'), options.languageDetection || {})
75
+ const { detectedLanguage } = await API.detectTextLanguage(
76
+ segmentsPlainText.join('\n\n'),
77
+ options.languageDetection!,
78
+ { abortSignal: callbacks.abortSignal, logLevel: 'warning' })
75
79
 
76
80
  options.language = detectedLanguage
77
81
 
@@ -91,7 +95,10 @@ async function synthesizeSegments(segments: string[], options: SynthesisOptions,
91
95
 
92
96
  logger.start(`Get voice list for ${options.engine}`)
93
97
 
94
- const { bestMatchingVoice } = await requestVoiceList(options)
98
+ const { bestMatchingVoice } = await requestVoiceList(
99
+ options,
100
+ { ...callbacks, logLevel: 'warning' }
101
+ )
95
102
 
96
103
  if (!bestMatchingVoice) {
97
104
  throw new Error('No matching voice found')
@@ -116,6 +123,8 @@ async function synthesizeSegments(segments: string[], options: SynthesisOptions,
116
123
  let timeOffset = 0
117
124
 
118
125
  for (let segmentIndex = 0; segmentIndex < segments.length; segmentIndex++) {
126
+ callbacks?.abortSignal?.throwIfAborted()
127
+
119
128
  const segmentText = segments[segmentIndex]
120
129
 
121
130
  logger.log(`\n${chalk.magentaBright(`Synthesizing segment ${segmentIndex + 1}/${segments.length}`)}: '${segmentText.trim()}'`)
@@ -147,23 +156,24 @@ async function synthesizeSegments(segments: string[], options: SynthesisOptions,
147
156
  const sentencesTimelines: Timeline[] = []
148
157
 
149
158
  for (let sentenceIndex = 0; sentenceIndex < sentences.length; sentenceIndex++) {
150
- await yieldToEventLoop()
159
+ callbacks?.abortSignal?.throwIfAborted()
151
160
 
152
- if (shouldCancelCurrentTask()) {
153
- //log('\n\n\n\n\nCANCELED\n\n\n\n')
154
- throw new Error('Canceled')
155
- }
161
+ await yieldToEventLoop()
156
162
 
157
163
  const sentenceText = sentences[sentenceIndex]
158
164
 
159
- logger.log(`\n${chalk.magentaBright(`Synthesizing sentence ${sentenceIndex + 1}/${sentences.length}`)}: "${sentenceText.trim()}"`)
165
+ logger.log(`\n${chalk.magentaBright(`Synthesizing sentence ${sentenceIndex + 1}/${sentences.length}`)}: '${sentenceText.trim()}'`)
160
166
 
161
167
  const sentenceStartTime = timeOffset
162
168
 
163
169
  let sentenceSynthesisOptions: SynthesisOptions = { postProcessing: { normalizeAudio: false } }
164
170
  sentenceSynthesisOptions = extendDeep(options, sentenceSynthesisOptions)
165
171
 
166
- const { synthesizedAudio: sentenceRawAudio, timeline: sentenceTimeline } = await synthesizeSegment(sentenceText, sentenceSynthesisOptions)
172
+ const { synthesizedAudio: sentenceRawAudio, timeline: sentenceTimeline } = await synthesizeSegment(
173
+ sentenceText,
174
+ sentenceSynthesisOptions,
175
+ callbacks
176
+ )
167
177
 
168
178
  const endPause = sentenceIndex == sentences.length - 1 ? options.segmentEndPause! : options.sentenceEndPause!
169
179
  sentenceRawAudio.audioChannels[0] = trimAudioEnd(sentenceRawAudio.audioChannels[0], endPause * sentenceRawAudio.sampleRate)
@@ -194,8 +204,8 @@ async function synthesizeSegments(segments: string[], options: SynthesisOptions,
194
204
 
195
205
  const sentenceAudio = await convertToTargetCodecIfNeeded(sentenceRawAudio)
196
206
 
197
- if (onSentence) {
198
- await onSentence({
207
+ if (callbacks?.onSentence) {
208
+ await callbacks.onSentence({
199
209
  index: sentenceIndex,
200
210
  total: sentences.length,
201
211
  audio: sentenceAudio,
@@ -232,8 +242,8 @@ async function synthesizeSegments(segments: string[], options: SynthesisOptions,
232
242
 
233
243
  logger.end()
234
244
 
235
- if (onSegment) {
236
- await onSegment({
245
+ if (callbacks?.onSegment) {
246
+ await callbacks.onSegment({
237
247
  index: segmentIndex,
238
248
  total: segments.length,
239
249
  audio: segmentAudio,
@@ -273,7 +283,7 @@ async function synthesizeSegments(segments: string[], options: SynthesisOptions,
273
283
  output = encodeRawAudioToWave(rawAudio)
274
284
  } else {
275
285
  const ffmpegOptions = FFMpegTranscoder.getDefaultFFMpegOptionsForSpeech(targetCodec, options.outputAudioFormat?.bitrate)
276
- output = await FFMpegTranscoder.encodeFromChannels(rawAudio, ffmpegOptions)
286
+ output = await FFMpegTranscoder.encodeFromChannels(rawAudio, ffmpegOptions, callbacks!)
277
287
  }
278
288
  } else {
279
289
  output = rawAudio
@@ -286,7 +296,7 @@ async function synthesizeSegments(segments: string[], options: SynthesisOptions,
286
296
 
287
297
  logger.end()
288
298
 
289
- logger.logTitledMessage('Total synthesis time', `${totalSynthesisTimeTimer.elapsedTime.toFixed(1)}ms`, chalk.magentaBright)
299
+ logger.logTitledMessage('Total synthesis time', `${totalSynthesisTimeTimer.elapsedTime.toFixed(1)}ms`, 'info', chalk.magentaBright)
290
300
 
291
301
  return {
292
302
  audio: resultAudio,
@@ -303,8 +313,10 @@ export interface SynthesisResult {
303
313
  voice: string
304
314
  }
305
315
 
306
- async function synthesizeSegment(text: string, options: SynthesisOptions) {
307
- const logger = new Logger()
316
+ async function synthesizeSegment(text: string, options: SynthesisOptions, callbacks?: SynthesisCallbacks) {
317
+ callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks }
318
+
319
+ const logger = new Logger(callbacks.logLevel)
308
320
 
309
321
  const startTimestamp = logger.getTimestamp()
310
322
 
@@ -316,7 +328,9 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
316
328
 
317
329
  logger.start(`Get voice list for ${engine}`)
318
330
 
319
- const { bestMatchingVoice } = await requestVoiceList(options)
331
+ const { bestMatchingVoice } = await requestVoiceList(
332
+ options,
333
+ { ...callbacks, logLevel: 'warning' })
320
334
 
321
335
  if (!bestMatchingVoice) {
322
336
  throw new Error('No matching voice found')
@@ -329,7 +343,7 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
329
343
  if (selectedVoice.packageName) {
330
344
  logger.end()
331
345
 
332
- voicePackagePath = await loadPackage(selectedVoice.packageName)
346
+ voicePackagePath = await loadPackage(selectedVoice.packageName, callbacks)
333
347
  }
334
348
 
335
349
  logger.start(`Initialize ${engine} module`)
@@ -403,7 +417,9 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
403
417
  lengthScale,
404
418
  speakerId ?? 0,
405
419
  lexicons,
406
- onnxExecutionProviders)
420
+ onnxExecutionProviders,
421
+ callbacks,
422
+ )
407
423
 
408
424
  synthesizedAudio = rawAudio
409
425
  timeline = outTimeline
@@ -429,8 +445,8 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
429
445
  const modelName = kokoroOptions.model!
430
446
  const modelPackageName = `kokoro-${modelName}`
431
447
 
432
- const modelPath = await loadPackage(modelPackageName)
433
- const voicesPath = await loadPackage('kokoro-82m-v1.0-voices')
448
+ const modelPath = await loadPackage(modelPackageName, callbacks)
449
+ const voicesPath = await loadPackage('kokoro-82m-v1.0-voices', callbacks)
434
450
 
435
451
  logger.end()
436
452
 
@@ -443,7 +459,8 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
443
459
  lexicons,
444
460
  modelPath,
445
461
  voicesPath,
446
- onnxExecutionProviders
462
+ onnxExecutionProviders,
463
+ callbacks,
447
464
  )
448
465
 
449
466
  synthesizedAudio = rawAudio
@@ -476,7 +493,13 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
476
493
  const resourceFilePath = resolvePath(voicePackagePath!, textAnalysisFilename)
477
494
  const signalGenerationFilePath = resolvePath(voicePackagePath!, signalGenerationFilename)
478
495
 
479
- const { rawAudio } = await SvoxPicoTTS.synthesize(preparedText, resourceFilePath, signalGenerationFilePath)
496
+ const { rawAudio } = await SvoxPicoTTS.synthesize(
497
+ preparedText,
498
+ resourceFilePath,
499
+ signalGenerationFilePath,
500
+ undefined,
501
+ callbacks,
502
+ )
480
503
 
481
504
  synthesizedAudio = rawAudio
482
505
 
@@ -492,7 +515,15 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
492
515
 
493
516
  logger.end()
494
517
 
495
- const { rawAudio, events } = await FliteTTS.synthesize(simplifiedText, voice, voicePackagePath, speed)
518
+ const { rawAudio, events } = await FliteTTS.synthesize(
519
+ simplifiedText,
520
+ voice,
521
+ voicePackagePath,
522
+ speed,
523
+ undefined,
524
+ undefined,
525
+ callbacks,
526
+ )
496
527
 
497
528
  synthesizedAudio = rawAudio
498
529
 
@@ -508,8 +539,15 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
508
539
 
509
540
  const engineOptions = options.gnuspeech!
510
541
 
542
+ let defaultGnuSpeechOptions
543
+
544
+ try {
545
+ ({ defaultGnuSpeechOptions } = await import('@echogarden/gnuspeech-wasm'))
546
+ } catch {
547
+ throw new Error(`Couldn't load the '@echogarden/gnuspeech-wasm' module. Since Echogarden v3.0.0 it is an optional dependency, due to its GPL-3 license. To enable it, you'll need to install it manually via 'npm install [-g] @echogarden/gnuspeech-wasm'.`)
548
+ }
549
+
511
550
  const GnuSpeech = await import('../synthesis/GnuSpeechTTS.js')
512
- const { defaultGnuSpeechOptions } = await import('@echogarden/gnuspeech-wasm')
513
551
 
514
552
  const gnuSpeechOptions = extendDeep(defaultGnuSpeechOptions, engineOptions)
515
553
 
@@ -519,7 +557,7 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
519
557
 
520
558
  await logger.startAsync(`Synthesize with Gnuspeech`)
521
559
 
522
- const { rawAudio } = await GnuSpeech.synthesize(simplifiedText, gnuSpeechOptions)
560
+ const { rawAudio } = await GnuSpeech.synthesize(simplifiedText, gnuSpeechOptions, callbacks)
523
561
 
524
562
  synthesizedAudio = rawAudio
525
563
 
@@ -556,7 +594,7 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
556
594
  if (inputIsSSML) {
557
595
  logger.end()
558
596
 
559
- const { rawAudio } = await EspeakTTS.synthesize(text, espeakOptions)
597
+ const { rawAudio } = await EspeakTTS.synthesize(text, espeakOptions, callbacks)
560
598
 
561
599
  synthesizedAudio = rawAudio
562
600
  } else {
@@ -564,7 +602,13 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
564
602
 
565
603
  logger.end()
566
604
 
567
- const { referenceSynthesizedAudio, referenceTimeline } = await EspeakTTS.preprocessAndSynthesize(text, espeakLanguage, espeakOptions, lexicons)
605
+ const { referenceSynthesizedAudio, referenceTimeline } = await EspeakTTS.preprocessAndSynthesize(
606
+ text,
607
+ espeakLanguage,
608
+ espeakOptions,
609
+ lexicons,
610
+ callbacks,
611
+ )
568
612
 
569
613
  synthesizedAudio = referenceSynthesizedAudio
570
614
  timeline = referenceTimeline.flatMap(clause => clause.timeline!)
@@ -589,7 +633,7 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
589
633
 
590
634
  logger.end()
591
635
 
592
- const { rawAudio } = await SamTTS.synthesize(simplifiedText, samPitch, samSpeed, samMouth, samThroat)
636
+ const { rawAudio } = await SamTTS.synthesize(simplifiedText, samPitch, samSpeed, samMouth, samThroat, callbacks)
593
637
 
594
638
  synthesizedAudio = rawAudio
595
639
 
@@ -611,7 +655,13 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
611
655
 
612
656
  logger.end()
613
657
 
614
- const { rawAudio, timeline: outTimeline } = await SapiTTS.synthesize(text, voice, sapiRate, false)
658
+ const { rawAudio, timeline: outTimeline } = await SapiTTS.synthesize(
659
+ text,
660
+ voice,
661
+ sapiRate,
662
+ false,
663
+ callbacks,
664
+ )
615
665
 
616
666
  synthesizedAudio = rawAudio
617
667
  timeline = outTimeline
@@ -637,7 +687,13 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
637
687
 
638
688
  logger.end()
639
689
 
640
- const { rawAudio, timeline: outTimeline } = await SapiTTS.synthesize(text, voice, sapiRate, true)
690
+ const { rawAudio, timeline: outTimeline } = await SapiTTS.synthesize(
691
+ text,
692
+ voice,
693
+ sapiRate,
694
+ true,
695
+ callbacks,
696
+ )
641
697
 
642
698
  synthesizedAudio = rawAudio
643
699
  timeline = outTimeline
@@ -666,7 +722,12 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
666
722
 
667
723
  logger.end()
668
724
 
669
- const { rawAudio } = await CoquiServerTTS.synthesize(simplifiedText, speakerId, serverUrl)
725
+ const { rawAudio } = await CoquiServerTTS.synthesize(
726
+ simplifiedText,
727
+ speakerId,
728
+ serverUrl,
729
+ callbacks,
730
+ )
670
731
 
671
732
  synthesizedAudio = rawAudio
672
733
 
@@ -701,7 +762,19 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
701
762
 
702
763
  logger.end()
703
764
 
704
- const { rawAudio, timepoints } = await GoogleCloudTTS.synthesize(text, apiKey, language, voice, speed, pitchDeltaSemitones, 0, inputIsSSML)
765
+ const { rawAudio, timepoints } = await GoogleCloudTTS.synthesize(
766
+ text,
767
+ apiKey,
768
+ language,
769
+ voice,
770
+ speed,
771
+ pitchDeltaSemitones,
772
+ 0,
773
+ inputIsSSML,
774
+ undefined,
775
+ undefined,
776
+ callbacks,
777
+ )
705
778
 
706
779
  synthesizedAudio = rawAudio
707
780
 
@@ -741,7 +814,17 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
741
814
 
742
815
  logger.end()
743
816
 
744
- const { rawAudio, timeline: outTimeline } = await AzureCognitiveServicesTTS.synthesize(text, subscriptionKey, serviceRegion, language, voice, inputIsSSML, ssmlPitch, ssmlRate)
817
+ const { rawAudio, timeline: outTimeline } = await AzureCognitiveServicesTTS.synthesize(
818
+ text,
819
+ subscriptionKey,
820
+ serviceRegion,
821
+ language,
822
+ voice,
823
+ inputIsSSML,
824
+ ssmlPitch,
825
+ ssmlRate,
826
+ callbacks,
827
+ )
745
828
 
746
829
  synthesizedAudio = rawAudio
747
830
  timeline = outTimeline
@@ -777,7 +860,18 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
777
860
 
778
861
  logger.end()
779
862
 
780
- const { rawAudio } = await AwsPollyTTS.synthesize(text, undefined, voice, region, accessKeyId, secretAccessKey, pollyEngine, inputIsSSML, lexiconNames)
863
+ const { rawAudio } = await AwsPollyTTS.synthesize(
864
+ text,
865
+ undefined,
866
+ voice,
867
+ region,
868
+ accessKeyId,
869
+ secretAccessKey,
870
+ pollyEngine,
871
+ inputIsSSML,
872
+ lexiconNames,
873
+ callbacks,
874
+ )
781
875
 
782
876
  synthesizedAudio = rawAudio
783
877
 
@@ -798,7 +892,13 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
798
892
 
799
893
  logger.end();
800
894
 
801
- synthesizedAudio = await OpenAICloudTTS.synthesize(text, voice, speed, openAICloudTTSOptions)
895
+ synthesizedAudio = await OpenAICloudTTS.synthesize(
896
+ text,
897
+ voice,
898
+ speed,
899
+ openAICloudTTSOptions,
900
+ callbacks,
901
+ )
802
902
 
803
903
  shouldPostprocessSpeed = false
804
904
  shouldPostprocessPitch = true
@@ -823,7 +923,13 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
823
923
 
824
924
  logger.end()
825
925
 
826
- const { rawAudio, timeline: outTimeline } = await ElevenLabsTTS.synthesize(text, voiceId, language, engineOptions)
926
+ const { rawAudio, timeline: outTimeline } = await ElevenLabsTTS.synthesize(
927
+ text,
928
+ voiceId,
929
+ language,
930
+ engineOptions,
931
+ callbacks,
932
+ )
827
933
 
828
934
  synthesizedAudio = rawAudio
829
935
  timeline = outTimeline
@@ -851,7 +957,12 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
851
957
 
852
958
  logger.end()
853
959
 
854
- const { rawAudio } = await DeepgramTTS.synthesize(text, modelId, engineOptions)
960
+ const { rawAudio } = await DeepgramTTS.synthesize(
961
+ text,
962
+ modelId,
963
+ engineOptions,
964
+ callbacks,
965
+ )
855
966
 
856
967
  synthesizedAudio = rawAudio
857
968
 
@@ -872,15 +983,28 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
872
983
 
873
984
  const { rawAudio, timeline: segmentTimeline } =
874
985
  await runOperationWithRetries(
875
- () => GoogleTranslateTTS.synthesizeLongText(text, language, options.googleTranslate?.tld, options.sentenceEndPause, options.segmentEndPause),
876
- logger)
986
+ () => GoogleTranslateTTS.synthesizeLongText(
987
+ text,
988
+ language,
989
+ options.googleTranslate?.tld,
990
+ options.sentenceEndPause,
991
+ options.segmentEndPause,
992
+ callbacks,
993
+ ),
994
+ 'Google Translate TTS',
995
+ callbacks)
877
996
 
878
997
  synthesizedAudio = rawAudio
879
998
 
880
999
  logger.start(`Generate word-level timestamps by individually aligning fragments`)
881
1000
  const alignmentOptions: API.AlignmentOptions = extendDeep(options.alignment, { language })
882
1001
 
883
- timeline = await API.alignSegments(synthesizedAudio, segmentTimeline, alignmentOptions)
1002
+ timeline = await API.alignSegments(
1003
+ synthesizedAudio,
1004
+ segmentTimeline,
1005
+ alignmentOptions,
1006
+ { ...callbacks, logLevel: 'warning' }
1007
+ )
884
1008
 
885
1009
  shouldPostprocessSpeed = true
886
1010
  shouldPostprocessPitch = true
@@ -925,8 +1049,17 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
925
1049
 
926
1050
  const { rawAudio, timeline: edgeTimeline } =
927
1051
  await runOperationWithRetries(
928
- () => MicrosoftEdgeTTS.synthesize(text, trustedClientToken!, voice, ssmlPitch, ssmlRate),
929
- logger)
1052
+ () => MicrosoftEdgeTTS.synthesize(
1053
+ text,
1054
+ trustedClientToken!,
1055
+ voice,
1056
+ ssmlPitch,
1057
+ ssmlRate,
1058
+ undefined,
1059
+ callbacks,
1060
+ ),
1061
+ 'Microsoft Edge TTS',
1062
+ callbacks)
930
1063
 
931
1064
  synthesizedAudio = rawAudio
932
1065
  timeline = edgeTimeline
@@ -934,30 +1067,6 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
934
1067
  break
935
1068
  }
936
1069
 
937
- case 'streamlabs-polly': {
938
- if (inputIsSSML) {
939
- throw new Error(`The Streamlabs Polly Engine engine doesn't support SSML inputs`)
940
- }
941
-
942
- const StreamlabsPollyTTS = await import('../synthesis/StreamlabsPollyTTS.js')
943
-
944
- logger.end()
945
-
946
- const { rawAudio, timeline: segmentTimeline } = await StreamlabsPollyTTS.synthesizeLongText(text, voice, language, options.sentenceEndPause, options.segmentEndPause)
947
-
948
- synthesizedAudio = rawAudio
949
-
950
- logger.start(`Generate word-level timestamps by individually aligning fragments`)
951
- const alignmentOptions: API.AlignmentOptions = extendDeep(options.alignment, { language })
952
-
953
- timeline = await API.alignSegments(synthesizedAudio, segmentTimeline, alignmentOptions)
954
-
955
- shouldPostprocessSpeed = true
956
- shouldPostprocessPitch = true
957
-
958
- break
959
- }
960
-
961
1070
  default: {
962
1071
  throw new Error(`Engine '${options.engine}' is not supported`)
963
1072
  }
@@ -1003,7 +1112,12 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
1003
1112
  alignmentOptions.dtw!.windowDuration = Math.max(5, Math.ceil(0.2 * getRawAudioDuration(synthesizedAudio)))
1004
1113
  }
1005
1114
 
1006
- const { wordTimeline } = await API.align(synthesizedAudio, plainText, alignmentOptions)
1115
+ const { wordTimeline } = await API.align(
1116
+ synthesizedAudio,
1117
+ plainText,
1118
+ alignmentOptions,
1119
+ { abortSignal: callbacks.abortSignal, logLevel: 'warning' },
1120
+ )
1007
1121
 
1008
1122
  timeline = wordTimeline
1009
1123
 
@@ -1042,7 +1156,7 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
1042
1156
 
1043
1157
  synthesizedAudio = await rubberband.stretchTimePitch(synthesizedAudio, timeStretchFactor, pitchShiftFactor, rubberbandOptions)
1044
1158
  } else {
1045
- throw new Error(`'${timePitchShiftingMethod}' is not a valid time and pitch shifting method`)
1159
+ throw new Error(`'${timePitchShiftingMethod}' is not a valid time and pitch shifting method.`)
1046
1160
  }
1047
1161
 
1048
1162
  if (timeStretchFactor != 1.0 && timeline) {
@@ -1056,7 +1170,7 @@ async function synthesizeSegment(text: string, options: SynthesisOptions) {
1056
1170
 
1057
1171
  logger.end()
1058
1172
 
1059
- logger.logDuration('Part synthesis time', startTimestamp, chalk.magentaBright)
1173
+ logger.logDuration('Part synthesis time', startTimestamp, 'info', chalk.magentaBright)
1060
1174
 
1061
1175
  return { synthesizedAudio, timeline }
1062
1176
  }
@@ -1099,11 +1213,11 @@ export type SynthesisEngine =
1099
1213
  'espeak' | 'sam' | 'sapi' | 'msspeech' | 'coqui-server' |
1100
1214
  'google-cloud' | 'microsoft-azure' | 'amazon-polly' |
1101
1215
  'openai-cloud' | 'elevenlabs' | 'deepgram' |
1102
- 'google-translate' | 'microsoft-edge' | 'streamlabs-polly'
1216
+ 'google-translate' | 'microsoft-edge'
1103
1217
 
1104
1218
  export type TimePitchShiftingMethod = 'sonic' | 'rubberband'
1105
1219
 
1106
- export interface SynthesisOptions {
1220
+ export interface SynthesisOptions extends API.OperationOptions {
1107
1221
  engine?: SynthesisEngine
1108
1222
 
1109
1223
  language?: string
@@ -1237,9 +1351,6 @@ export interface SynthesisOptions {
1237
1351
  trustedClientToken?: string
1238
1352
  pitchDeltaHz?: number
1239
1353
  }
1240
-
1241
- streamlabsPolly?: {
1242
- },
1243
1354
  }
1244
1355
 
1245
1356
  export const defaultSynthesisOptions: SynthesisOptions = {
@@ -1384,18 +1495,16 @@ export const defaultSynthesisOptions: SynthesisOptions = {
1384
1495
 
1385
1496
  pitchDeltaHz: undefined
1386
1497
  },
1387
-
1388
- streamlabsPolly: {
1389
- },
1390
1498
  }
1391
1499
 
1392
1500
  /////////////////////////////////////////////////////////////////////////////////////////////
1393
1501
  // Voice list request
1394
1502
  /////////////////////////////////////////////////////////////////////////////////////////////
1395
- export async function requestVoiceList(options: VoiceListRequestOptions): Promise<RequestVoiceListResult> {
1503
+ export async function requestVoiceList(options: VoiceListRequestOptions, callbacks?: VoiceListRequestCallbacks): Promise<RequestVoiceListResult> {
1396
1504
  options = extendDeep(defaultVoiceListRequestOptions, options)
1505
+ callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks }
1397
1506
 
1398
- const logger = new Logger()
1507
+ const logger = new Logger(callbacks.logLevel)
1399
1508
 
1400
1509
  const cacheOptions = options.cache!
1401
1510
 
@@ -1416,7 +1525,7 @@ export async function requestVoiceList(options: VoiceListRequestOptions): Promis
1416
1525
  case 'espeak': {
1417
1526
  const EspeakTTS = await import('../synthesis/EspeakTTS.js')
1418
1527
 
1419
- const voices = await EspeakTTS.listVoices()
1528
+ const voices = await EspeakTTS.listVoices(callbacks!)
1420
1529
 
1421
1530
  voiceList = voices.map(voice => {
1422
1531
  const languages = voice.languages.map(lang => normalizeLanguageCode(lang.name))
@@ -1531,7 +1640,7 @@ export async function requestVoiceList(options: VoiceListRequestOptions): Promis
1531
1640
  throw new Error(`No Google Cloud API key provided`)
1532
1641
  }
1533
1642
 
1534
- const voices = await GoogleCloudTTS.getVoiceList(apiKey)
1643
+ const voices = await GoogleCloudTTS.getVoiceList(apiKey, callbacks!)
1535
1644
 
1536
1645
  voiceList = voices.map(voice => ({
1537
1646
  name: voice.name,
@@ -1591,7 +1700,7 @@ export async function requestVoiceList(options: VoiceListRequestOptions): Promis
1591
1700
  throw new Error(`No Amazon Polly secret access key provided`)
1592
1701
  }
1593
1702
 
1594
- const voices = await AwsPollyTTS.getVoiceList(region, accessKeyId, secretAccessKey)
1703
+ const voices = await AwsPollyTTS.getVoiceList(region, accessKeyId, secretAccessKey, callbacks!)
1595
1704
 
1596
1705
  for (const voice of voices) {
1597
1706
  const languageCode = normalizeLanguageCode(voice.LanguageCode!)
@@ -1635,7 +1744,7 @@ export async function requestVoiceList(options: VoiceListRequestOptions): Promis
1635
1744
  throw new Error(`No ElevenLabs API key provided`)
1636
1745
  }
1637
1746
 
1638
- voiceList = await ElevenLabsTTS.getVoiceList(apiKey)
1747
+ voiceList = await ElevenLabsTTS.getVoiceList(apiKey, callbacks!)
1639
1748
 
1640
1749
  break
1641
1750
  }
@@ -1675,8 +1784,9 @@ export async function requestVoiceList(options: VoiceListRequestOptions): Promis
1675
1784
 
1676
1785
  const voices =
1677
1786
  await runOperationWithRetries(
1678
- () => MicrosoftEdgeTTS.getVoiceList(trustedClientToken),
1679
- logger)
1787
+ () => MicrosoftEdgeTTS.getVoiceList(trustedClientToken, callbacks!),
1788
+ 'Mircosoft Edge TTS voice list request',
1789
+ callbacks!)
1680
1790
 
1681
1791
  voiceList = voices.map((voice: any) => ({
1682
1792
  name: voice.Name,
@@ -1686,19 +1796,11 @@ export async function requestVoiceList(options: VoiceListRequestOptions): Promis
1686
1796
 
1687
1797
  break
1688
1798
  }
1689
-
1690
- case 'streamlabs-polly': {
1691
- const StreamlabsPollyTTS = await import('../synthesis/StreamlabsPollyTTS.js')
1692
-
1693
- voiceList = StreamlabsPollyTTS.voiceList
1694
-
1695
- break
1696
- }
1697
1799
  }
1698
1800
 
1699
1801
 
1700
1802
  if (cacheFilePath) {
1701
- await writeFileSafe(cacheFilePath, await stringifyAndFormatJson(voiceList))
1803
+ await writeFileSafe(cacheFilePath, stringifyAndFormatJson(voiceList))
1702
1804
  }
1703
1805
 
1704
1806
  return voiceList
@@ -1774,6 +1876,9 @@ export interface RequestVoiceListResult {
1774
1876
  bestMatchingVoice: API.SynthesisVoice
1775
1877
  }
1776
1878
 
1879
+ export interface VoiceListRequestCallbacks extends API.OperationCallbacks {
1880
+ }
1881
+
1777
1882
  export async function selectBestOfflineEngineForLanguage(language: string): Promise<SynthesisEngine> {
1778
1883
  language = await normalizeIdentifierToLanguageCode(language)
1779
1884
 
@@ -1822,7 +1927,7 @@ export const defaultVoiceListRequestOptions: VoiceListRequestOptions = {
1822
1927
  },
1823
1928
  }
1824
1929
 
1825
- export interface SynthesisSegmentEventData {
1930
+ export interface SynthesisSegmentCallbackData {
1826
1931
  index: number
1827
1932
  total: number
1828
1933
  audio: RawAudio | Uint8Array
@@ -1832,7 +1937,12 @@ export interface SynthesisSegmentEventData {
1832
1937
  peakDecibelsSoFar: number
1833
1938
  }
1834
1939
 
1835
- export type SynthesisSegmentEvent = (data: SynthesisSegmentEventData) => Promise<void>
1940
+ export type SynthesisSegmentCallback = (data: SynthesisSegmentCallbackData) => Promise<void>
1941
+
1942
+ export interface SynthesisCallbacks extends API.OperationCallbacks {
1943
+ onSegment?: SynthesisSegmentCallback
1944
+ onSentence?: SynthesisSegmentCallback
1945
+ }
1836
1946
 
1837
1947
  export interface SynthesisVoice {
1838
1948
  name: string
@@ -1903,7 +2013,7 @@ export const synthesisEngines: EngineMetadata[] = [
1903
2013
  {
1904
2014
  id: 'coqui-server',
1905
2015
  name: 'Coqui TTS',
1906
- description: 'A deep learning toolkit for Text-to-Speech.',
2016
+ description: 'A client for Coqui TTS server.',
1907
2017
  type: 'server'
1908
2018
  },
1909
2019
  {
@@ -1954,11 +2064,5 @@ export const synthesisEngines: EngineMetadata[] = [
1954
2064
  description: 'Unoffical text-to-speech API used by the Microsoft Edge browser.',
1955
2065
  type: 'cloud'
1956
2066
  },
1957
- {
1958
- id: 'streamlabs-polly',
1959
- name: 'Streamlabs Polly',
1960
- description: 'Unoffical text-to-speech API provided by Streamlabs.',
1961
- type: 'cloud'
1962
- },
1963
2067
  ]
1964
2068