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
|
@@ -28,7 +28,7 @@ export function subtitlesToTimeline(subtitles: string, removeMarkup = true) {
|
|
|
28
28
|
for (let line of lines) {
|
|
29
29
|
line = line.trim()
|
|
30
30
|
|
|
31
|
-
if (line.length
|
|
31
|
+
if (line.length === 0) {
|
|
32
32
|
isWithinCue = false
|
|
33
33
|
|
|
34
34
|
continue
|
|
@@ -52,7 +52,7 @@ export function subtitlesToTimeline(subtitles: string, removeMarkup = true) {
|
|
|
52
52
|
} else if (isWithinCue && timeline.length > 0) {
|
|
53
53
|
const lastEntry = timeline[timeline.length - 1]
|
|
54
54
|
|
|
55
|
-
if (lastEntry.text
|
|
55
|
+
if (lastEntry.text === '') {
|
|
56
56
|
lastEntry.text = line
|
|
57
57
|
} else {
|
|
58
58
|
lastEntry.text += ' ' + line
|
|
@@ -86,7 +86,7 @@ export function timelineToSubtitles(timeline: Timeline, subtitlesConfig?: Subtit
|
|
|
86
86
|
|
|
87
87
|
let config = subtitlesConfig || {}
|
|
88
88
|
|
|
89
|
-
if (config.format && config.format
|
|
89
|
+
if (config.format && config.format === 'webvtt') {
|
|
90
90
|
config = { ...defaultSubtitlesBaseConfig, ...webVttConfigExtension, ...config }
|
|
91
91
|
} else {
|
|
92
92
|
config = { ...defaultSubtitlesBaseConfig, ...srtConfigExtension, ...config }
|
|
@@ -97,7 +97,7 @@ export function timelineToSubtitles(timeline: Timeline, subtitlesConfig?: Subtit
|
|
|
97
97
|
|
|
98
98
|
let outText = ''
|
|
99
99
|
|
|
100
|
-
if (config.format
|
|
100
|
+
if (config.format === 'webvtt') {
|
|
101
101
|
outText += `WEBVTT${lineBreakString}Kind: captions${lineBreakString}`
|
|
102
102
|
|
|
103
103
|
if (config.language) {
|
|
@@ -110,11 +110,11 @@ export function timelineToSubtitles(timeline: Timeline, subtitlesConfig?: Subtit
|
|
|
110
110
|
// Generate the cues from the given timeline
|
|
111
111
|
let cues: Cue[]
|
|
112
112
|
|
|
113
|
-
if (config.mode
|
|
113
|
+
if (config.mode === 'segment' || config.mode === 'sentence') {
|
|
114
114
|
cues = getCuesFromTimeline_IsolateSegmentSentence(timeline, config)
|
|
115
|
-
} else if (config.mode
|
|
115
|
+
} else if (config.mode === 'word' || config.mode === 'phone' || config.mode === 'word+phone') {
|
|
116
116
|
cues = getCuesFromTimeline_IsolateWordPhone(timeline, config)
|
|
117
|
-
} else if (config.mode
|
|
117
|
+
} else if (config.mode === 'line') {
|
|
118
118
|
cues = getCuesFromTimeline_IsolateLines(timeline, config)
|
|
119
119
|
} else {
|
|
120
120
|
throw new Error('Invalid subtitles mode.')
|
|
@@ -213,7 +213,7 @@ function getCuesFromTimeline_IsolateSegmentSentence(timeline: Timeline, config:
|
|
|
213
213
|
for (const wordEntry of wordTimeline) {
|
|
214
214
|
const wordStartOffset = entryText.indexOf(wordEntry.text, lastWordEndOffset)
|
|
215
215
|
|
|
216
|
-
if (wordStartOffset
|
|
216
|
+
if (wordStartOffset === -1) {
|
|
217
217
|
throw new Error(`Couldn't find word '${wordEntry.text}' in its parent entry text`)
|
|
218
218
|
}
|
|
219
219
|
|
|
@@ -235,13 +235,13 @@ function getCuesFromTimeline_IsolateSegmentSentence(timeline: Timeline, config:
|
|
|
235
235
|
let lineStartOffset = 0
|
|
236
236
|
|
|
237
237
|
for (let wordIndex = 0; wordIndex < wordTimeline.length; wordIndex++) {
|
|
238
|
-
const isLastWord = wordIndex
|
|
238
|
+
const isLastWord = wordIndex === wordTimeline.length - 1
|
|
239
239
|
|
|
240
240
|
const wordEntry = wordTimeline[wordIndex]
|
|
241
241
|
const wordEndOffset = wordEntry.endOffsetUtf16!
|
|
242
242
|
|
|
243
243
|
function getExtendedEndOffset(offset: number | undefined) {
|
|
244
|
-
if (offset
|
|
244
|
+
if (offset === undefined) {
|
|
245
245
|
return entryText.length
|
|
246
246
|
}
|
|
247
247
|
|
|
@@ -300,14 +300,14 @@ function getCuesFromTimeline_IsolateSegmentSentence(timeline: Timeline, config:
|
|
|
300
300
|
currentCue.lines.push(lineText)
|
|
301
301
|
|
|
302
302
|
// Update cue start and end times
|
|
303
|
-
if (currentCue.startTime
|
|
303
|
+
if (currentCue.startTime === -1) {
|
|
304
304
|
currentCue.startTime = lineStartTime
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
currentCue.endTime = lineEndTime
|
|
308
308
|
|
|
309
309
|
// Finalize cue if needed
|
|
310
|
-
if (isLastWord || currentCue.lines.length
|
|
310
|
+
if (isLastWord || currentCue.lines.length === config.maxLineCount) {
|
|
311
311
|
cues.push(currentCue)
|
|
312
312
|
|
|
313
313
|
currentCue = {
|
|
@@ -329,7 +329,7 @@ function getCuesFromTimeline_IsolateSegmentSentence(timeline: Timeline, config:
|
|
|
329
329
|
|
|
330
330
|
// Generates cues from timeline. Isolates words or phones in individual cues.
|
|
331
331
|
function getCuesFromTimeline_IsolateWordPhone(timeline: Timeline, config: SubtitlesConfig) {
|
|
332
|
-
if (timeline.length
|
|
332
|
+
if (timeline.length === 0) {
|
|
333
333
|
return []
|
|
334
334
|
}
|
|
335
335
|
|
|
@@ -338,12 +338,12 @@ function getCuesFromTimeline_IsolateWordPhone(timeline: Timeline, config: Subtit
|
|
|
338
338
|
const cues: Cue[] = []
|
|
339
339
|
|
|
340
340
|
for (const entry of timeline) {
|
|
341
|
-
const entryIsWord = entry.type
|
|
342
|
-
const entryIsPhone = entry.type
|
|
341
|
+
const entryIsWord = entry.type === 'word'
|
|
342
|
+
const entryIsPhone = entry.type === 'phone'
|
|
343
343
|
|
|
344
344
|
const shouldIncludeEntry =
|
|
345
|
-
(entryIsWord && (mode
|
|
346
|
-
(entryIsPhone && (mode
|
|
345
|
+
(entryIsWord && (mode === 'word' || mode === 'word+phone')) ||
|
|
346
|
+
(entryIsPhone && (mode === 'phone' || mode === 'word+phone'))
|
|
347
347
|
|
|
348
348
|
if (shouldIncludeEntry) {
|
|
349
349
|
cues.push({
|
|
@@ -363,7 +363,7 @@ function getCuesFromTimeline_IsolateWordPhone(timeline: Timeline, config: Subtit
|
|
|
363
363
|
|
|
364
364
|
// Generates cues from timeline. Isolates lines in individual cues.
|
|
365
365
|
function getCuesFromTimeline_IsolateLines(timeline: Timeline, config: SubtitlesConfig) {
|
|
366
|
-
if (timeline.length
|
|
366
|
+
if (timeline.length === 0) {
|
|
367
367
|
return []
|
|
368
368
|
}
|
|
369
369
|
|
|
@@ -390,7 +390,7 @@ function getCuesFromTimeline_IsolateLines(timeline: Timeline, config: SubtitlesC
|
|
|
390
390
|
let currentCueWords: Timeline = []
|
|
391
391
|
|
|
392
392
|
function addCueFromCurrentWords() {
|
|
393
|
-
if (currentCueWords.length
|
|
393
|
+
if (currentCueWords.length === 0) {
|
|
394
394
|
return
|
|
395
395
|
}
|
|
396
396
|
|
|
@@ -411,7 +411,7 @@ function getCuesFromTimeline_IsolateLines(timeline: Timeline, config: SubtitlesC
|
|
|
411
411
|
|
|
412
412
|
function addCuesFrom(timeline: Timeline) {
|
|
413
413
|
for (const entry of timeline) {
|
|
414
|
-
if (entry.type
|
|
414
|
+
if (entry.type === 'word') {
|
|
415
415
|
const currentWordLineNumber = charOffsetToLineNumber[entry.startOffsetUtf16!]
|
|
416
416
|
const previousWordEntry = currentCueWords[currentCueWords.length - 1]
|
|
417
417
|
|
|
@@ -481,7 +481,7 @@ export function tryParseTimeRangePatternWithoutHours(line: string) {
|
|
|
481
481
|
}
|
|
482
482
|
|
|
483
483
|
function cueObjectToText(cue: Cue, cueIndex: number, config: SubtitlesConfig) {
|
|
484
|
-
if (!cue || !cue.lines || cue.lines.length
|
|
484
|
+
if (!cue || !cue.lines || cue.lines.length === 0) {
|
|
485
485
|
throw new Error(`Cue is empty`)
|
|
486
486
|
}
|
|
487
487
|
|
|
@@ -496,7 +496,7 @@ function cueObjectToText(cue: Cue, cueIndex: number, config: SubtitlesConfig) {
|
|
|
496
496
|
let formattedStartTime: string
|
|
497
497
|
let formattedEndTime: string
|
|
498
498
|
|
|
499
|
-
if (config.includeHours
|
|
499
|
+
if (config.includeHours === true) {
|
|
500
500
|
formattedStartTime = formatHMS(secondsToHMS(cue.startTime), config.decimalSeparator)
|
|
501
501
|
formattedEndTime = formatHMS(secondsToHMS(cue.endTime), config.decimalSeparator)
|
|
502
502
|
} else {
|
|
@@ -4,9 +4,11 @@ import * as FFMpegTranscoder from '../codecs/FFMpegTranscoder.js'
|
|
|
4
4
|
import { Logger } from '../utilities/Logger.js'
|
|
5
5
|
|
|
6
6
|
import { readBinaryIncomingMessage } from '../utilities/Utilities.js'
|
|
7
|
+
import { SynthesisCallbacks, VoiceListRequestCallbacks } from '../api/API.js'
|
|
8
|
+
|
|
9
|
+
export async function synthesize(text: string, language: string | undefined, voice: string, region: string, accessKeyId: string, secretAccessKey: string, engine: 'standard' | 'neural' = 'standard', ssmlEnabled = false, lexiconNames: string[] | undefined, callbacks: SynthesisCallbacks) {
|
|
10
|
+
const logger = new Logger(callbacks.logLevel)
|
|
7
11
|
|
|
8
|
-
export async function synthesize(text: string, language: string | undefined, voice: string, region: string, accessKeyId: string, secretAccessKey: string, engine: 'standard' | 'neural' = 'standard', ssmlEnabled = false, lexiconNames?: string[]) {
|
|
9
|
-
const logger = new Logger()
|
|
10
12
|
logger.start('Load AWS SDK client module')
|
|
11
13
|
|
|
12
14
|
const polly = await import('@aws-sdk/client-polly')
|
|
@@ -45,13 +47,18 @@ export async function synthesize(text: string, language: string | undefined, voi
|
|
|
45
47
|
|
|
46
48
|
logger.end()
|
|
47
49
|
|
|
48
|
-
const rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
50
|
+
const rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
51
|
+
audioData as any,
|
|
52
|
+
undefined,
|
|
53
|
+
undefined,
|
|
54
|
+
{ abortSignal: callbacks.abortSignal, logLevel: 'warning' }
|
|
55
|
+
)
|
|
49
56
|
|
|
50
57
|
return { rawAudio }
|
|
51
58
|
}
|
|
52
59
|
|
|
53
|
-
export async function getVoiceList(region: string, accessKeyId: string, secretAccessKey: string) {
|
|
54
|
-
const logger = new Logger()
|
|
60
|
+
export async function getVoiceList(region: string, accessKeyId: string, secretAccessKey: string, callbacks: VoiceListRequestCallbacks) {
|
|
61
|
+
const logger = new Logger(callbacks.logLevel)
|
|
55
62
|
logger.start('Load AWS SDK client module')
|
|
56
63
|
|
|
57
64
|
const polly = await import('@aws-sdk/client-polly')
|
|
@@ -7,6 +7,7 @@ import { Timeline } from '../utilities/Timeline.js'
|
|
|
7
7
|
import { RawAudio, getRawAudioDuration } from '../audio/AudioUtilities.js'
|
|
8
8
|
import { concatUint8Arrays } from '../utilities/Utilities.js'
|
|
9
9
|
import { escapeHtml } from '../encodings/HtmlEscape.js'
|
|
10
|
+
import { SynthesisCallbacks } from '../api/Synthesis.js'
|
|
10
11
|
|
|
11
12
|
export async function synthesize(
|
|
12
13
|
text: string,
|
|
@@ -16,10 +17,12 @@ export async function synthesize(
|
|
|
16
17
|
voice = 'Microsoft Server Speech Text to Speech Voice (en-US, AvaNeural)',
|
|
17
18
|
ssmlEnabled = false,
|
|
18
19
|
ssmlPitchString = '+0Hz',
|
|
19
|
-
ssmlRateString = '+0%'
|
|
20
|
+
ssmlRateString = '+0%',
|
|
21
|
+
callbacks: SynthesisCallbacks) {
|
|
20
22
|
|
|
21
23
|
return new Promise<{ rawAudio: RawAudio, timeline: Timeline }>((resolve, reject) => {
|
|
22
|
-
const logger = new Logger()
|
|
24
|
+
const logger = new Logger(callbacks.logLevel)
|
|
25
|
+
|
|
23
26
|
logger.start('Request synthesis from Azure Cognitive Services')
|
|
24
27
|
|
|
25
28
|
const speechConfig = SpeechSDK.SpeechConfig.fromSubscription(subscriptionKey, serviceRegion)
|
|
@@ -71,7 +74,12 @@ export async function synthesize(
|
|
|
71
74
|
|
|
72
75
|
logger.end()
|
|
73
76
|
|
|
74
|
-
const rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
77
|
+
const rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
78
|
+
encodedAudio,
|
|
79
|
+
24000,
|
|
80
|
+
1,
|
|
81
|
+
{ abortSignal: callbacks.abortSignal, logLevel: 'warning' }
|
|
82
|
+
)
|
|
75
83
|
|
|
76
84
|
logger.start('Convert boundary events to a timeline')
|
|
77
85
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SynthesisCallbacks } from '../api/API.js'
|
|
2
2
|
import { decodeWaveToRawAudio } from '../audio/AudioUtilities.js'
|
|
3
|
+
import { requestHttp } from 'easier-http-request'
|
|
3
4
|
import { Logger } from '../utilities/Logger.js'
|
|
4
5
|
import { logToStderr } from '../utilities/Utilities.js'
|
|
5
|
-
const log = logToStderr
|
|
6
6
|
|
|
7
|
-
export async function synthesize(text: string, speakerId: string | null, serverURL = 'http://[::1]:5002') {
|
|
8
|
-
const logger = new Logger()
|
|
7
|
+
export async function synthesize(text: string, speakerId: string | null, serverURL = 'http://[::1]:5002', callbacks: SynthesisCallbacks) {
|
|
8
|
+
const logger = new Logger(callbacks.logLevel)
|
|
9
9
|
logger.start('Request synthesis from Coqui Server')
|
|
10
10
|
|
|
11
|
-
const response = await
|
|
11
|
+
const response = await requestHttp({
|
|
12
12
|
url: `${serverURL}/api/tts`,
|
|
13
13
|
|
|
14
14
|
params: {
|
|
@@ -16,10 +16,11 @@ export async function synthesize(text: string, speakerId: string | null, serverU
|
|
|
16
16
|
'speaker_id': speakerId
|
|
17
17
|
},
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
abortSignal: callbacks?.abortSignal
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const responseBody = await response.arrayBuffer()
|
|
23
|
+
const waveData = new Uint8Array(responseBody)
|
|
23
24
|
|
|
24
25
|
const { rawAudio } = decodeWaveToRawAudio(waveData)
|
|
25
26
|
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SynthesisVoice } from '../api/API.js'
|
|
1
|
+
import { SynthesisCallbacks, SynthesisVoice } from '../api/API.js'
|
|
3
2
|
import * as FFMpegTranscoder from '../codecs/FFMpegTranscoder.js'
|
|
4
3
|
import { Logger } from '../utilities/Logger.js'
|
|
5
4
|
import { logToStderr } from '../utilities/Utilities.js'
|
|
6
5
|
import { extendDeep } from '../utilities/ObjectUtilities.js'
|
|
6
|
+
import { EasierHttpRequestError, requestHttp } from 'easier-http-request'
|
|
7
7
|
|
|
8
8
|
const log = logToStderr
|
|
9
9
|
|
|
10
|
-
export async function synthesize(text: string, modelId: string, options: DeepgramTTSOptions) {
|
|
11
|
-
const logger = new Logger()
|
|
10
|
+
export async function synthesize(text: string, modelId: string, options: DeepgramTTSOptions, callbacks: SynthesisCallbacks) {
|
|
11
|
+
const logger = new Logger(callbacks.logLevel)
|
|
12
|
+
|
|
12
13
|
logger.start('Request synthesis from Deepgram')
|
|
13
14
|
|
|
14
15
|
options = extendDeep(defaultDeepgramTTSOptions, options)
|
|
15
16
|
|
|
16
|
-
let
|
|
17
|
+
let responseBody: ArrayBuffer
|
|
17
18
|
|
|
18
19
|
try {
|
|
19
|
-
response = await
|
|
20
|
+
const response = await requestHttp({
|
|
20
21
|
url: `https://api.deepgram.com/v1/speak`,
|
|
21
22
|
|
|
22
23
|
params: {
|
|
@@ -32,21 +33,21 @@ export async function synthesize(text: string, modelId: string, options: Deepgra
|
|
|
32
33
|
'Authorization': `Token ${options.apiKey}`,
|
|
33
34
|
},
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
body: {
|
|
36
37
|
text,
|
|
37
38
|
},
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
abortSignal: callbacks?.abortSignal,
|
|
40
41
|
})
|
|
41
|
-
} catch (e: any) {
|
|
42
|
-
const response = e.response
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
responseBody = await response.arrayBuffer()
|
|
44
|
+
} catch (e: any) {
|
|
45
|
+
if (e instanceof EasierHttpRequestError) {
|
|
46
|
+
logger.log(`Request failed with status code ${e.statusCode}: ${e.statusText}.`)
|
|
46
47
|
|
|
47
|
-
if (
|
|
48
|
+
if (e.errorBody) {
|
|
48
49
|
logger.log(`Server responded with:`)
|
|
49
|
-
logger.log(
|
|
50
|
+
logger.log(e.errorBody)
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -54,7 +55,12 @@ export async function synthesize(text: string, modelId: string, options: Deepgra
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
logger.start('Decode synthesized audio')
|
|
57
|
-
const rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
58
|
+
const rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
59
|
+
new Uint8Array(responseBody),
|
|
60
|
+
undefined,
|
|
61
|
+
undefined,
|
|
62
|
+
{ abortSignal: callbacks.abortSignal, logLevel: 'warning' }
|
|
63
|
+
)
|
|
58
64
|
|
|
59
65
|
logger.end()
|
|
60
66
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SynthesisVoice, VoiceGender } from '../api/API.js'
|
|
1
|
+
import { VoiceListRequestCallbacks, SynthesisCallbacks, SynthesisVoice, VoiceGender } from '../api/API.js'
|
|
3
2
|
import * as FFMpegTranscoder from '../codecs/FFMpegTranscoder.js'
|
|
4
3
|
import { Logger } from '../utilities/Logger.js'
|
|
5
4
|
import { logToStderr } from '../utilities/Utilities.js'
|
|
@@ -7,19 +6,21 @@ import { extendDeep } from '../utilities/ObjectUtilities.js'
|
|
|
7
6
|
import { decodeBase64 } from '../encodings/Base64.js'
|
|
8
7
|
import { splitToWords } from '../nlp/Segmentation.js'
|
|
9
8
|
import { Timeline } from '../utilities/Timeline.js'
|
|
9
|
+
import { EasierHttpRequestError, requestHttp } from 'easier-http-request'
|
|
10
10
|
|
|
11
11
|
const log = logToStderr
|
|
12
12
|
|
|
13
|
-
export async function synthesize(text: string, voiceId: string, language: string, options: ElevenLabsTTSOptions) {
|
|
14
|
-
const logger = new Logger()
|
|
13
|
+
export async function synthesize(text: string, voiceId: string, language: string, options: ElevenLabsTTSOptions, callbacks: SynthesisCallbacks) {
|
|
14
|
+
const logger = new Logger(callbacks.logLevel)
|
|
15
|
+
|
|
15
16
|
logger.start('Request synthesis from ElevenLabs')
|
|
16
17
|
|
|
17
18
|
options = extendDeep(defaultElevenLabsTTSOptions, options)
|
|
18
19
|
|
|
19
|
-
let
|
|
20
|
+
let responseObject: any
|
|
20
21
|
|
|
21
22
|
try {
|
|
22
|
-
response = await
|
|
23
|
+
const response = await requestHttp({
|
|
23
24
|
url: `https://api.elevenlabs.io/v1/text-to-speech/${voiceId}/with-timestamps`,
|
|
24
25
|
|
|
25
26
|
method: 'POST',
|
|
@@ -33,7 +34,7 @@ export async function synthesize(text: string, voiceId: string, language: string
|
|
|
33
34
|
output_format: 'mp3_44100_64',
|
|
34
35
|
},
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
body: {
|
|
37
38
|
text,
|
|
38
39
|
|
|
39
40
|
model_id: options.modelId,
|
|
@@ -48,17 +49,17 @@ export async function synthesize(text: string, voiceId: string, language: string
|
|
|
48
49
|
seed: options.seed
|
|
49
50
|
},
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
abortSignal: callbacks?.abortSignal,
|
|
52
53
|
})
|
|
53
|
-
} catch (e: any) {
|
|
54
|
-
const response = e.response
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
responseObject = await response.json()
|
|
56
|
+
} catch (e: any) {
|
|
57
|
+
if (e instanceof EasierHttpRequestError) {
|
|
58
|
+
logger.log(`Request failed with status code ${e.statusCode}: ${e.statusText}.`)
|
|
58
59
|
|
|
59
|
-
if (
|
|
60
|
+
if (e.errorBody) {
|
|
60
61
|
logger.log(`Server responded with:`)
|
|
61
|
-
logger.log(
|
|
62
|
+
logger.log(e.errorBody)
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
|
|
@@ -66,14 +67,21 @@ export async function synthesize(text: string, voiceId: string, language: string
|
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
logger.start('Decode synthesized audio')
|
|
69
|
-
|
|
70
|
-
const
|
|
70
|
+
|
|
71
|
+
const audioData = decodeBase64(responseObject.audio_base64)
|
|
72
|
+
|
|
73
|
+
const rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
74
|
+
audioData,
|
|
75
|
+
undefined,
|
|
76
|
+
undefined,
|
|
77
|
+
{ abortSignal: callbacks.abortSignal, logLevel: 'warning' }
|
|
78
|
+
)
|
|
71
79
|
|
|
72
80
|
let timeline: Timeline | undefined
|
|
73
81
|
|
|
74
|
-
const characters: string[] =
|
|
75
|
-
const characterStartTimes: number[] =
|
|
76
|
-
const characterEndTimes: number[] =
|
|
82
|
+
const characters: string[] = responseObject.alignment?.characters
|
|
83
|
+
const characterStartTimes: number[] = responseObject.alignment?.character_start_times_seconds
|
|
84
|
+
const characterEndTimes: number[] = responseObject.alignment?.character_end_times_seconds
|
|
77
85
|
|
|
78
86
|
if (characters && characterStartTimes && characterEndTimes) {
|
|
79
87
|
logger.start('Create timeline from returned character timings')
|
|
@@ -106,8 +114,8 @@ export async function synthesize(text: string, voiceId: string, language: string
|
|
|
106
114
|
return { rawAudio, timeline }
|
|
107
115
|
}
|
|
108
116
|
|
|
109
|
-
export async function getVoiceList(apiKey: string) {
|
|
110
|
-
const response = await
|
|
117
|
+
export async function getVoiceList(apiKey: string, callbacks: VoiceListRequestCallbacks) {
|
|
118
|
+
const response = await requestHttp({
|
|
111
119
|
method: 'GET',
|
|
112
120
|
|
|
113
121
|
url: 'https://api.elevenlabs.io/v1/voices',
|
|
@@ -117,10 +125,12 @@ export async function getVoiceList(apiKey: string) {
|
|
|
117
125
|
'xi-api-key': apiKey
|
|
118
126
|
},
|
|
119
127
|
|
|
120
|
-
|
|
128
|
+
abortSignal: callbacks?.abortSignal
|
|
121
129
|
})
|
|
122
130
|
|
|
123
|
-
const
|
|
131
|
+
const responseObject = await response.json()
|
|
132
|
+
|
|
133
|
+
const elevenLabsVoices: any[] = responseObject.voices
|
|
124
134
|
|
|
125
135
|
const voices: SynthesisVoice[] = elevenLabsVoices.map(elevenLabsVoice => {
|
|
126
136
|
const gender: VoiceGender = elevenLabsVoice?.labels?.gender ?? 'unknown'
|