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.
- package/LICENSE.MIT.md +7 -0
- package/README.md +9 -1
- package/data/lexicons/heteronyms.en.json +44 -10
- package/data/lexicons/words.en.json +726 -22
- package/data/schemas/options.json +91 -153
- package/dist/alignment/DTWMfccSequenceAlignment.js.map +1 -1
- package/dist/alignment/SemanticTextAlignment.d.ts +4 -2
- package/dist/alignment/SemanticTextAlignment.d.ts.map +1 -1
- package/dist/alignment/SemanticTextAlignment.js +7 -7
- package/dist/alignment/SemanticTextAlignment.js.map +1 -1
- package/dist/alignment/SpeechAlignment.d.ts +9 -10
- package/dist/alignment/SpeechAlignment.d.ts.map +1 -1
- package/dist/alignment/SpeechAlignment.js +23 -96
- package/dist/alignment/SpeechAlignment.js.map +1 -1
- package/dist/api/APIOptions.d.ts +1 -1
- package/dist/api/APIOptions.d.ts.map +1 -1
- package/dist/api/Alignment.d.ts +8 -6
- package/dist/api/Alignment.d.ts.map +1 -1
- package/dist/api/Alignment.js +31 -40
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/Common.d.ts +7 -0
- package/dist/api/Common.d.ts.map +1 -1
- package/dist/api/Common.js.map +1 -1
- package/dist/api/Denoising.d.ts +5 -2
- package/dist/api/Denoising.d.ts.map +1 -1
- package/dist/api/Denoising.js +15 -15
- package/dist/api/Denoising.js.map +1 -1
- package/dist/api/GlobalOptions.d.ts +2 -8
- package/dist/api/GlobalOptions.d.ts.map +1 -1
- package/dist/api/GlobalOptions.js +2 -13
- package/dist/api/GlobalOptions.js.map +1 -1
- package/dist/api/Recognition.d.ts +11 -12
- package/dist/api/Recognition.d.ts.map +1 -1
- package/dist/api/Recognition.js +32 -82
- package/dist/api/Recognition.js.map +1 -1
- package/dist/api/SourceSeparation.d.ts +7 -2
- package/dist/api/SourceSeparation.d.ts.map +1 -1
- package/dist/api/SourceSeparation.js +12 -10
- package/dist/api/SourceSeparation.js.map +1 -1
- package/dist/api/SpeechLanguageDetection.d.ts +11 -7
- package/dist/api/SpeechLanguageDetection.d.ts.map +1 -1
- package/dist/api/SpeechLanguageDetection.js +37 -30
- package/dist/api/SpeechLanguageDetection.js.map +1 -1
- package/dist/api/SpeechSearch.d.ts +4 -1
- package/dist/api/SpeechSearch.d.ts.map +1 -1
- package/dist/api/SpeechSearch.js.map +1 -1
- package/dist/api/SpeechTranslation.d.ts +10 -6
- package/dist/api/SpeechTranslation.d.ts.map +1 -1
- package/dist/api/SpeechTranslation.js +28 -26
- package/dist/api/SpeechTranslation.js.map +1 -1
- package/dist/api/Synthesis.d.ts +13 -8
- package/dist/api/Synthesis.d.ts.map +1 -1
- package/dist/api/Synthesis.js +67 -89
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/api/TextLanguageDetection.d.ts +4 -2
- package/dist/api/TextLanguageDetection.d.ts.map +1 -1
- package/dist/api/TextLanguageDetection.js +4 -7
- package/dist/api/TextLanguageDetection.js.map +1 -1
- package/dist/api/TextTranslation.d.ts +4 -2
- package/dist/api/TextTranslation.d.ts.map +1 -1
- package/dist/api/TextTranslation.js +13 -24
- package/dist/api/TextTranslation.js.map +1 -1
- package/dist/api/TimelineTranslationAlignment.d.ts +6 -3
- package/dist/api/TimelineTranslationAlignment.d.ts.map +1 -1
- package/dist/api/TimelineTranslationAlignment.js +20 -11
- package/dist/api/TimelineTranslationAlignment.js.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.d.ts +6 -4
- package/dist/api/TranscriptAndTranslationAlignment.d.ts.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.js +11 -12
- package/dist/api/TranscriptAndTranslationAlignment.js.map +1 -1
- package/dist/api/TranslationAlignment.d.ts +6 -4
- package/dist/api/TranslationAlignment.d.ts.map +1 -1
- package/dist/api/TranslationAlignment.js +20 -21
- package/dist/api/TranslationAlignment.js.map +1 -1
- package/dist/api/VoiceActivityDetection.d.ts +9 -8
- package/dist/api/VoiceActivityDetection.d.ts.map +1 -1
- package/dist/api/VoiceActivityDetection.js +20 -43
- package/dist/api/VoiceActivityDetection.js.map +1 -1
- package/dist/audio/AudioBufferConversion.js.map +1 -1
- package/dist/audio/AudioPlayer.d.ts +1 -3
- package/dist/audio/AudioPlayer.d.ts.map +1 -1
- package/dist/audio/AudioPlayer.js +3 -188
- package/dist/audio/AudioPlayer.js.map +1 -1
- package/dist/audio/AudioUtilities.d.ts +2 -1
- package/dist/audio/AudioUtilities.d.ts.map +1 -1
- package/dist/audio/AudioUtilities.js +2 -2
- package/dist/audio/AudioUtilities.js.map +1 -1
- package/dist/build-tools/MakeTarballsForInstalledPackages.js +3 -3
- package/dist/build-tools/MakeTarballsForInstalledPackages.js.map +1 -1
- package/dist/cli/CLI.d.ts.map +1 -1
- package/dist/cli/CLI.js +139 -92
- package/dist/cli/CLI.js.map +1 -1
- package/dist/codecs/FFMpegTranscoder.d.ts +4 -3
- package/dist/codecs/FFMpegTranscoder.d.ts.map +1 -1
- package/dist/codecs/FFMpegTranscoder.js +16 -14
- package/dist/codecs/FFMpegTranscoder.js.map +1 -1
- package/dist/codecs/TIMITCodec.d.ts.map +1 -1
- package/dist/data-structures/DynamicTypedArray.d.ts.map +1 -1
- package/dist/data-structures/DynamicTypedArray.js.map +1 -1
- package/dist/data-structures/Queue.d.ts.map +1 -1
- package/dist/data-structures/WindowedList.d.ts.map +1 -1
- package/dist/data-structures/WindowedList.js.map +1 -1
- package/dist/denoising/NSNet2.d.ts +3 -2
- package/dist/denoising/NSNet2.d.ts.map +1 -1
- package/dist/denoising/NSNet2.js +4 -4
- package/dist/denoising/NSNet2.js.map +1 -1
- package/dist/denoising/RNNoise.d.ts +2 -1
- package/dist/denoising/RNNoise.d.ts.map +1 -1
- package/dist/denoising/RNNoise.js +10 -6
- package/dist/denoising/RNNoise.js.map +1 -1
- package/dist/dsp/BiquadFilter.d.ts.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.d.ts.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.js.map +1 -1
- package/dist/dsp/FFT.d.ts.map +1 -1
- package/dist/dsp/FFT.js +2 -1
- package/dist/dsp/FFT.js.map +1 -1
- package/dist/dsp/KWeightingFilter.d.ts.map +1 -1
- package/dist/dsp/KWeightingFilter.js.map +1 -1
- package/dist/dsp/LoudnessEstimator.d.ts.map +1 -1
- package/dist/dsp/LoudnessEstimator.js.map +1 -1
- package/dist/dsp/MFCC.d.ts +3 -2
- package/dist/dsp/MFCC.d.ts.map +1 -1
- package/dist/dsp/MFCC.js +4 -4
- package/dist/dsp/MFCC.js.map +1 -1
- package/dist/dsp/MelSpectrogram.d.ts +10 -8
- package/dist/dsp/MelSpectrogram.d.ts.map +1 -1
- package/dist/dsp/MelSpectrogram.js +31 -34
- package/dist/dsp/MelSpectrogram.js.map +1 -1
- package/dist/dsp/Rubberband.d.ts.map +1 -1
- package/dist/dsp/Rubberband.js +8 -3
- package/dist/dsp/Rubberband.js.map +1 -1
- package/dist/dsp/Sonic.d.ts.map +1 -1
- package/dist/dsp/Sonic.js +1 -1
- package/dist/dsp/Sonic.js.map +1 -1
- package/dist/dsp/SpeexResampler.d.ts.map +1 -1
- package/dist/dsp/SpeexResampler.js +1 -1
- package/dist/dsp/SpeexResampler.js.map +1 -1
- package/dist/encodings/Ascii.d.ts +1 -1
- package/dist/encodings/Ascii.d.ts.map +1 -1
- package/dist/encodings/Base64.js.map +1 -1
- package/dist/encodings/Utf16.d.ts.map +1 -1
- package/dist/encodings/Utf8.d.ts.map +1 -1
- package/dist/math/VectorMath.d.ts +1 -0
- package/dist/math/VectorMath.d.ts.map +1 -1
- package/dist/math/VectorMath.js +9 -5
- package/dist/math/VectorMath.js.map +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts.map +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts.map +1 -1
- package/dist/nlp/EspeakPhonemizer.js +2 -2
- package/dist/nlp/EspeakPhonemizer.js.map +1 -1
- package/dist/nlp/IPA.d.ts +2 -2
- package/dist/nlp/Segmentation.d.ts +1 -1
- package/dist/nlp/Segmentation.d.ts.map +1 -1
- package/dist/nlp/Segmentation.js +8 -4
- package/dist/nlp/Segmentation.js.map +1 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts +2 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts.map +1 -1
- package/dist/recognition/AmazonTranscribeSTT.js +3 -3
- package/dist/recognition/AmazonTranscribeSTT.js.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts +2 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.js +4 -4
- package/dist/recognition/AzureCognitiveServicesSTT.js.map +1 -1
- package/dist/recognition/DeepgramSTT.d.ts +2 -1
- package/dist/recognition/DeepgramSTT.d.ts.map +1 -1
- package/dist/recognition/DeepgramSTT.js +12 -13
- package/dist/recognition/DeepgramSTT.js.map +1 -1
- package/dist/recognition/GoogleCloudSTT.d.ts +2 -1
- package/dist/recognition/GoogleCloudSTT.d.ts.map +1 -1
- package/dist/recognition/GoogleCloudSTT.js +11 -10
- package/dist/recognition/GoogleCloudSTT.js.map +1 -1
- package/dist/recognition/OpenAICloudSTT.d.ts +2 -1
- package/dist/recognition/OpenAICloudSTT.d.ts.map +1 -1
- package/dist/recognition/OpenAICloudSTT.js +6 -6
- package/dist/recognition/OpenAICloudSTT.js.map +1 -1
- package/dist/recognition/WhisperCommon.d.ts +9 -0
- package/dist/recognition/WhisperCommon.d.ts.map +1 -0
- package/dist/recognition/WhisperCommon.js +52 -0
- package/dist/recognition/WhisperCommon.js.map +1 -0
- package/dist/recognition/{WhisperCppSTT.d.ts → WhisperCppCliSTT.d.ts} +14 -16
- package/dist/recognition/WhisperCppCliSTT.d.ts.map +1 -0
- package/dist/recognition/{WhisperCppSTT.js → WhisperCppCliSTT.js} +55 -84
- package/dist/recognition/WhisperCppCliSTT.js.map +1 -0
- package/dist/recognition/WhisperSTT.d.ts +72 -85
- package/dist/recognition/WhisperSTT.d.ts.map +1 -1
- package/dist/recognition/WhisperSTT.js +384 -519
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/server/Client.d.ts +2 -2
- package/dist/server/Client.d.ts.map +1 -1
- package/dist/server/Client.js.map +1 -1
- package/dist/server/Worker.d.ts +6 -7
- package/dist/server/Worker.d.ts.map +1 -1
- package/dist/server/Worker.js +42 -44
- package/dist/server/Worker.js.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.d.ts +3 -2
- package/dist/source-separation/MDXNetSourceSeparation.d.ts.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.js +10 -8
- package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts +3 -2
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js +5 -5
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts +5 -3
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.js +8 -8
- package/dist/speech-language-detection/SileroLanguageDetection.js.map +1 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts +2 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts.map +1 -1
- package/dist/speech-search/DTWSpeechSearch.js +4 -4
- package/dist/speech-search/DTWSpeechSearch.js.map +1 -1
- package/dist/subtitles/Subtitles.d.ts +13 -1
- package/dist/subtitles/Subtitles.d.ts.map +1 -1
- package/dist/subtitles/Subtitles.js +22 -22
- package/dist/subtitles/Subtitles.js.map +1 -1
- package/dist/synthesis/AwsPollyTTS.d.ts +3 -2
- package/dist/synthesis/AwsPollyTTS.d.ts.map +1 -1
- package/dist/synthesis/AwsPollyTTS.js +5 -5
- package/dist/synthesis/AwsPollyTTS.js.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts +2 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.js +3 -3
- package/dist/synthesis/AzureCognitiveServicesTTS.js.map +1 -1
- package/dist/synthesis/CoquiServerTTS.d.ts +2 -1
- package/dist/synthesis/CoquiServerTTS.d.ts.map +1 -1
- package/dist/synthesis/CoquiServerTTS.js +7 -8
- package/dist/synthesis/CoquiServerTTS.js.map +1 -1
- package/dist/synthesis/DeepgramTTS.d.ts +2 -2
- package/dist/synthesis/DeepgramTTS.d.ts.map +1 -1
- package/dist/synthesis/DeepgramTTS.js +13 -13
- package/dist/synthesis/DeepgramTTS.js.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.d.ts +3 -3
- package/dist/synthesis/ElevenLabsTTS.d.ts.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.js +22 -21
- package/dist/synthesis/ElevenLabsTTS.js.map +1 -1
- package/dist/synthesis/EspeakTTS.d.ts +11 -9
- package/dist/synthesis/EspeakTTS.d.ts.map +1 -1
- package/dist/synthesis/EspeakTTS.js +118 -68
- package/dist/synthesis/EspeakTTS.js.map +1 -1
- package/dist/synthesis/FliteTTS.d.ts +2 -2
- package/dist/synthesis/FliteTTS.d.ts.map +1 -1
- package/dist/synthesis/FliteTTS.js +2 -2
- package/dist/synthesis/FliteTTS.js.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.d.ts +2 -2
- package/dist/synthesis/GnuSpeechTTS.d.ts.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.js +1 -1
- package/dist/synthesis/GnuSpeechTTS.js.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.d.ts +3 -2
- package/dist/synthesis/GoogleCloudTTS.d.ts.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.js +15 -14
- package/dist/synthesis/GoogleCloudTTS.js.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.d.ts +3 -2
- package/dist/synthesis/GoogleTranslateTTS.d.ts.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.js +11 -11
- package/dist/synthesis/GoogleTranslateTTS.js.map +1 -1
- package/dist/synthesis/KokoroTTS.d.ts +4 -4
- package/dist/synthesis/KokoroTTS.d.ts.map +1 -1
- package/dist/synthesis/KokoroTTS.js +11 -10
- package/dist/synthesis/KokoroTTS.js.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts +4 -3
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.js +41 -20
- package/dist/synthesis/MicrosoftEdgeTTS.js.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.d.ts +2 -2
- package/dist/synthesis/OpenAICloudTTS.d.ts.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.js +6 -5
- package/dist/synthesis/OpenAICloudTTS.js.map +1 -1
- package/dist/synthesis/SamTTS.d.ts +2 -1
- package/dist/synthesis/SamTTS.d.ts.map +1 -1
- package/dist/synthesis/SamTTS.js +2 -2
- package/dist/synthesis/SamTTS.js.map +1 -1
- package/dist/synthesis/SapiTTS.d.ts +2 -2
- package/dist/synthesis/SapiTTS.d.ts.map +1 -1
- package/dist/synthesis/SapiTTS.js +2 -2
- package/dist/synthesis/SapiTTS.js.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.d.ts +2 -2
- package/dist/synthesis/SvoxPicoTTS.d.ts.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.js +3 -3
- package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
- package/dist/synthesis/VitsTTS.d.ts +3 -3
- package/dist/synthesis/VitsTTS.d.ts.map +1 -1
- package/dist/synthesis/VitsTTS.js +14 -11
- package/dist/synthesis/VitsTTS.js.map +1 -1
- package/dist/text-translation/DeepLTextTranslation.d.ts +2 -2
- package/dist/text-translation/DeepLTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/DeepLTextTranslation.js +10 -9
- package/dist/text-translation/DeepLTextTranslation.js.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts +4 -4
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.js +20 -18
- package/dist/text-translation/GoogleTranslateTextTranslation.js.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.d.ts +2 -2
- package/dist/text-translation/NLLBTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.js +4 -6
- package/dist/text-translation/NLLBTextTranslation.js.map +1 -1
- package/dist/typings/TypedArray.d.ts.map +1 -1
- package/dist/utilities/Compression.d.ts +4 -3
- package/dist/utilities/Compression.d.ts.map +1 -1
- package/dist/utilities/Compression.js +9 -9
- package/dist/utilities/Compression.js.map +1 -1
- package/dist/utilities/FileDownloader.d.ts +6 -3
- package/dist/utilities/FileDownloader.d.ts.map +1 -1
- package/dist/utilities/FileDownloader.js +25 -21
- package/dist/utilities/FileDownloader.js.map +1 -1
- package/dist/utilities/FileReader.d.ts.map +1 -1
- package/dist/utilities/FileReader.js.map +1 -1
- package/dist/utilities/FileSystem.js +1 -1
- package/dist/utilities/FileSystem.js.map +1 -1
- package/dist/utilities/FileWriter.d.ts.map +1 -1
- package/dist/utilities/FileWriter.js.map +1 -1
- package/dist/utilities/Hashing.d.ts.map +1 -1
- package/dist/utilities/Hashing.js.map +1 -1
- package/dist/utilities/Locale.js.map +1 -1
- package/dist/utilities/Logger.d.ts +17 -9
- package/dist/utilities/Logger.d.ts.map +1 -1
- package/dist/utilities/Logger.js +50 -35
- package/dist/utilities/Logger.js.map +1 -1
- package/dist/utilities/NpmUtilities.d.ts.map +1 -1
- package/dist/utilities/NpmUtilities.js +4 -5
- package/dist/utilities/NpmUtilities.js.map +1 -1
- package/dist/utilities/ObjectUtilities.js.map +1 -1
- package/dist/utilities/OpenPromise.d.ts.map +1 -1
- package/dist/utilities/OpenPromise.js.map +1 -1
- package/dist/utilities/PackageManager.d.ts +4 -1
- package/dist/utilities/PackageManager.d.ts.map +1 -1
- package/dist/utilities/PackageManager.js +37 -22
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/PathUtilities.d.ts +2 -0
- package/dist/utilities/PathUtilities.d.ts.map +1 -1
- package/dist/utilities/PathUtilities.js +5 -2
- package/dist/utilities/PathUtilities.js.map +1 -1
- package/dist/utilities/RandomGenerator.d.ts.map +1 -1
- package/dist/utilities/SignalChannel.d.ts.map +1 -1
- package/dist/utilities/SmoothEstimator.d.ts.map +1 -1
- package/dist/utilities/SmoothEstimator.js.map +1 -1
- package/dist/utilities/StringBuilder.d.ts.map +1 -1
- package/dist/utilities/TarballMaker.d.ts +4 -3
- package/dist/utilities/TarballMaker.d.ts.map +1 -1
- package/dist/utilities/TarballMaker.js +6 -6
- package/dist/utilities/TarballMaker.js.map +1 -1
- package/dist/utilities/Timeline.js.map +1 -1
- package/dist/utilities/Timer.d.ts.map +1 -1
- package/dist/utilities/Utilities.d.ts +9 -7
- package/dist/utilities/Utilities.d.ts.map +1 -1
- package/dist/utilities/Utilities.js +49 -33
- package/dist/utilities/Utilities.js.map +1 -1
- package/dist/utilities/VirtualFileReadStream.d.ts.map +1 -1
- package/dist/utilities/WebReader.d.ts +2 -1
- package/dist/utilities/WebReader.d.ts.map +1 -1
- package/dist/utilities/WebReader.js +7 -6
- package/dist/utilities/WebReader.js.map +1 -1
- package/dist/utilities/WikipediaReader.d.ts +2 -1
- package/dist/utilities/WikipediaReader.d.ts.map +1 -1
- package/dist/utilities/WikipediaReader.js +1 -5
- package/dist/utilities/WikipediaReader.js.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts +2 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.js +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.js.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js.map +1 -1
- package/docs/API.md +62 -17
- package/docs/CUDA.md +4 -3
- package/docs/Engines.md +8 -7
- package/docs/Licenses.md +0 -3
- package/docs/Options.md +27 -31
- package/docs/Server.md +1 -0
- package/docs/Tasklist.md +2 -1
- package/docs/Technical.md +2 -2
- package/package.json +45 -35
- package/src/alignment/SemanticTextAlignment.ts +14 -7
- package/src/alignment/SpeechAlignment.ts +47 -150
- package/src/api/APIOptions.ts +1 -1
- package/src/api/Alignment.ts +95 -61
- package/src/api/Common.ts +11 -0
- package/src/api/Denoising.ts +22 -17
- package/src/api/GlobalOptions.ts +4 -20
- package/src/api/Recognition.ts +106 -123
- package/src/api/SourceSeparation.ts +39 -21
- package/src/api/SpeechLanguageDetection.ts +77 -37
- package/src/api/SpeechSearch.ts +6 -1
- package/src/api/SpeechTranslation.ts +75 -38
- package/src/api/Synthesis.ts +220 -116
- package/src/api/TextLanguageDetection.ts +10 -12
- package/src/api/TextTranslation.ts +43 -26
- package/src/api/TimelineTranslationAlignment.ts +41 -13
- package/src/api/TranscriptAndTranslationAlignment.ts +28 -15
- package/src/api/TranslationAlignment.ts +53 -24
- package/src/api/VoiceActivityDetection.ts +33 -68
- package/src/audio/AudioPlayer.ts +4 -232
- package/src/audio/AudioUtilities.ts +9 -2
- package/src/build-tools/MakeTarballsForInstalledPackages.ts +4 -3
- package/src/cli/CLI.ts +209 -101
- package/src/codecs/FFMpegTranscoder.ts +18 -16
- package/src/denoising/NSNet2.ts +5 -4
- package/src/denoising/RNNoise.ts +14 -6
- package/src/dsp/FFT.ts +2 -1
- package/src/dsp/MFCC.ts +7 -5
- package/src/dsp/MelSpectrogram.ts +56 -36
- package/src/dsp/Rubberband.ts +10 -3
- package/src/dsp/Sonic.ts +2 -1
- package/src/dsp/SpeexResampler.ts +2 -1
- package/src/encodings/Ascii.ts +1 -1
- package/src/encodings/Base64.ts +1 -1
- package/src/math/VectorMath.ts +10 -6
- package/src/nlp/EspeakPhonemizer.ts +2 -2
- package/src/nlp/Segmentation.ts +9 -4
- package/src/recognition/AmazonTranscribeSTT.ts +4 -3
- package/src/recognition/AzureCognitiveServicesSTT.ts +5 -4
- package/src/recognition/DeepgramSTT.ts +16 -16
- package/src/recognition/GoogleCloudSTT.ts +14 -12
- package/src/recognition/OpenAICloudSTT.ts +12 -6
- package/src/recognition/WhisperCommon.ts +130 -0
- package/src/recognition/{WhisperCppSTT.ts → WhisperCppCliSTT.ts} +73 -133
- package/src/recognition/WhisperSTT.ts +569 -718
- package/src/server/Client.ts +4 -4
- package/src/server/Worker.ts +59 -59
- package/src/source-separation/MDXNetSourceSeparation.ts +15 -10
- package/src/speech-embeddings/WavToVec2BertFeatureEmbeddings.ts +7 -5
- package/src/speech-language-detection/SileroLanguageDetection.ts +18 -9
- package/src/speech-search/DTWSpeechSearch.ts +6 -5
- package/src/subtitles/Subtitles.ts +22 -22
- package/src/synthesis/AwsPollyTTS.ts +12 -5
- package/src/synthesis/AzureCognitiveServicesTTS.ts +11 -3
- package/src/synthesis/CoquiServerTTS.ts +8 -7
- package/src/synthesis/DeepgramTTS.ts +21 -15
- package/src/synthesis/ElevenLabsTTS.ts +33 -23
- package/src/synthesis/EspeakTTS.ts +145 -69
- package/src/synthesis/FliteTTS.ts +3 -3
- package/src/synthesis/GnuSpeechTTS.ts +2 -2
- package/src/synthesis/GoogleCloudTTS.ts +23 -14
- package/src/synthesis/GoogleTranslateTTS.ts +19 -11
- package/src/synthesis/KokoroTTS.ts +37 -14
- package/src/synthesis/MicrosoftEdgeTTS.ts +71 -23
- package/src/synthesis/OpenAICloudTTS.ts +7 -6
- package/src/synthesis/SamTTS.ts +3 -2
- package/src/synthesis/SapiTTS.ts +3 -3
- package/src/synthesis/SvoxPicoTTS.ts +4 -5
- package/src/synthesis/VitsTTS.ts +43 -15
- package/src/text-translation/DeepLTextTranslation.ts +12 -10
- package/src/text-translation/GoogleTranslateTextTranslation.ts +35 -21
- package/src/text-translation/NLLBTextTranslation.ts +5 -9
- package/src/typings/Fillers.d.ts +0 -60
- package/src/typings/TypedArray.ts +12 -1
- package/src/utilities/Compression.ts +10 -9
- package/src/utilities/FileDownloader.ts +38 -23
- package/src/utilities/FileSystem.ts +1 -1
- package/src/utilities/Logger.ts +59 -42
- package/src/utilities/NpmUtilities.ts +4 -6
- package/src/utilities/OpenPromise.ts +1 -2
- package/src/utilities/PackageManager.ts +53 -26
- package/src/utilities/PathUtilities.ts +6 -2
- package/src/utilities/TarballMaker.ts +7 -7
- package/src/utilities/Utilities.ts +58 -41
- package/src/utilities/WebReader.ts +11 -6
- package/src/utilities/WikipediaReader.ts +2 -8
- package/src/voice-activity-detection/AdaptiveGateVAD.ts +13 -8
- package/src/voice-activity-detection/WebRtcVAD.ts +1 -2
- package/tsconfig.json +53 -54
- package/dist/audio/AudioRecorder.d.ts +0 -4
- package/dist/audio/AudioRecorder.d.ts.map +0 -1
- package/dist/audio/AudioRecorder.js +0 -68
- package/dist/audio/AudioRecorder.js.map +0 -1
- package/dist/audio/SoxPath.d.ts +0 -2
- package/dist/audio/SoxPath.d.ts.map +0 -1
- package/dist/audio/SoxPath.js +0 -24
- package/dist/audio/SoxPath.js.map +0 -1
- package/dist/recognition/SileroSTT.d.ts +0 -30
- package/dist/recognition/SileroSTT.d.ts.map +0 -1
- package/dist/recognition/SileroSTT.js +0 -152
- package/dist/recognition/SileroSTT.js.map +0 -1
- package/dist/recognition/VoskSTT.d.ts +0 -11
- package/dist/recognition/VoskSTT.d.ts.map +0 -1
- package/dist/recognition/VoskSTT.js +0 -72
- package/dist/recognition/VoskSTT.js.map +0 -1
- package/dist/recognition/WhisperCppSTT.d.ts.map +0 -1
- package/dist/recognition/WhisperCppSTT.js.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.d.ts +0 -12
- package/dist/synthesis/StreamlabsPollyTTS.d.ts.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.js +0 -88
- package/dist/synthesis/StreamlabsPollyTTS.js.map +0 -1
- package/dist/utilities/BinaryUtilities.d.ts +0 -14
- package/dist/utilities/BinaryUtilities.d.ts.map +0 -1
- package/dist/utilities/BinaryUtilities.js +0 -113
- package/dist/utilities/BinaryUtilities.js.map +0 -1
- package/src/audio/AudioRecorder.ts +0 -91
- package/src/audio/SoxPath.ts +0 -31
- package/src/recognition/SileroSTT.ts +0 -222
- package/src/recognition/VoskSTT.ts +0 -112
- package/src/synthesis/StreamlabsPollyTTS.ts +0 -114
- package/src/utilities/BinaryUtilities.ts +0 -138
- /package/{LICENSE.md → LICENSE.GPLv3.md} +0 -0
|
@@ -3,11 +3,11 @@ import { Logger } from '../utilities/Logger.js'
|
|
|
3
3
|
import { readdir, readFileAsBinary } from '../utilities/FileSystem.js'
|
|
4
4
|
import { joinPath } from '../utilities/PathUtilities.js'
|
|
5
5
|
import { getOnnxSessionOptions, OnnxExecutionProvider } from '../utilities/OnnxUtilities.js'
|
|
6
|
-
import { SynthesisVoice } from '../api/Synthesis.js'
|
|
6
|
+
import { SynthesisCallbacks, SynthesisVoice } from '../api/Synthesis.js'
|
|
7
7
|
import { concatAudioSegments, getRawAudioDuration, RawAudio } from '../audio/AudioUtilities.js'
|
|
8
8
|
import { defaultEspeakOptions, EspeakOptions } from '../synthesis/EspeakTTS.js'
|
|
9
9
|
import { Lexicon } from '../nlp/Lexicon.js'
|
|
10
|
-
import { indexOfLastMatchingNumberInRange } from '../utilities/Utilities.js'
|
|
10
|
+
import { indexOfLastMatchingNumberInRange, yieldToEventLoop } from '../utilities/Utilities.js'
|
|
11
11
|
import { simplifyPunctuationCharacters } from '../nlp/TextNormalizer.js'
|
|
12
12
|
import { getShortLanguageCode } from '../utilities/Locale.js'
|
|
13
13
|
import { substituteStringUsingLookup } from '../utilities/StringUtilities.js'
|
|
@@ -21,8 +21,9 @@ export async function synthesizeSentence(
|
|
|
21
21
|
lexicons: Lexicon[],
|
|
22
22
|
modelPath: string,
|
|
23
23
|
voicesPath: string,
|
|
24
|
-
executionProviders: OnnxExecutionProvider[]
|
|
25
|
-
) {
|
|
24
|
+
executionProviders: OnnxExecutionProvider[],
|
|
25
|
+
callbacks: SynthesisCallbacks) {
|
|
26
|
+
|
|
26
27
|
const cacheLookupKey = `${modelPath} ${voicesPath}`
|
|
27
28
|
|
|
28
29
|
let kokoroTTS: KokoroTTS | undefined = cachedInstanceLookup.get(cacheLookupKey)
|
|
@@ -34,7 +35,13 @@ export async function synthesizeSentence(
|
|
|
34
35
|
cachedInstanceLookup.set(cacheLookupKey, kokoroTTS)
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
const result = await kokoroTTS.synthesizeSentence(
|
|
38
|
+
const result = await kokoroTTS.synthesizeSentence(
|
|
39
|
+
text,
|
|
40
|
+
voice,
|
|
41
|
+
speed,
|
|
42
|
+
lexicons,
|
|
43
|
+
callbacks,
|
|
44
|
+
)
|
|
38
45
|
|
|
39
46
|
return result
|
|
40
47
|
}
|
|
@@ -49,10 +56,10 @@ export class KokoroTTS {
|
|
|
49
56
|
) {
|
|
50
57
|
}
|
|
51
58
|
|
|
52
|
-
async synthesizeSentence(sentenceText: string, voice: SynthesisVoice, speed: number, lexicons: Lexicon[]) {
|
|
53
|
-
await this.initializeSessionIfNeeded()
|
|
59
|
+
async synthesizeSentence(sentenceText: string, voice: SynthesisVoice, speed: number, lexicons: Lexicon[], callbacks: SynthesisCallbacks) {
|
|
60
|
+
await this.initializeSessionIfNeeded(callbacks)
|
|
54
61
|
|
|
55
|
-
const logger = new Logger()
|
|
62
|
+
const logger = new Logger(callbacks.logLevel)
|
|
56
63
|
|
|
57
64
|
const Onnx = await import('onnxruntime-node')
|
|
58
65
|
|
|
@@ -103,12 +110,16 @@ export class KokoroTTS {
|
|
|
103
110
|
useKlatt: false
|
|
104
111
|
}
|
|
105
112
|
|
|
106
|
-
//await logger.startAsync('Phonemize text')
|
|
107
|
-
|
|
108
113
|
const {
|
|
109
114
|
referenceSynthesizedAudio,
|
|
110
115
|
referenceTimeline,
|
|
111
|
-
} = await Espeak.preprocessAndSynthesize(
|
|
116
|
+
} = await Espeak.preprocessAndSynthesize(
|
|
117
|
+
sentenceText,
|
|
118
|
+
voiceLanguage,
|
|
119
|
+
espeakOptions,
|
|
120
|
+
lexicons,
|
|
121
|
+
{ logLevel: callbacks.logLevel },
|
|
122
|
+
)
|
|
112
123
|
|
|
113
124
|
logger.end()
|
|
114
125
|
|
|
@@ -271,6 +282,8 @@ export class KokoroTTS {
|
|
|
271
282
|
const audioParts: Float32Array[][] = []
|
|
272
283
|
|
|
273
284
|
for (let partIndex = 0; partIndex < parts.length; partIndex++) {
|
|
285
|
+
callbacks.abortSignal?.throwIfAborted()
|
|
286
|
+
|
|
274
287
|
if (parts.length === 1) {
|
|
275
288
|
await logger.startAsync(`Synthesize sentence with ONNX model`)
|
|
276
289
|
} else {
|
|
@@ -298,6 +311,8 @@ export class KokoroTTS {
|
|
|
298
311
|
|
|
299
312
|
logger.end()
|
|
300
313
|
|
|
314
|
+
callbacks.abortSignal?.throwIfAborted()
|
|
315
|
+
|
|
301
316
|
const concatenatedAudioParts = audioParts.length > 0 ? concatAudioSegments(audioParts) : [new Float32Array(0)]
|
|
302
317
|
|
|
303
318
|
const synthesizedAudio: RawAudio = { audioChannels: concatenatedAudioParts, sampleRate }
|
|
@@ -309,19 +324,27 @@ export class KokoroTTS {
|
|
|
309
324
|
const referenceWordTimeline = referenceTimeline.flatMap(phrase => phrase.timeline!)
|
|
310
325
|
|
|
311
326
|
const dtwWindowDuration = Math.max(5, Math.ceil(0.2 * getRawAudioDuration(synthesizedAudio)))
|
|
312
|
-
const mappedTimeline = await alignUsingDtw(
|
|
327
|
+
const mappedTimeline = await alignUsingDtw(
|
|
328
|
+
synthesizedAudio,
|
|
329
|
+
referenceSynthesizedAudio,
|
|
330
|
+
referenceWordTimeline,
|
|
331
|
+
['high'],
|
|
332
|
+
[dtwWindowDuration],
|
|
333
|
+
{ ...callbacks, logLevel: 'warning' },
|
|
334
|
+
)
|
|
313
335
|
|
|
314
336
|
logger.end()
|
|
315
337
|
|
|
316
338
|
return { rawAudio: synthesizedAudio, timeline: mappedTimeline }
|
|
317
339
|
}
|
|
318
340
|
|
|
319
|
-
async initializeSessionIfNeeded() {
|
|
341
|
+
async initializeSessionIfNeeded(callbacks: SynthesisCallbacks) {
|
|
320
342
|
if (this.session) {
|
|
321
343
|
return
|
|
322
344
|
}
|
|
323
345
|
|
|
324
|
-
const logger = new Logger()
|
|
346
|
+
const logger = new Logger(callbacks.logLevel)
|
|
347
|
+
|
|
325
348
|
await logger.startAsync('Initialize Kokoro ONNX synthesis model')
|
|
326
349
|
|
|
327
350
|
const filesInModelPath = await readdir(this.modelPath)
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { request } from 'gaxios'
|
|
2
1
|
import WebSocket from 'ws'
|
|
3
2
|
|
|
4
3
|
import * as AzureCognitiveServicesTTS from './AzureCognitiveServicesTTS.js'
|
|
5
4
|
import * as FFMpegTranscoder from '../codecs/FFMpegTranscoder.js'
|
|
6
5
|
import { Logger } from '../utilities/Logger.js'
|
|
7
6
|
import { OpenPromise } from '../utilities/OpenPromise.js'
|
|
8
|
-
import { concatUint8Arrays, getRandomHexString, logToStderr } from '../utilities/Utilities.js'
|
|
7
|
+
import { concatUint8Arrays, getRandomHexString, logToStderr, sha256AsHex } from '../utilities/Utilities.js'
|
|
9
8
|
import { RawAudio, getEmptyRawAudio, getRawAudioDuration } from '../audio/AudioUtilities.js'
|
|
10
9
|
import { Timer } from '../utilities/Timer.js'
|
|
11
10
|
import { decodeUtf8, encodeUtf8 } from '../encodings/Utf8.js'
|
|
12
11
|
import { escapeHtml } from '../encodings/HtmlEscape.js'
|
|
12
|
+
import { requestHttp } from 'easier-http-request'
|
|
13
|
+
import { VoiceListRequestCallbacks, SynthesisCallbacks } from '../api/API.js'
|
|
13
14
|
|
|
14
15
|
const traceEnabled = false
|
|
15
16
|
|
|
@@ -21,26 +22,38 @@ export async function synthesize(
|
|
|
21
22
|
voice = 'Microsoft Server Speech Text to Speech Voice (en-US, AvaNeural)',
|
|
22
23
|
ssmlPitchString = '+0Hz',
|
|
23
24
|
ssmlRateString = '+0%',
|
|
24
|
-
ssmlVolumeString = '+0%'
|
|
25
|
+
ssmlVolumeString = '+0%',
|
|
26
|
+
callbacks: SynthesisCallbacks) {
|
|
27
|
+
|
|
28
|
+
const logger = new Logger(callbacks.logLevel)
|
|
25
29
|
|
|
26
|
-
const logger = new Logger()
|
|
27
30
|
logger.start('Request synthesis from Microsoft Edge cloud API')
|
|
28
31
|
|
|
29
|
-
const { audioData, events } = await requestSynthesis(
|
|
30
|
-
|
|
32
|
+
const { audioData, events } = await requestSynthesis(
|
|
33
|
+
text,
|
|
34
|
+
trustedClientToken,
|
|
35
|
+
voice,
|
|
36
|
+
ssmlPitchString,
|
|
37
|
+
ssmlRateString,
|
|
38
|
+
ssmlVolumeString,
|
|
39
|
+
callbacks,
|
|
40
|
+
)
|
|
31
41
|
|
|
32
|
-
|
|
42
|
+
logger.end()
|
|
33
43
|
|
|
34
44
|
let rawAudio: RawAudio
|
|
35
45
|
|
|
36
46
|
try {
|
|
37
|
-
rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
47
|
+
rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
48
|
+
audioData,
|
|
49
|
+
24000,
|
|
50
|
+
1,
|
|
51
|
+
{ abortSignal: callbacks.abortSignal, logLevel: 'warning' }
|
|
52
|
+
)
|
|
38
53
|
} catch (e) {
|
|
39
54
|
rawAudio = getEmptyRawAudio(1, 24000)
|
|
40
55
|
}
|
|
41
56
|
|
|
42
|
-
//logToStderr(`Raw audio length: ${rawAudio.audioChannels[0].length}`)
|
|
43
|
-
|
|
44
57
|
logger.start('Convert boundary events to timeline')
|
|
45
58
|
const timeline = AzureCognitiveServicesTTS.boundaryEventsToTimeline(events, getRawAudioDuration(rawAudio))
|
|
46
59
|
logger.end()
|
|
@@ -56,7 +69,8 @@ async function requestSynthesis(
|
|
|
56
69
|
voice = 'Microsoft Server Speech Text to Speech Voice (en-US, AriaNeural)',
|
|
57
70
|
ssmlPitchString = '+0Hz',
|
|
58
71
|
ssmlRateString = '+0%',
|
|
59
|
-
ssmlVolumeString = '+0%'
|
|
72
|
+
ssmlVolumeString = '+0%',
|
|
73
|
+
callbacks: SynthesisCallbacks) {
|
|
60
74
|
|
|
61
75
|
const synthesisOpenPromise = new OpenPromise<SynthesisRequestResult>()
|
|
62
76
|
|
|
@@ -95,8 +109,8 @@ async function requestSynthesis(
|
|
|
95
109
|
const requestId = getRandomHexString()
|
|
96
110
|
|
|
97
111
|
try {
|
|
98
|
-
webSocket = await initializeWebsocketConnection(trustedClientToken)
|
|
99
|
-
} catch(e) {
|
|
112
|
+
webSocket = await initializeWebsocketConnection(trustedClientToken, callbacks)
|
|
113
|
+
} catch (e) {
|
|
100
114
|
connectionFailed = true
|
|
101
115
|
|
|
102
116
|
throw e
|
|
@@ -212,7 +226,7 @@ async function requestSynthesis(
|
|
|
212
226
|
|
|
213
227
|
let existingWebSocketConnection: WebSocket | undefined = undefined
|
|
214
228
|
|
|
215
|
-
export async function initializeWebsocketConnection(trustedClientToken: string) {
|
|
229
|
+
export async function initializeWebsocketConnection(trustedClientToken: string, callbacks: SynthesisCallbacks) {
|
|
216
230
|
const requestOpenPromise = new OpenPromise<WebSocket>()
|
|
217
231
|
|
|
218
232
|
if (existingWebSocketConnection && existingWebSocketConnection.readyState == WebSocket.OPEN) {
|
|
@@ -230,7 +244,9 @@ export async function initializeWebsocketConnection(trustedClientToken: string)
|
|
|
230
244
|
const requestURL = 'wss://speech.platform.bing.com/' +
|
|
231
245
|
'consumer/speech/synthesize/readaloud/edge/v1' +
|
|
232
246
|
`?TrustedClientToken=${trustedClientToken}` +
|
|
233
|
-
|
|
247
|
+
`&ConnectionId=${connectionId}` +
|
|
248
|
+
`&Sec-MS-GEC=${await getCurrentSecMsGecToken(trustedClientToken)}` +
|
|
249
|
+
`&Sec-MS-GEC-Version=1-143.0.3650.75`
|
|
234
250
|
|
|
235
251
|
log(requestURL)
|
|
236
252
|
log('')
|
|
@@ -239,9 +255,9 @@ export async function initializeWebsocketConnection(trustedClientToken: string)
|
|
|
239
255
|
headers: {
|
|
240
256
|
'Pragma': 'no-cache',
|
|
241
257
|
'Cache-Control': 'no-cache',
|
|
242
|
-
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
258
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0',
|
|
243
259
|
'Origin': 'chrome-extension://jdiccldimpdaibmpdkjnbmckianbfold',
|
|
244
|
-
'Accept-Encoding': 'gzip, deflate, br',
|
|
260
|
+
'Accept-Encoding': 'gzip, deflate, br, zstd',
|
|
245
261
|
'Accept-Language': 'en-US,en;q=0.9',
|
|
246
262
|
}
|
|
247
263
|
})
|
|
@@ -298,15 +314,23 @@ export async function initializeWebsocketConnection(trustedClientToken: string)
|
|
|
298
314
|
webSocket.on('close', onClose)
|
|
299
315
|
webSocket.on('error', onError)
|
|
300
316
|
|
|
317
|
+
callbacks?.abortSignal?.addEventListener('abort', () => {
|
|
318
|
+
requestOpenPromise.reject(new DOMException('Microsoft Edge TTS WebSocket connection aborted by user.', 'AbortError'))
|
|
319
|
+
webSocket.terminate()
|
|
320
|
+
})
|
|
321
|
+
|
|
301
322
|
return requestOpenPromise.promise
|
|
302
323
|
}
|
|
303
324
|
|
|
304
|
-
export async function getVoiceList(trustedClientToken: string) {
|
|
305
|
-
const response = await
|
|
325
|
+
export async function getVoiceList(trustedClientToken: string, callbacks: VoiceListRequestCallbacks) {
|
|
326
|
+
const response = await requestHttp({
|
|
306
327
|
method: 'GET',
|
|
307
328
|
|
|
308
|
-
url: 'https://speech.platform.bing.com/consumer/speech/synthesize/'
|
|
309
|
-
|
|
329
|
+
url: 'https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list',
|
|
330
|
+
|
|
331
|
+
params: {
|
|
332
|
+
trustedclienttoken: trustedClientToken
|
|
333
|
+
},
|
|
310
334
|
|
|
311
335
|
headers: {
|
|
312
336
|
'sec-ch-ua': `" Not;A Brand";v="99", "Microsoft Edge";v="103", "Chromium";v="103"`,
|
|
@@ -322,10 +346,12 @@ export async function getVoiceList(trustedClientToken: string) {
|
|
|
322
346
|
'accept-language': 'en-US,en;q=0.9',
|
|
323
347
|
},
|
|
324
348
|
|
|
325
|
-
|
|
349
|
+
abortSignal: callbacks?.abortSignal,
|
|
326
350
|
})
|
|
327
351
|
|
|
328
|
-
|
|
352
|
+
const responseObject = await response.json()
|
|
353
|
+
|
|
354
|
+
return responseObject as any[]
|
|
329
355
|
}
|
|
330
356
|
|
|
331
357
|
function getTimestampString() {
|
|
@@ -391,3 +417,25 @@ function indexOfByteSubsequence(sequence: Uint8Array, subsequence: Uint8Array) {
|
|
|
391
417
|
|
|
392
418
|
return -1
|
|
393
419
|
}
|
|
420
|
+
|
|
421
|
+
async function getCurrentSecMsGecToken(trustedClientToken: string) {
|
|
422
|
+
const formatted = `${getCurrentWindowsFileTimeTicks()}${trustedClientToken}`
|
|
423
|
+
|
|
424
|
+
const hash = (await sha256AsHex(formatted)).toUpperCase()
|
|
425
|
+
|
|
426
|
+
return hash
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function getCurrentWindowsFileTimeTicks() {
|
|
430
|
+
const winEpoch100ns = 11644473600n * 10000000n // 116444736000000000n
|
|
431
|
+
const fiveMin100ns = 300n * 10000000n // 3000000000n
|
|
432
|
+
|
|
433
|
+
const currentUnixTime = BigInt(Date.now())
|
|
434
|
+
|
|
435
|
+
// Date.now() is ms; 1 ms = 10_000 × 100ns
|
|
436
|
+
let currentWindowsFileTimeTicks = (currentUnixTime * 10000n) + winEpoch100ns
|
|
437
|
+
|
|
438
|
+
currentWindowsFileTimeTicks -= currentWindowsFileTimeTicks % fiveMin100ns
|
|
439
|
+
|
|
440
|
+
return currentWindowsFileTimeTicks
|
|
441
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ensureRawAudio } from '../audio/AudioUtilities.js';
|
|
2
|
-
import { SynthesisVoice } from '../api/Synthesis.js';
|
|
2
|
+
import { SynthesisCallbacks, SynthesisVoice } from '../api/Synthesis.js';
|
|
3
3
|
import { Logger } from '../utilities/Logger.js';
|
|
4
4
|
import { extendDeep } from '../utilities/ObjectUtilities.js';
|
|
5
5
|
|
|
6
|
-
export async function synthesize(text: string, voice: string, speed: number, options: OpenAICloudTTSOptions) {
|
|
7
|
-
const logger = new Logger()
|
|
6
|
+
export async function synthesize(text: string, voice: string, speed: number, options: OpenAICloudTTSOptions, callbacks: SynthesisCallbacks) {
|
|
7
|
+
const logger = new Logger(callbacks.logLevel)
|
|
8
8
|
|
|
9
9
|
logger.start('Request synthesis from OpenAI Cloud API')
|
|
10
10
|
|
|
@@ -18,7 +18,7 @@ export async function synthesize(text: string, voice: string, speed: number, opt
|
|
|
18
18
|
|
|
19
19
|
const openai = new OpenAI(options)
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const response = await openai.audio.speech.create({
|
|
22
22
|
input: text,
|
|
23
23
|
model: options.model!,
|
|
24
24
|
voice: voice as any,
|
|
@@ -29,10 +29,11 @@ export async function synthesize(text: string, voice: string, speed: number, opt
|
|
|
29
29
|
maxRetries: 10
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
const
|
|
32
|
+
const responseBodyAsArrayBuffer = await response.arrayBuffer()
|
|
33
|
+
const responseBodyAsBytes = new Uint8Array(responseBodyAsArrayBuffer)
|
|
33
34
|
|
|
34
35
|
logger.start('Decode returned audio')
|
|
35
|
-
const resultRawAudio = ensureRawAudio(
|
|
36
|
+
const resultRawAudio = ensureRawAudio(responseBodyAsBytes, undefined, undefined, callbacks)
|
|
36
37
|
|
|
37
38
|
logger.end()
|
|
38
39
|
|
package/src/synthesis/SamTTS.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SynthesisCallbacks } from '../api/API.js'
|
|
1
2
|
import { RawAudio } from '../audio/AudioUtilities.js'
|
|
2
3
|
import { Logger } from '../utilities/Logger.js'
|
|
3
4
|
|
|
@@ -7,8 +8,8 @@ import { Logger } from '../utilities/Logger.js'
|
|
|
7
8
|
//
|
|
8
9
|
// https://habr-com.translate.goog/ru/post/500764/?_x_tr_sl=auto&_x_tr_tl=en
|
|
9
10
|
|
|
10
|
-
export async function synthesize(text: string, pitch = 64, speed = 72, mouth = 128, throat = 128) {
|
|
11
|
-
const logger = new Logger()
|
|
11
|
+
export async function synthesize(text: string, pitch = 64, speed = 72, mouth = 128, throat = 128, callbacks: SynthesisCallbacks) {
|
|
12
|
+
const logger = new Logger(callbacks.logLevel)
|
|
12
13
|
logger.start('Initialize sam module')
|
|
13
14
|
|
|
14
15
|
const { default: SamJs } = await import('sam-js')
|
package/src/synthesis/SapiTTS.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SynthesisVoice } from '../api/API.js'
|
|
1
|
+
import { SynthesisCallbacks, SynthesisVoice } from '../api/API.js'
|
|
2
2
|
import { decodeToChannels, SampleFormat } from '../audio/AudioBufferConversion.js'
|
|
3
3
|
import { RawAudio } from '../audio/AudioUtilities.js'
|
|
4
4
|
import { getShortLanguageCode, lcidToIsoLanguageCode } from '../utilities/Locale.js'
|
|
@@ -8,9 +8,9 @@ import { logToStderr } from '../utilities/Utilities.js'
|
|
|
8
8
|
|
|
9
9
|
const log = logToStderr
|
|
10
10
|
|
|
11
|
-
export function synthesize(text: string, voiceName: string, rate = 0, useSpeechPlatform = false) {
|
|
11
|
+
export function synthesize(text: string, voiceName: string, rate = 0, useSpeechPlatform = false, callbacks: SynthesisCallbacks) {
|
|
12
12
|
return new Promise<{ rawAudio: RawAudio, timeline: Timeline }>(async (resolve, reject) => {
|
|
13
|
-
const logger = new Logger()
|
|
13
|
+
const logger = new Logger(callbacks.logLevel)
|
|
14
14
|
logger.start('Initialize winax module')
|
|
15
15
|
|
|
16
16
|
const { default: WinAX } = await import('winax')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SynthesisVoice } from '../api/API.js'
|
|
1
|
+
import { SynthesisCallbacks, SynthesisVoice } from '../api/API.js'
|
|
2
2
|
import { decodeToChannels, SampleFormat } from '../audio/AudioBufferConversion.js'
|
|
3
3
|
import { bandwidthToQFactor } from '../dsp/BiquadFilter.js'
|
|
4
4
|
import { Logger } from '../utilities/Logger.js'
|
|
@@ -6,18 +6,17 @@ import { RawAudio } from '../audio/AudioUtilities.js'
|
|
|
6
6
|
import { readFileAsBinary } from '../utilities/FileSystem.js'
|
|
7
7
|
import { concatUint8Arrays } from '../utilities/Utilities.js'
|
|
8
8
|
|
|
9
|
-
import { wrapEmscriptenModuleHeap } from 'wasm-heap-manager'
|
|
10
|
-
|
|
11
9
|
let svoxPicoInstance: any
|
|
12
10
|
|
|
13
|
-
export async function synthesize(text: string, textAnalysisFilePath: string, signalGenerationFilePath: string, postprocessOutput = true) {
|
|
14
|
-
const logger = new Logger()
|
|
11
|
+
export async function synthesize(text: string, textAnalysisFilePath: string, signalGenerationFilePath: string, postprocessOutput = true, callbacks: SynthesisCallbacks) {
|
|
12
|
+
const logger = new Logger(callbacks.logLevel)
|
|
15
13
|
logger.start('Get pico WASM instance')
|
|
16
14
|
|
|
17
15
|
const m = await getInstance()
|
|
18
16
|
|
|
19
17
|
logger.start('Initialize pico engine')
|
|
20
18
|
|
|
19
|
+
const { wrapEmscriptenModuleHeap } = await import('wasm-heap-manager')
|
|
21
20
|
const wasmHeap = wrapEmscriptenModuleHeap(m)
|
|
22
21
|
|
|
23
22
|
const pico_initialize = m._pico_initialize
|
package/src/synthesis/VitsTTS.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as Onnx from 'onnxruntime-node'
|
|
2
|
-
import { SynthesisVoice } from '../api/API.js'
|
|
2
|
+
import { SynthesisCallbacks, SynthesisVoice } from '../api/API.js'
|
|
3
3
|
import { Logger } from '../utilities/Logger.js'
|
|
4
4
|
import { RawAudio, getEmptyRawAudio, getRawAudioDuration } from '../audio/AudioUtilities.js'
|
|
5
5
|
import { Lexicon } from '../nlp/Lexicon.js'
|
|
@@ -18,7 +18,8 @@ export async function synthesizeSentence(
|
|
|
18
18
|
lengthScale: number,
|
|
19
19
|
speakerId: number,
|
|
20
20
|
lexicons: Lexicon[],
|
|
21
|
-
executionProviders: OnnxExecutionProvider[]
|
|
21
|
+
executionProviders: OnnxExecutionProvider[],
|
|
22
|
+
callbacks: SynthesisCallbacks) {
|
|
22
23
|
|
|
23
24
|
const cacheLookupKey = modelPath
|
|
24
25
|
|
|
@@ -31,7 +32,13 @@ export async function synthesizeSentence(
|
|
|
31
32
|
cachedInstanceLookup.set(cacheLookupKey, vitsTTS)
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
const result = await vitsTTS.synthesizeSentence(
|
|
35
|
+
const result = await vitsTTS.synthesizeSentence(
|
|
36
|
+
text,
|
|
37
|
+
lengthScale,
|
|
38
|
+
speakerId,
|
|
39
|
+
lexicons,
|
|
40
|
+
callbacks,
|
|
41
|
+
)
|
|
35
42
|
|
|
36
43
|
return result
|
|
37
44
|
}
|
|
@@ -47,8 +54,10 @@ export class VitsTTS {
|
|
|
47
54
|
public readonly executionProviders: OnnxExecutionProvider[]) {
|
|
48
55
|
}
|
|
49
56
|
|
|
50
|
-
async synthesizeSentence(sentence: string, lengthScale: number, speakerId = 0, lexicons
|
|
51
|
-
const logger = new Logger()
|
|
57
|
+
async synthesizeSentence(sentence: string, lengthScale: number, speakerId = 0, lexicons: Lexicon[], callbacks: SynthesisCallbacks) {
|
|
58
|
+
const logger = new Logger(callbacks.logLevel)
|
|
59
|
+
|
|
60
|
+
await logger.startAsync('Initialize VITS ONNX synthesis model')
|
|
52
61
|
|
|
53
62
|
await this.initializeIfNeeded()
|
|
54
63
|
|
|
@@ -72,6 +81,7 @@ export class VitsTTS {
|
|
|
72
81
|
const Espeak = await import('../synthesis/EspeakTTS.js')
|
|
73
82
|
|
|
74
83
|
logger.end()
|
|
84
|
+
callbacks.abortSignal?.throwIfAborted()
|
|
75
85
|
|
|
76
86
|
const espeakOptions: EspeakOptions = {
|
|
77
87
|
...defaultEspeakOptions,
|
|
@@ -79,11 +89,23 @@ export class VitsTTS {
|
|
|
79
89
|
useKlatt: false
|
|
80
90
|
}
|
|
81
91
|
|
|
82
|
-
const {
|
|
92
|
+
const {
|
|
93
|
+
referenceSynthesizedAudio,
|
|
94
|
+
referenceTimeline,
|
|
95
|
+
fragments,
|
|
96
|
+
phonemizedFragmentsSubstitutions,
|
|
97
|
+
phonemizedSentence
|
|
98
|
+
} = await Espeak.preprocessAndSynthesize(
|
|
99
|
+
sentence,
|
|
100
|
+
languageCode,
|
|
101
|
+
espeakOptions,
|
|
102
|
+
lexicons,
|
|
103
|
+
callbacks,
|
|
104
|
+
)
|
|
83
105
|
|
|
84
|
-
|
|
85
|
-
logger.end()
|
|
106
|
+
logger.end()
|
|
86
107
|
|
|
108
|
+
if (phonemizedSentence.length == 0) {
|
|
87
109
|
return {
|
|
88
110
|
rawAudio: getEmptyRawAudio(1, outputSampleRate),
|
|
89
111
|
timeline: [],
|
|
@@ -147,7 +169,9 @@ export class VitsTTS {
|
|
|
147
169
|
const bigIntIds = new BigInt64Array(ids.map(id => BigInt(id)))
|
|
148
170
|
const idLengths = new BigInt64Array([BigInt(bigIntIds.length)])
|
|
149
171
|
|
|
150
|
-
|
|
172
|
+
logger.end()
|
|
173
|
+
callbacks.abortSignal?.throwIfAborted()
|
|
174
|
+
await logger.startAsync('Synthesize audio using model')
|
|
151
175
|
|
|
152
176
|
const Onnx = await import('onnxruntime-node')
|
|
153
177
|
|
|
@@ -170,6 +194,8 @@ export class VitsTTS {
|
|
|
170
194
|
|
|
171
195
|
const synthesizedAudio: RawAudio = { audioChannels: [modelOutputAudioSamples], sampleRate: outputSampleRate }
|
|
172
196
|
|
|
197
|
+
logger.end()
|
|
198
|
+
callbacks.abortSignal?.throwIfAborted()
|
|
173
199
|
await logger.startAsync('Align with reference synthesized audio')
|
|
174
200
|
|
|
175
201
|
const { alignUsingDtw } = await import('../alignment/SpeechAlignment.js')
|
|
@@ -177,7 +203,14 @@ export class VitsTTS {
|
|
|
177
203
|
const referenceWordTimeline = referenceTimeline.flatMap(phrase => phrase.timeline!)
|
|
178
204
|
|
|
179
205
|
const dtwWindowDuration = Math.max(5, Math.ceil(0.2 * getRawAudioDuration(synthesizedAudio)))
|
|
180
|
-
const mappedTimeline = await alignUsingDtw(
|
|
206
|
+
const mappedTimeline = await alignUsingDtw(
|
|
207
|
+
synthesizedAudio,
|
|
208
|
+
referenceSynthesizedAudio,
|
|
209
|
+
referenceWordTimeline,
|
|
210
|
+
['high'],
|
|
211
|
+
[dtwWindowDuration],
|
|
212
|
+
{ ...callbacks, logLevel: 'warning' },
|
|
213
|
+
)
|
|
181
214
|
|
|
182
215
|
logger.end()
|
|
183
216
|
|
|
@@ -189,9 +222,6 @@ export class VitsTTS {
|
|
|
189
222
|
return
|
|
190
223
|
}
|
|
191
224
|
|
|
192
|
-
const logger = new Logger()
|
|
193
|
-
await logger.startAsync('Initialize VITS ONNX synthesis model')
|
|
194
|
-
|
|
195
225
|
const Onnx = await import('onnxruntime-node')
|
|
196
226
|
|
|
197
227
|
const filesInModelPath = await readdir(this.modelPath)
|
|
@@ -213,8 +243,6 @@ export class VitsTTS {
|
|
|
213
243
|
for (const key in this.metadata.phoneme_id_map) {
|
|
214
244
|
this.phonemeMap.set(key, this.metadata.phoneme_id_map[key])
|
|
215
245
|
}
|
|
216
|
-
|
|
217
|
-
logger.end()
|
|
218
246
|
}
|
|
219
247
|
}
|
|
220
248
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { Logger } from '../utilities/Logger.js'
|
|
2
|
+
import { parseText } from '../nlp/Segmentation.js'
|
|
3
|
+
import { TextTranslationCallbacks, TranslationPair } from '../api/TextTranslation.js'
|
|
4
|
+
import { getChromeOnWindowsHeaders } from '../utilities/BrowserRequestHeaders.js'
|
|
5
|
+
import { requestHttp } from 'easier-http-request'
|
|
6
6
|
|
|
7
|
-
export async function translateText(text: string, sourceLanguage: string, targetLanguage: string): Promise<TranslationPair[]> {
|
|
8
|
-
const logger = new Logger()
|
|
7
|
+
export async function translateText(text: string, sourceLanguage: string, targetLanguage: string, callbacks: TextTranslationCallbacks): Promise<TranslationPair[]> {
|
|
8
|
+
const logger = new Logger(callbacks.logLevel)
|
|
9
9
|
|
|
10
10
|
logger.start(`Prepare request`)
|
|
11
11
|
|
|
@@ -58,7 +58,7 @@ export async function translateText(text: string, sourceLanguage: string, target
|
|
|
58
58
|
id: 756456347,
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const response = await
|
|
61
|
+
const response = await requestHttp({
|
|
62
62
|
method: 'POST',
|
|
63
63
|
|
|
64
64
|
url: `https://www2.deepl.com/jsonrpc`,
|
|
@@ -76,11 +76,13 @@ export async function translateText(text: string, sourceLanguage: string, target
|
|
|
76
76
|
'Content-Type': 'application/json',
|
|
77
77
|
},
|
|
78
78
|
|
|
79
|
-
body:
|
|
79
|
+
body: requestBodyObject,
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
abortSignal: callbacks?.abortSignal
|
|
82
82
|
})
|
|
83
83
|
|
|
84
|
+
const responseObject = await response.json()
|
|
85
|
+
|
|
84
86
|
logger.start('Parse response')
|
|
85
87
|
|
|
86
88
|
logger.end()
|