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
package/dist/api/Synthesis.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import * as API from './API.js';
|
|
1
2
|
import { RawAudio } from '../audio/AudioUtilities.js';
|
|
2
3
|
import { type RubberbandOptions } from '../dsp/Rubberband.js';
|
|
3
|
-
import * as API from './API.js';
|
|
4
4
|
import { Timeline } from '../utilities/Timeline.js';
|
|
5
5
|
import { EngineMetadata } from './Common.js';
|
|
6
6
|
import { type SubtitlesConfig } from '../subtitles/Subtitles.js';
|
|
@@ -8,16 +8,16 @@ import { type OpenAICloudTTSOptions } from '../synthesis/OpenAICloudTTS.js';
|
|
|
8
8
|
import { type ElevenLabsTTSOptions } from '../synthesis/ElevenLabsTTS.js';
|
|
9
9
|
import { type DeepgramTTSOptions } from '../synthesis/DeepgramTTS.js';
|
|
10
10
|
import { OnnxExecutionProvider } from '../utilities/OnnxUtilities.js';
|
|
11
|
-
export declare function synthesize(input: string | string[], options: SynthesisOptions,
|
|
11
|
+
export declare function synthesize(input: string | string[], options: SynthesisOptions, callbacks?: SynthesisCallbacks): Promise<SynthesisResult>;
|
|
12
12
|
export interface SynthesisResult {
|
|
13
13
|
audio: RawAudio | Uint8Array;
|
|
14
14
|
timeline: Timeline;
|
|
15
15
|
language: string;
|
|
16
16
|
voice: string;
|
|
17
17
|
}
|
|
18
|
-
export type SynthesisEngine = 'vits' | 'kokoro' | 'pico' | 'flite' | 'gnuspeech' | 'espeak' | 'sam' | 'sapi' | 'msspeech' | 'coqui-server' | 'google-cloud' | 'microsoft-azure' | 'amazon-polly' | 'openai-cloud' | 'elevenlabs' | 'deepgram' | 'google-translate' | 'microsoft-edge'
|
|
18
|
+
export type SynthesisEngine = 'vits' | 'kokoro' | 'pico' | 'flite' | 'gnuspeech' | 'espeak' | 'sam' | 'sapi' | 'msspeech' | 'coqui-server' | 'google-cloud' | 'microsoft-azure' | 'amazon-polly' | 'openai-cloud' | 'elevenlabs' | 'deepgram' | 'google-translate' | 'microsoft-edge';
|
|
19
19
|
export type TimePitchShiftingMethod = 'sonic' | 'rubberband';
|
|
20
|
-
export interface SynthesisOptions {
|
|
20
|
+
export interface SynthesisOptions extends API.OperationOptions {
|
|
21
21
|
engine?: SynthesisEngine;
|
|
22
22
|
language?: string;
|
|
23
23
|
voice?: string;
|
|
@@ -115,14 +115,15 @@ export interface SynthesisOptions {
|
|
|
115
115
|
trustedClientToken?: string;
|
|
116
116
|
pitchDeltaHz?: number;
|
|
117
117
|
};
|
|
118
|
-
streamlabsPolly?: {};
|
|
119
118
|
}
|
|
120
119
|
export declare const defaultSynthesisOptions: SynthesisOptions;
|
|
121
|
-
export declare function requestVoiceList(options: VoiceListRequestOptions): Promise<RequestVoiceListResult>;
|
|
120
|
+
export declare function requestVoiceList(options: VoiceListRequestOptions, callbacks?: VoiceListRequestCallbacks): Promise<RequestVoiceListResult>;
|
|
122
121
|
export interface RequestVoiceListResult {
|
|
123
122
|
voiceList: API.SynthesisVoice[];
|
|
124
123
|
bestMatchingVoice: API.SynthesisVoice;
|
|
125
124
|
}
|
|
125
|
+
export interface VoiceListRequestCallbacks extends API.OperationCallbacks {
|
|
126
|
+
}
|
|
126
127
|
export declare function selectBestOfflineEngineForLanguage(language: string): Promise<SynthesisEngine>;
|
|
127
128
|
export declare function getAllLangCodesFromVoiceList(voiceList: SynthesisVoice[]): string[];
|
|
128
129
|
export interface VoiceListRequestOptions extends SynthesisOptions {
|
|
@@ -132,7 +133,7 @@ export interface VoiceListRequestOptions extends SynthesisOptions {
|
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
135
|
export declare const defaultVoiceListRequestOptions: VoiceListRequestOptions;
|
|
135
|
-
export interface
|
|
136
|
+
export interface SynthesisSegmentCallbackData {
|
|
136
137
|
index: number;
|
|
137
138
|
total: number;
|
|
138
139
|
audio: RawAudio | Uint8Array;
|
|
@@ -141,7 +142,11 @@ export interface SynthesisSegmentEventData {
|
|
|
141
142
|
language: string;
|
|
142
143
|
peakDecibelsSoFar: number;
|
|
143
144
|
}
|
|
144
|
-
export type
|
|
145
|
+
export type SynthesisSegmentCallback = (data: SynthesisSegmentCallbackData) => Promise<void>;
|
|
146
|
+
export interface SynthesisCallbacks extends API.OperationCallbacks {
|
|
147
|
+
onSegment?: SynthesisSegmentCallback;
|
|
148
|
+
onSentence?: SynthesisSegmentCallback;
|
|
149
|
+
}
|
|
145
150
|
export interface SynthesisVoice {
|
|
146
151
|
name: string;
|
|
147
152
|
languages: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Synthesis.d.ts","sourceRoot":"","sources":["../../src/api/Synthesis.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Synthesis.d.ts","sourceRoot":"","sources":["../../src/api/Synthesis.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAO/B,OAAO,EAAE,QAAQ,EAAgN,MAAM,4BAA4B,CAAA;AAInQ,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAG7D,OAAO,EAAE,QAAQ,EAAoE,MAAM,0BAA0B,CAAA;AAIrH,OAAO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,GAAG,UAAU,CAAA;IAC5B,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,iBAAiB,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,MAAM,wBAAwB,GAAG,CAAC,IAAI,EAAE,4BAA4B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAE5F,MAAM,WAAW,kBAAmB,SAAQ,GAAG,CAAC,kBAAkB;IACjE,SAAS,CAAC,EAAE,wBAAwB,CAAA;IACpC,UAAU,CAAC,EAAE,wBAAwB,CAAA;CACrC;AAED,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,MAAM,EAAE,WAAW,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAClB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEvD,eAAO,MAAM,gBAAgB,EAAE,cAAc,EA6G5C,CAAA"}
|
package/dist/api/Synthesis.js
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import * as API from './API.js';
|
|
1
3
|
import { deepClone, extendDeep } from '../utilities/ObjectUtilities.js';
|
|
2
4
|
import * as FFMpegTranscoder from '../codecs/FFMpegTranscoder.js';
|
|
3
|
-
import { clip, sha256AsHex, stringifyAndFormatJson,
|
|
5
|
+
import { clip, sha256AsHex, stringifyAndFormatJson, yieldToEventLoop, runOperationWithRetries } from '../utilities/Utilities.js';
|
|
4
6
|
import { concatAudioSegments, downmixToMono, encodeRawAudioToWave, getSamplePeakDecibels, getEmptyRawAudio, getRawAudioDuration, trimAudioEnd, trimAudioStart, attenuateIfClippingInPlace, normalizeAudioLevelInPlace } from '../audio/AudioUtilities.js';
|
|
5
7
|
import { Logger } from '../utilities/Logger.js';
|
|
6
8
|
import { isWordOrSymbolWord, parseText, splitToParagraphs } from '../nlp/Segmentation.js';
|
|
7
9
|
import { loadLexiconsForLanguage } from '../nlp/Lexicon.js';
|
|
8
|
-
import * as API from './API.js';
|
|
9
10
|
import { addTimeOffsetToTimeline, multiplyTimelineByFactor } from '../utilities/Timeline.js';
|
|
10
11
|
import { getAppDataDir, ensureDir, existsSync, isFileIsUpToDate, readAndParseJsonFile, writeFileSafe } from '../utilities/FileSystem.js';
|
|
11
12
|
import { formatLanguageCodeWithName, getShortLanguageCode, normalizeLanguageCode, defaultDialectForLanguageCode, normalizeIdentifierToLanguageCode } from '../utilities/Locale.js';
|
|
12
13
|
import { loadPackage } from '../utilities/PackageManager.js';
|
|
13
14
|
import { appName } from './Common.js';
|
|
14
|
-
import { shouldCancelCurrentTask } from '../server/Worker.js';
|
|
15
|
-
import chalk from 'chalk';
|
|
16
15
|
import { simplifyPunctuationCharacters } from '../nlp/TextNormalizer.js';
|
|
17
16
|
import { convertHtmlToText } from '../utilities/StringUtilities.js';
|
|
18
17
|
import { joinPath, resolvePath } from '../utilities/PathUtilities.js';
|
|
19
18
|
import { Timer } from '../utilities/Timer.js';
|
|
20
|
-
const log = logToStderr;
|
|
21
19
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
22
20
|
// Synthesis
|
|
23
21
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
24
|
-
export async function synthesize(input, options,
|
|
22
|
+
export async function synthesize(input, options, callbacks) {
|
|
25
23
|
options = extendDeep(defaultSynthesisOptions, options);
|
|
26
24
|
let segments;
|
|
27
25
|
if (Array.isArray(input)) {
|
|
@@ -34,11 +32,12 @@ export async function synthesize(input, options, onSegment, onSentence) {
|
|
|
34
32
|
const plainTextOptions = options.plainText;
|
|
35
33
|
segments = splitToParagraphs(input, plainTextOptions.paragraphBreaks, plainTextOptions.whitespace);
|
|
36
34
|
}
|
|
37
|
-
return synthesizeSegments(segments, options,
|
|
35
|
+
return synthesizeSegments(segments, options, callbacks);
|
|
38
36
|
}
|
|
39
|
-
async function synthesizeSegments(segments, options,
|
|
40
|
-
const logger = new Logger();
|
|
37
|
+
async function synthesizeSegments(segments, options, callbacks) {
|
|
41
38
|
options = extendDeep(defaultSynthesisOptions, options);
|
|
39
|
+
callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks };
|
|
40
|
+
const logger = new Logger(callbacks.logLevel);
|
|
42
41
|
const totalSynthesisTimeTimer = new Timer();
|
|
43
42
|
if (!options.language && !options.voice) {
|
|
44
43
|
logger.start('No language or voice specified. Detect language');
|
|
@@ -49,7 +48,7 @@ async function synthesizeSegments(segments, options, onSegment, onSentence) {
|
|
|
49
48
|
segmentsPlainText.push(await convertHtmlToText(segment));
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
|
-
const { detectedLanguage } = await API.detectTextLanguage(segmentsPlainText.join('\n\n'), options.languageDetection
|
|
51
|
+
const { detectedLanguage } = await API.detectTextLanguage(segmentsPlainText.join('\n\n'), options.languageDetection, { abortSignal: callbacks.abortSignal, logLevel: 'warning' });
|
|
53
52
|
options.language = detectedLanguage;
|
|
54
53
|
logger.end();
|
|
55
54
|
logger.logTitledMessage('Language detected', formatLanguageCodeWithName(detectedLanguage));
|
|
@@ -62,7 +61,7 @@ async function synthesizeSegments(segments, options, onSegment, onSentence) {
|
|
|
62
61
|
logger.logTitledMessage('No engine specified. Auto-selected engine', options.engine);
|
|
63
62
|
}
|
|
64
63
|
logger.start(`Get voice list for ${options.engine}`);
|
|
65
|
-
const { bestMatchingVoice } = await requestVoiceList(options);
|
|
64
|
+
const { bestMatchingVoice } = await requestVoiceList(options, { ...callbacks, logLevel: 'warning' });
|
|
66
65
|
if (!bestMatchingVoice) {
|
|
67
66
|
throw new Error('No matching voice found');
|
|
68
67
|
}
|
|
@@ -78,6 +77,7 @@ async function synthesizeSegments(segments, options, onSegment, onSentence) {
|
|
|
78
77
|
let peakDecibelsSoFar = -100;
|
|
79
78
|
let timeOffset = 0;
|
|
80
79
|
for (let segmentIndex = 0; segmentIndex < segments.length; segmentIndex++) {
|
|
80
|
+
callbacks?.abortSignal?.throwIfAborted();
|
|
81
81
|
const segmentText = segments[segmentIndex];
|
|
82
82
|
logger.log(`\n${chalk.magentaBright(`Synthesizing segment ${segmentIndex + 1}/${segments.length}`)}: '${segmentText.trim()}'`);
|
|
83
83
|
const segmentStartTime = timeOffset;
|
|
@@ -102,17 +102,14 @@ async function synthesizeSegments(segments, options, onSegment, onSentence) {
|
|
|
102
102
|
const sentencesRawAudio = [];
|
|
103
103
|
const sentencesTimelines = [];
|
|
104
104
|
for (let sentenceIndex = 0; sentenceIndex < sentences.length; sentenceIndex++) {
|
|
105
|
+
callbacks?.abortSignal?.throwIfAborted();
|
|
105
106
|
await yieldToEventLoop();
|
|
106
|
-
if (shouldCancelCurrentTask()) {
|
|
107
|
-
//log('\n\n\n\n\nCANCELED\n\n\n\n')
|
|
108
|
-
throw new Error('Canceled');
|
|
109
|
-
}
|
|
110
107
|
const sentenceText = sentences[sentenceIndex];
|
|
111
|
-
logger.log(`\n${chalk.magentaBright(`Synthesizing sentence ${sentenceIndex + 1}/${sentences.length}`)}:
|
|
108
|
+
logger.log(`\n${chalk.magentaBright(`Synthesizing sentence ${sentenceIndex + 1}/${sentences.length}`)}: '${sentenceText.trim()}'`);
|
|
112
109
|
const sentenceStartTime = timeOffset;
|
|
113
110
|
let sentenceSynthesisOptions = { postProcessing: { normalizeAudio: false } };
|
|
114
111
|
sentenceSynthesisOptions = extendDeep(options, sentenceSynthesisOptions);
|
|
115
|
-
const { synthesizedAudio: sentenceRawAudio, timeline: sentenceTimeline } = await synthesizeSegment(sentenceText, sentenceSynthesisOptions);
|
|
112
|
+
const { synthesizedAudio: sentenceRawAudio, timeline: sentenceTimeline } = await synthesizeSegment(sentenceText, sentenceSynthesisOptions, callbacks);
|
|
116
113
|
const endPause = sentenceIndex == sentences.length - 1 ? options.segmentEndPause : options.sentenceEndPause;
|
|
117
114
|
sentenceRawAudio.audioChannels[0] = trimAudioEnd(sentenceRawAudio.audioChannels[0], endPause * sentenceRawAudio.sampleRate);
|
|
118
115
|
sentencesRawAudio.push(sentenceRawAudio);
|
|
@@ -132,8 +129,8 @@ async function synthesizeSegments(segments, options, onSegment, onSentence) {
|
|
|
132
129
|
});
|
|
133
130
|
peakDecibelsSoFar = Math.max(peakDecibelsSoFar, getSamplePeakDecibels(sentenceRawAudio.audioChannels));
|
|
134
131
|
const sentenceAudio = await convertToTargetCodecIfNeeded(sentenceRawAudio);
|
|
135
|
-
if (onSentence) {
|
|
136
|
-
await onSentence({
|
|
132
|
+
if (callbacks?.onSentence) {
|
|
133
|
+
await callbacks.onSentence({
|
|
137
134
|
index: sentenceIndex,
|
|
138
135
|
total: sentences.length,
|
|
139
136
|
audio: sentenceAudio,
|
|
@@ -161,8 +158,8 @@ async function synthesizeSegments(segments, options, onSegment, onSentence) {
|
|
|
161
158
|
segmentsTimelines.push(segmentTimelineWithoutOffset);
|
|
162
159
|
const segmentAudio = await convertToTargetCodecIfNeeded(segmentRawAudio);
|
|
163
160
|
logger.end();
|
|
164
|
-
if (onSegment) {
|
|
165
|
-
await onSegment({
|
|
161
|
+
if (callbacks?.onSegment) {
|
|
162
|
+
await callbacks.onSegment({
|
|
166
163
|
index: segmentIndex,
|
|
167
164
|
total: segments.length,
|
|
168
165
|
audio: segmentAudio,
|
|
@@ -198,7 +195,7 @@ async function synthesizeSegments(segments, options, onSegment, onSentence) {
|
|
|
198
195
|
}
|
|
199
196
|
else {
|
|
200
197
|
const ffmpegOptions = FFMpegTranscoder.getDefaultFFMpegOptionsForSpeech(targetCodec, options.outputAudioFormat?.bitrate);
|
|
201
|
-
output = await FFMpegTranscoder.encodeFromChannels(rawAudio, ffmpegOptions);
|
|
198
|
+
output = await FFMpegTranscoder.encodeFromChannels(rawAudio, ffmpegOptions, callbacks);
|
|
202
199
|
}
|
|
203
200
|
}
|
|
204
201
|
else {
|
|
@@ -208,7 +205,7 @@ async function synthesizeSegments(segments, options, onSegment, onSentence) {
|
|
|
208
205
|
}
|
|
209
206
|
const resultAudio = await convertToTargetCodecIfNeeded(resultRawAudio);
|
|
210
207
|
logger.end();
|
|
211
|
-
logger.logTitledMessage('Total synthesis time', `${totalSynthesisTimeTimer.elapsedTime.toFixed(1)}ms`, chalk.magentaBright);
|
|
208
|
+
logger.logTitledMessage('Total synthesis time', `${totalSynthesisTimeTimer.elapsedTime.toFixed(1)}ms`, 'info', chalk.magentaBright);
|
|
212
209
|
return {
|
|
213
210
|
audio: resultAudio,
|
|
214
211
|
timeline,
|
|
@@ -216,14 +213,15 @@ async function synthesizeSegments(segments, options, onSegment, onSentence) {
|
|
|
216
213
|
voice: options.voice
|
|
217
214
|
};
|
|
218
215
|
}
|
|
219
|
-
async function synthesizeSegment(text, options) {
|
|
220
|
-
|
|
216
|
+
async function synthesizeSegment(text, options, callbacks) {
|
|
217
|
+
callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks };
|
|
218
|
+
const logger = new Logger(callbacks.logLevel);
|
|
221
219
|
const startTimestamp = logger.getTimestamp();
|
|
222
220
|
logger.start('Prepare text for synthesis');
|
|
223
221
|
const simplifiedText = simplifyPunctuationCharacters(text);
|
|
224
222
|
const engine = options.engine;
|
|
225
223
|
logger.start(`Get voice list for ${engine}`);
|
|
226
|
-
const { bestMatchingVoice } = await requestVoiceList(options);
|
|
224
|
+
const { bestMatchingVoice } = await requestVoiceList(options, { ...callbacks, logLevel: 'warning' });
|
|
227
225
|
if (!bestMatchingVoice) {
|
|
228
226
|
throw new Error('No matching voice found');
|
|
229
227
|
}
|
|
@@ -231,7 +229,7 @@ async function synthesizeSegment(text, options) {
|
|
|
231
229
|
let voicePackagePath;
|
|
232
230
|
if (selectedVoice.packageName) {
|
|
233
231
|
logger.end();
|
|
234
|
-
voicePackagePath = await loadPackage(selectedVoice.packageName);
|
|
232
|
+
voicePackagePath = await loadPackage(selectedVoice.packageName, callbacks);
|
|
235
233
|
}
|
|
236
234
|
logger.start(`Initialize ${engine} module`);
|
|
237
235
|
const voice = selectedVoice.name;
|
|
@@ -277,7 +275,7 @@ async function synthesizeSegment(text, options) {
|
|
|
277
275
|
const modelPath = voicePackagePath;
|
|
278
276
|
const onnxExecutionProviders = vitsOptions.provider ? [vitsOptions.provider] : [];
|
|
279
277
|
logger.end();
|
|
280
|
-
const { rawAudio, timeline: outTimeline } = await vitsTTS.synthesizeSentence(text, voice, modelPath, lengthScale, speakerId ?? 0, lexicons, onnxExecutionProviders);
|
|
278
|
+
const { rawAudio, timeline: outTimeline } = await vitsTTS.synthesizeSentence(text, voice, modelPath, lengthScale, speakerId ?? 0, lexicons, onnxExecutionProviders, callbacks);
|
|
281
279
|
synthesizedAudio = rawAudio;
|
|
282
280
|
timeline = outTimeline;
|
|
283
281
|
shouldPostprocessPitch = true;
|
|
@@ -294,11 +292,11 @@ async function synthesizeSegment(text, options) {
|
|
|
294
292
|
const onnxExecutionProviders = kokoroOptions.provider ? [kokoroOptions.provider] : [];
|
|
295
293
|
const modelName = kokoroOptions.model;
|
|
296
294
|
const modelPackageName = `kokoro-${modelName}`;
|
|
297
|
-
const modelPath = await loadPackage(modelPackageName);
|
|
298
|
-
const voicesPath = await loadPackage('kokoro-82m-v1.0-voices');
|
|
295
|
+
const modelPath = await loadPackage(modelPackageName, callbacks);
|
|
296
|
+
const voicesPath = await loadPackage('kokoro-82m-v1.0-voices', callbacks);
|
|
299
297
|
logger.end();
|
|
300
298
|
logger.logTitledMessage(`Using model`, modelPackageName);
|
|
301
|
-
const { rawAudio, timeline: outTimeline } = await kokoroTTS.synthesizeSentence(text, selectedVoice, speed, lexicons, modelPath, voicesPath, onnxExecutionProviders);
|
|
299
|
+
const { rawAudio, timeline: outTimeline } = await kokoroTTS.synthesizeSentence(text, selectedVoice, speed, lexicons, modelPath, voicesPath, onnxExecutionProviders, callbacks);
|
|
302
300
|
synthesizedAudio = rawAudio;
|
|
303
301
|
timeline = outTimeline;
|
|
304
302
|
shouldPostprocessPitch = true;
|
|
@@ -318,7 +316,7 @@ async function synthesizeSegment(text, options) {
|
|
|
318
316
|
const { textAnalysisFilename, signalGenerationFilename } = SvoxPicoTTS.getResourceFilenamesForLanguage(language);
|
|
319
317
|
const resourceFilePath = resolvePath(voicePackagePath, textAnalysisFilename);
|
|
320
318
|
const signalGenerationFilePath = resolvePath(voicePackagePath, signalGenerationFilename);
|
|
321
|
-
const { rawAudio } = await SvoxPicoTTS.synthesize(preparedText, resourceFilePath, signalGenerationFilePath);
|
|
319
|
+
const { rawAudio } = await SvoxPicoTTS.synthesize(preparedText, resourceFilePath, signalGenerationFilePath, undefined, callbacks);
|
|
322
320
|
synthesizedAudio = rawAudio;
|
|
323
321
|
break;
|
|
324
322
|
}
|
|
@@ -328,7 +326,7 @@ async function synthesizeSegment(text, options) {
|
|
|
328
326
|
}
|
|
329
327
|
const FliteTTS = await import('../synthesis/FliteTTS.js');
|
|
330
328
|
logger.end();
|
|
331
|
-
const { rawAudio, events } = await FliteTTS.synthesize(simplifiedText, voice, voicePackagePath, speed);
|
|
329
|
+
const { rawAudio, events } = await FliteTTS.synthesize(simplifiedText, voice, voicePackagePath, speed, undefined, undefined, callbacks);
|
|
332
330
|
synthesizedAudio = rawAudio;
|
|
333
331
|
shouldPostprocessPitch = true;
|
|
334
332
|
break;
|
|
@@ -338,14 +336,20 @@ async function synthesizeSegment(text, options) {
|
|
|
338
336
|
throw new Error(`The Gnuspeech engine doesn't currently support SSML inputs`);
|
|
339
337
|
}
|
|
340
338
|
const engineOptions = options.gnuspeech;
|
|
339
|
+
let defaultGnuSpeechOptions;
|
|
340
|
+
try {
|
|
341
|
+
({ defaultGnuSpeechOptions } = await import('@echogarden/gnuspeech-wasm'));
|
|
342
|
+
}
|
|
343
|
+
catch {
|
|
344
|
+
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'.`);
|
|
345
|
+
}
|
|
341
346
|
const GnuSpeech = await import('../synthesis/GnuSpeechTTS.js');
|
|
342
|
-
const { defaultGnuSpeechOptions } = await import('@echogarden/gnuspeech-wasm');
|
|
343
347
|
const gnuSpeechOptions = extendDeep(defaultGnuSpeechOptions, engineOptions);
|
|
344
348
|
if (!engineOptions.tempo) {
|
|
345
349
|
gnuSpeechOptions.tempo = speed;
|
|
346
350
|
}
|
|
347
351
|
await logger.startAsync(`Synthesize with Gnuspeech`);
|
|
348
|
-
const { rawAudio } = await GnuSpeech.synthesize(simplifiedText, gnuSpeechOptions);
|
|
352
|
+
const { rawAudio } = await GnuSpeech.synthesize(simplifiedText, gnuSpeechOptions, callbacks);
|
|
349
353
|
synthesizedAudio = rawAudio;
|
|
350
354
|
shouldPostprocessPitch = true;
|
|
351
355
|
logger.end();
|
|
@@ -372,13 +376,13 @@ async function synthesizeSegment(text, options) {
|
|
|
372
376
|
};
|
|
373
377
|
if (inputIsSSML) {
|
|
374
378
|
logger.end();
|
|
375
|
-
const { rawAudio } = await EspeakTTS.synthesize(text, espeakOptions);
|
|
379
|
+
const { rawAudio } = await EspeakTTS.synthesize(text, espeakOptions, callbacks);
|
|
376
380
|
synthesizedAudio = rawAudio;
|
|
377
381
|
}
|
|
378
382
|
else {
|
|
379
383
|
const lexicons = await loadLexiconsForLanguage(language, options.customLexiconPaths);
|
|
380
384
|
logger.end();
|
|
381
|
-
const { referenceSynthesizedAudio, referenceTimeline } = await EspeakTTS.preprocessAndSynthesize(text, espeakLanguage, espeakOptions, lexicons);
|
|
385
|
+
const { referenceSynthesizedAudio, referenceTimeline } = await EspeakTTS.preprocessAndSynthesize(text, espeakLanguage, espeakOptions, lexicons, callbacks);
|
|
382
386
|
synthesizedAudio = referenceSynthesizedAudio;
|
|
383
387
|
timeline = referenceTimeline.flatMap(clause => clause.timeline);
|
|
384
388
|
}
|
|
@@ -395,7 +399,7 @@ async function synthesizeSegment(text, options) {
|
|
|
395
399
|
const samMouth = clip(engineOptions.mouth, 0, 255);
|
|
396
400
|
const samThroat = clip(engineOptions.throat, 0, 255);
|
|
397
401
|
logger.end();
|
|
398
|
-
const { rawAudio } = await SamTTS.synthesize(simplifiedText, samPitch, samSpeed, samMouth, samThroat);
|
|
402
|
+
const { rawAudio } = await SamTTS.synthesize(simplifiedText, samPitch, samSpeed, samMouth, samThroat, callbacks);
|
|
399
403
|
synthesizedAudio = rawAudio;
|
|
400
404
|
break;
|
|
401
405
|
}
|
|
@@ -408,7 +412,7 @@ async function synthesizeSegment(text, options) {
|
|
|
408
412
|
const engineOptions = options.sapi;
|
|
409
413
|
const sapiRate = engineOptions.rate || 0;
|
|
410
414
|
logger.end();
|
|
411
|
-
const { rawAudio, timeline: outTimeline } = await SapiTTS.synthesize(text, voice, sapiRate, false);
|
|
415
|
+
const { rawAudio, timeline: outTimeline } = await SapiTTS.synthesize(text, voice, sapiRate, false, callbacks);
|
|
412
416
|
synthesizedAudio = rawAudio;
|
|
413
417
|
timeline = outTimeline;
|
|
414
418
|
shouldPostprocessSpeed = true;
|
|
@@ -424,7 +428,7 @@ async function synthesizeSegment(text, options) {
|
|
|
424
428
|
const engineOptions = options.msspeech;
|
|
425
429
|
const sapiRate = engineOptions.rate || 0;
|
|
426
430
|
logger.end();
|
|
427
|
-
const { rawAudio, timeline: outTimeline } = await SapiTTS.synthesize(text, voice, sapiRate, true);
|
|
431
|
+
const { rawAudio, timeline: outTimeline } = await SapiTTS.synthesize(text, voice, sapiRate, true, callbacks);
|
|
428
432
|
synthesizedAudio = rawAudio;
|
|
429
433
|
timeline = outTimeline;
|
|
430
434
|
shouldPostprocessSpeed = true;
|
|
@@ -443,7 +447,7 @@ async function synthesizeSegment(text, options) {
|
|
|
443
447
|
throw new Error(`'coqui-server' requires a server URL`);
|
|
444
448
|
}
|
|
445
449
|
logger.end();
|
|
446
|
-
const { rawAudio } = await CoquiServerTTS.synthesize(simplifiedText, speakerId, serverUrl);
|
|
450
|
+
const { rawAudio } = await CoquiServerTTS.synthesize(simplifiedText, speakerId, serverUrl, callbacks);
|
|
447
451
|
synthesizedAudio = rawAudio;
|
|
448
452
|
shouldPostprocessSpeed = true;
|
|
449
453
|
shouldPostprocessPitch = true;
|
|
@@ -469,7 +473,7 @@ async function synthesizeSegment(text, options) {
|
|
|
469
473
|
pitchDeltaSemitones = Math.round(-17.3132 * Math.log(1 / pitch));
|
|
470
474
|
}
|
|
471
475
|
logger.end();
|
|
472
|
-
const { rawAudio, timepoints } = await GoogleCloudTTS.synthesize(text, apiKey, language, voice, speed, pitchDeltaSemitones, 0, inputIsSSML);
|
|
476
|
+
const { rawAudio, timepoints } = await GoogleCloudTTS.synthesize(text, apiKey, language, voice, speed, pitchDeltaSemitones, 0, inputIsSSML, undefined, undefined, callbacks);
|
|
473
477
|
synthesizedAudio = rawAudio;
|
|
474
478
|
break;
|
|
475
479
|
}
|
|
@@ -498,7 +502,7 @@ async function synthesizeSegment(text, options) {
|
|
|
498
502
|
}
|
|
499
503
|
const ssmlRate = convertSpeedScaleToSSMLValueString(speed);
|
|
500
504
|
logger.end();
|
|
501
|
-
const { rawAudio, timeline: outTimeline } = await AzureCognitiveServicesTTS.synthesize(text, subscriptionKey, serviceRegion, language, voice, inputIsSSML, ssmlPitch, ssmlRate);
|
|
505
|
+
const { rawAudio, timeline: outTimeline } = await AzureCognitiveServicesTTS.synthesize(text, subscriptionKey, serviceRegion, language, voice, inputIsSSML, ssmlPitch, ssmlRate, callbacks);
|
|
502
506
|
synthesizedAudio = rawAudio;
|
|
503
507
|
timeline = outTimeline;
|
|
504
508
|
break;
|
|
@@ -521,7 +525,7 @@ async function synthesizeSegment(text, options) {
|
|
|
521
525
|
const pollyEngine = engineOptions.pollyEngine;
|
|
522
526
|
const lexiconNames = engineOptions.lexiconNames;
|
|
523
527
|
logger.end();
|
|
524
|
-
const { rawAudio } = await AwsPollyTTS.synthesize(text, undefined, voice, region, accessKeyId, secretAccessKey, pollyEngine, inputIsSSML, lexiconNames);
|
|
528
|
+
const { rawAudio } = await AwsPollyTTS.synthesize(text, undefined, voice, region, accessKeyId, secretAccessKey, pollyEngine, inputIsSSML, lexiconNames, callbacks);
|
|
525
529
|
synthesizedAudio = rawAudio;
|
|
526
530
|
shouldPostprocessSpeed = true;
|
|
527
531
|
shouldPostprocessPitch = true;
|
|
@@ -534,7 +538,7 @@ async function synthesizeSegment(text, options) {
|
|
|
534
538
|
throw new Error(`No API key given`);
|
|
535
539
|
}
|
|
536
540
|
logger.end();
|
|
537
|
-
synthesizedAudio = await OpenAICloudTTS.synthesize(text, voice, speed, openAICloudTTSOptions);
|
|
541
|
+
synthesizedAudio = await OpenAICloudTTS.synthesize(text, voice, speed, openAICloudTTSOptions, callbacks);
|
|
538
542
|
shouldPostprocessSpeed = false;
|
|
539
543
|
shouldPostprocessPitch = true;
|
|
540
544
|
break;
|
|
@@ -550,7 +554,7 @@ async function synthesizeSegment(text, options) {
|
|
|
550
554
|
}
|
|
551
555
|
const voiceId = selectedVoice['elevenLabsVoiceId'];
|
|
552
556
|
logger.end();
|
|
553
|
-
const { rawAudio, timeline: outTimeline } = await ElevenLabsTTS.synthesize(text, voiceId, language, engineOptions);
|
|
557
|
+
const { rawAudio, timeline: outTimeline } = await ElevenLabsTTS.synthesize(text, voiceId, language, engineOptions, callbacks);
|
|
554
558
|
synthesizedAudio = rawAudio;
|
|
555
559
|
timeline = outTimeline;
|
|
556
560
|
shouldPostprocessSpeed = true;
|
|
@@ -568,7 +572,7 @@ async function synthesizeSegment(text, options) {
|
|
|
568
572
|
}
|
|
569
573
|
const modelId = selectedVoice.deepgramModelId;
|
|
570
574
|
logger.end();
|
|
571
|
-
const { rawAudio } = await DeepgramTTS.synthesize(text, modelId, engineOptions);
|
|
575
|
+
const { rawAudio } = await DeepgramTTS.synthesize(text, modelId, engineOptions, callbacks);
|
|
572
576
|
synthesizedAudio = rawAudio;
|
|
573
577
|
shouldPostprocessSpeed = true;
|
|
574
578
|
shouldPostprocessPitch = true;
|
|
@@ -580,11 +584,11 @@ async function synthesizeSegment(text, options) {
|
|
|
580
584
|
}
|
|
581
585
|
const GoogleTranslateTTS = await import('../synthesis/GoogleTranslateTTS.js');
|
|
582
586
|
logger.end();
|
|
583
|
-
const { rawAudio, timeline: segmentTimeline } = await runOperationWithRetries(() => GoogleTranslateTTS.synthesizeLongText(text, language, options.googleTranslate?.tld, options.sentenceEndPause, options.segmentEndPause),
|
|
587
|
+
const { rawAudio, timeline: segmentTimeline } = await runOperationWithRetries(() => GoogleTranslateTTS.synthesizeLongText(text, language, options.googleTranslate?.tld, options.sentenceEndPause, options.segmentEndPause, callbacks), 'Google Translate TTS', callbacks);
|
|
584
588
|
synthesizedAudio = rawAudio;
|
|
585
589
|
logger.start(`Generate word-level timestamps by individually aligning fragments`);
|
|
586
590
|
const alignmentOptions = extendDeep(options.alignment, { language });
|
|
587
|
-
timeline = await API.alignSegments(synthesizedAudio, segmentTimeline, alignmentOptions);
|
|
591
|
+
timeline = await API.alignSegments(synthesizedAudio, segmentTimeline, alignmentOptions, { ...callbacks, logLevel: 'warning' });
|
|
588
592
|
shouldPostprocessSpeed = true;
|
|
589
593
|
shouldPostprocessPitch = true;
|
|
590
594
|
break;
|
|
@@ -616,26 +620,11 @@ async function synthesizeSegment(text, options) {
|
|
|
616
620
|
}
|
|
617
621
|
const ssmlRate = convertSpeedScaleToSSMLValueString(speed);
|
|
618
622
|
logger.end();
|
|
619
|
-
const { rawAudio, timeline: edgeTimeline } = await runOperationWithRetries(() => MicrosoftEdgeTTS.synthesize(text, trustedClientToken, voice, ssmlPitch, ssmlRate),
|
|
623
|
+
const { rawAudio, timeline: edgeTimeline } = await runOperationWithRetries(() => MicrosoftEdgeTTS.synthesize(text, trustedClientToken, voice, ssmlPitch, ssmlRate, undefined, callbacks), 'Microsoft Edge TTS', callbacks);
|
|
620
624
|
synthesizedAudio = rawAudio;
|
|
621
625
|
timeline = edgeTimeline;
|
|
622
626
|
break;
|
|
623
627
|
}
|
|
624
|
-
case 'streamlabs-polly': {
|
|
625
|
-
if (inputIsSSML) {
|
|
626
|
-
throw new Error(`The Streamlabs Polly Engine engine doesn't support SSML inputs`);
|
|
627
|
-
}
|
|
628
|
-
const StreamlabsPollyTTS = await import('../synthesis/StreamlabsPollyTTS.js');
|
|
629
|
-
logger.end();
|
|
630
|
-
const { rawAudio, timeline: segmentTimeline } = await StreamlabsPollyTTS.synthesizeLongText(text, voice, language, options.sentenceEndPause, options.segmentEndPause);
|
|
631
|
-
synthesizedAudio = rawAudio;
|
|
632
|
-
logger.start(`Generate word-level timestamps by individually aligning fragments`);
|
|
633
|
-
const alignmentOptions = extendDeep(options.alignment, { language });
|
|
634
|
-
timeline = await API.alignSegments(synthesizedAudio, segmentTimeline, alignmentOptions);
|
|
635
|
-
shouldPostprocessSpeed = true;
|
|
636
|
-
shouldPostprocessPitch = true;
|
|
637
|
-
break;
|
|
638
|
-
}
|
|
639
628
|
default: {
|
|
640
629
|
throw new Error(`Engine '${options.engine}' is not supported`);
|
|
641
630
|
}
|
|
@@ -669,7 +658,7 @@ async function synthesizeSegment(text, options) {
|
|
|
669
658
|
if (alignmentOptions.dtw.windowDuration == null) {
|
|
670
659
|
alignmentOptions.dtw.windowDuration = Math.max(5, Math.ceil(0.2 * getRawAudioDuration(synthesizedAudio)));
|
|
671
660
|
}
|
|
672
|
-
const { wordTimeline } = await API.align(synthesizedAudio, plainText, alignmentOptions);
|
|
661
|
+
const { wordTimeline } = await API.align(synthesizedAudio, plainText, alignmentOptions, { abortSignal: callbacks.abortSignal, logLevel: 'warning' });
|
|
673
662
|
timeline = wordTimeline;
|
|
674
663
|
logger.end();
|
|
675
664
|
}
|
|
@@ -697,7 +686,7 @@ async function synthesizeSegment(text, options) {
|
|
|
697
686
|
synthesizedAudio = await rubberband.stretchTimePitch(synthesizedAudio, timeStretchFactor, pitchShiftFactor, rubberbandOptions);
|
|
698
687
|
}
|
|
699
688
|
else {
|
|
700
|
-
throw new Error(`'${timePitchShiftingMethod}' is not a valid time and pitch shifting method
|
|
689
|
+
throw new Error(`'${timePitchShiftingMethod}' is not a valid time and pitch shifting method.`);
|
|
701
690
|
}
|
|
702
691
|
if (timeStretchFactor != 1.0 && timeline) {
|
|
703
692
|
timeline = multiplyTimelineByFactor(timeline, 1 / timeStretchFactor);
|
|
@@ -707,7 +696,7 @@ async function synthesizeSegment(text, options) {
|
|
|
707
696
|
timeline = timeline.filter(entry => isWordOrSymbolWord(entry.text));
|
|
708
697
|
}
|
|
709
698
|
logger.end();
|
|
710
|
-
logger.logDuration('Part synthesis time', startTimestamp, chalk.magentaBright);
|
|
699
|
+
logger.logDuration('Part synthesis time', startTimestamp, 'info', chalk.magentaBright);
|
|
711
700
|
return { synthesizedAudio, timeline };
|
|
712
701
|
}
|
|
713
702
|
function convertSpeedScaleToSSMLValueString(rate) {
|
|
@@ -840,14 +829,14 @@ export const defaultSynthesisOptions = {
|
|
|
840
829
|
trustedClientToken: undefined,
|
|
841
830
|
pitchDeltaHz: undefined
|
|
842
831
|
},
|
|
843
|
-
streamlabsPolly: {},
|
|
844
832
|
};
|
|
845
833
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
846
834
|
// Voice list request
|
|
847
835
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
848
|
-
export async function requestVoiceList(options) {
|
|
836
|
+
export async function requestVoiceList(options, callbacks) {
|
|
849
837
|
options = extendDeep(defaultVoiceListRequestOptions, options);
|
|
850
|
-
|
|
838
|
+
callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks };
|
|
839
|
+
const logger = new Logger(callbacks.logLevel);
|
|
851
840
|
const cacheOptions = options.cache;
|
|
852
841
|
let cacheDir = cacheOptions?.path;
|
|
853
842
|
if (!cacheDir) {
|
|
@@ -861,7 +850,7 @@ export async function requestVoiceList(options) {
|
|
|
861
850
|
switch (options.engine) {
|
|
862
851
|
case 'espeak': {
|
|
863
852
|
const EspeakTTS = await import('../synthesis/EspeakTTS.js');
|
|
864
|
-
const voices = await EspeakTTS.listVoices();
|
|
853
|
+
const voices = await EspeakTTS.listVoices(callbacks);
|
|
865
854
|
voiceList = voices.map(voice => {
|
|
866
855
|
const languages = voice.languages.map(lang => normalizeLanguageCode(lang.name));
|
|
867
856
|
for (const language of languages) {
|
|
@@ -939,7 +928,7 @@ export async function requestVoiceList(options) {
|
|
|
939
928
|
if (!apiKey) {
|
|
940
929
|
throw new Error(`No Google Cloud API key provided`);
|
|
941
930
|
}
|
|
942
|
-
const voices = await GoogleCloudTTS.getVoiceList(apiKey);
|
|
931
|
+
const voices = await GoogleCloudTTS.getVoiceList(apiKey, callbacks);
|
|
943
932
|
voiceList = voices.map(voice => ({
|
|
944
933
|
name: voice.name,
|
|
945
934
|
languages: [normalizeLanguageCode(voice.languageCodes[0]), getShortLanguageCode(voice.languageCodes[0])],
|
|
@@ -981,7 +970,7 @@ export async function requestVoiceList(options) {
|
|
|
981
970
|
if (!secretAccessKey) {
|
|
982
971
|
throw new Error(`No Amazon Polly secret access key provided`);
|
|
983
972
|
}
|
|
984
|
-
const voices = await AwsPollyTTS.getVoiceList(region, accessKeyId, secretAccessKey);
|
|
973
|
+
const voices = await AwsPollyTTS.getVoiceList(region, accessKeyId, secretAccessKey, callbacks);
|
|
985
974
|
for (const voice of voices) {
|
|
986
975
|
const languageCode = normalizeLanguageCode(voice.LanguageCode);
|
|
987
976
|
const languageCodes = [languageCode, getShortLanguageCode(languageCode)];
|
|
@@ -1010,7 +999,7 @@ export async function requestVoiceList(options) {
|
|
|
1010
999
|
if (!apiKey) {
|
|
1011
1000
|
throw new Error(`No ElevenLabs API key provided`);
|
|
1012
1001
|
}
|
|
1013
|
-
voiceList = await ElevenLabsTTS.getVoiceList(apiKey);
|
|
1002
|
+
voiceList = await ElevenLabsTTS.getVoiceList(apiKey, callbacks);
|
|
1014
1003
|
break;
|
|
1015
1004
|
}
|
|
1016
1005
|
case 'deepgram': {
|
|
@@ -1036,7 +1025,7 @@ export async function requestVoiceList(options) {
|
|
|
1036
1025
|
if (!trustedClientToken) {
|
|
1037
1026
|
throw new Error('No Microsoft Edge trusted client token provided');
|
|
1038
1027
|
}
|
|
1039
|
-
const voices = await runOperationWithRetries(() => MicrosoftEdgeTTS.getVoiceList(trustedClientToken),
|
|
1028
|
+
const voices = await runOperationWithRetries(() => MicrosoftEdgeTTS.getVoiceList(trustedClientToken, callbacks), 'Mircosoft Edge TTS voice list request', callbacks);
|
|
1040
1029
|
voiceList = voices.map((voice) => ({
|
|
1041
1030
|
name: voice.Name,
|
|
1042
1031
|
languages: [normalizeLanguageCode(voice.Locale), getShortLanguageCode(voice.Locale)],
|
|
@@ -1044,14 +1033,9 @@ export async function requestVoiceList(options) {
|
|
|
1044
1033
|
}));
|
|
1045
1034
|
break;
|
|
1046
1035
|
}
|
|
1047
|
-
case 'streamlabs-polly': {
|
|
1048
|
-
const StreamlabsPollyTTS = await import('../synthesis/StreamlabsPollyTTS.js');
|
|
1049
|
-
voiceList = StreamlabsPollyTTS.voiceList;
|
|
1050
|
-
break;
|
|
1051
|
-
}
|
|
1052
1036
|
}
|
|
1053
1037
|
if (cacheFilePath) {
|
|
1054
|
-
await writeFileSafe(cacheFilePath,
|
|
1038
|
+
await writeFileSafe(cacheFilePath, stringifyAndFormatJson(voiceList));
|
|
1055
1039
|
}
|
|
1056
1040
|
return voiceList;
|
|
1057
1041
|
}
|
|
@@ -1194,7 +1178,7 @@ export const synthesisEngines = [
|
|
|
1194
1178
|
{
|
|
1195
1179
|
id: 'coqui-server',
|
|
1196
1180
|
name: 'Coqui TTS',
|
|
1197
|
-
description: 'A
|
|
1181
|
+
description: 'A client for Coqui TTS server.',
|
|
1198
1182
|
type: 'server'
|
|
1199
1183
|
},
|
|
1200
1184
|
{
|
|
@@ -1245,11 +1229,5 @@ export const synthesisEngines = [
|
|
|
1245
1229
|
description: 'Unoffical text-to-speech API used by the Microsoft Edge browser.',
|
|
1246
1230
|
type: 'cloud'
|
|
1247
1231
|
},
|
|
1248
|
-
{
|
|
1249
|
-
id: 'streamlabs-polly',
|
|
1250
|
-
name: 'Streamlabs Polly',
|
|
1251
|
-
description: 'Unoffical text-to-speech API provided by Streamlabs.',
|
|
1252
|
-
type: 'cloud'
|
|
1253
|
-
},
|
|
1254
1232
|
];
|
|
1255
1233
|
//# sourceMappingURL=Synthesis.js.map
|