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
|
@@ -1,39 +1,41 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
import * as API from './API.js'
|
|
3
|
+
|
|
1
4
|
import { deepClone, extendDeep } from '../utilities/ObjectUtilities.js'
|
|
2
5
|
|
|
3
6
|
import { AudioSourceParam, RawAudio, ensureRawAudio, getRawAudioDuration, normalizeAudioLevelInPlace, sliceRawAudioByTime, trimAudioEnd } from '../audio/AudioUtilities.js'
|
|
4
7
|
import { Logger } from '../utilities/Logger.js'
|
|
5
8
|
|
|
6
|
-
import * as API from './API.js'
|
|
7
|
-
import { logToStderr } from '../utilities/Utilities.js'
|
|
8
9
|
import { type WhisperLanguageDetectionOptions } from '../recognition/WhisperSTT.js'
|
|
9
10
|
import { formatLanguageCodeWithName, languageCodeToName } from '../utilities/Locale.js'
|
|
10
11
|
import { loadPackage } from '../utilities/PackageManager.js'
|
|
11
|
-
import
|
|
12
|
-
import { type WhisperCppOptions } from '../recognition/WhisperCppSTT.js'
|
|
12
|
+
import { type WhisperCppCliOptions } from '../recognition/WhisperCppCliSTT.js'
|
|
13
13
|
import { type SileroLanguageDetectionOptions } from '../speech-language-detection/SileroLanguageDetection.js'
|
|
14
14
|
import { OnnxExecutionProvider } from '../utilities/OnnxUtilities.js'
|
|
15
15
|
import { LanguageDetectionResults } from './LanguageDetectionCommon.js'
|
|
16
16
|
import { joinPath } from '../utilities/PathUtilities.js'
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
export async function detectSpeechLanguage(input: AudioSourceParam, options: SpeechLanguageDetectionOptions, callbacks?: SpeechLanguageDetectionCallbacks): Promise<SpeechLanguageDetectionResult> {
|
|
19
|
+
options = extendDeep(defaultSpeechLanguageDetectionOptions, options)
|
|
20
|
+
callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks }
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
const logger = new Logger()
|
|
22
|
+
const logger = new Logger(callbacks.logLevel)
|
|
22
23
|
|
|
23
24
|
const startTime = logger.getTimestamp()
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const inputRawAudio = await ensureRawAudio(input)
|
|
26
|
+
const inputRawAudio = await ensureRawAudio(input, undefined, undefined, callbacks)
|
|
28
27
|
|
|
29
28
|
logger.start(`Resample audio to 16kHz mono`)
|
|
30
|
-
let sourceRawAudio = await ensureRawAudio(inputRawAudio, 16000, 1)
|
|
29
|
+
let sourceRawAudio = await ensureRawAudio(inputRawAudio, 16000, 1, callbacks)
|
|
31
30
|
normalizeAudioLevelInPlace(sourceRawAudio)
|
|
32
31
|
sourceRawAudio.audioChannels[0] = trimAudioEnd(sourceRawAudio.audioChannels[0])
|
|
33
32
|
|
|
34
33
|
if (options.crop) {
|
|
35
34
|
logger.start('Crop using voice activity detection');
|
|
36
|
-
({ croppedRawAudio: sourceRawAudio } = await API.detectVoiceActivity(
|
|
35
|
+
({ croppedRawAudio: sourceRawAudio } = await API.detectVoiceActivity(
|
|
36
|
+
sourceRawAudio,
|
|
37
|
+
options.vad!,
|
|
38
|
+
{ ...callbacks, logLevel: 'warning' }))
|
|
37
39
|
|
|
38
40
|
logger.end()
|
|
39
41
|
}
|
|
@@ -53,7 +55,7 @@ export async function detectSpeechLanguage(input: AudioSourceParam, options: Spe
|
|
|
53
55
|
|
|
54
56
|
const sileroOptions = options.silero!
|
|
55
57
|
|
|
56
|
-
const modelDir = await loadPackage('silero-lang-classifier-95')
|
|
58
|
+
const modelDir = await loadPackage('silero-lang-classifier-95', callbacks)
|
|
57
59
|
|
|
58
60
|
const modelPath = joinPath(modelDir, 'lang_classifier_95.onnx')
|
|
59
61
|
const languageDictionaryPath = joinPath(modelDir, 'lang_dict_95.json')
|
|
@@ -65,7 +67,9 @@ export async function detectSpeechLanguage(input: AudioSourceParam, options: Spe
|
|
|
65
67
|
modelPath,
|
|
66
68
|
languageDictionaryPath,
|
|
67
69
|
languageGroupDictionaryPath,
|
|
68
|
-
onnxExecutionProviders
|
|
70
|
+
onnxExecutionProviders,
|
|
71
|
+
callbacks,
|
|
72
|
+
)
|
|
69
73
|
|
|
70
74
|
detectedLanguageProbabilities = languageResults
|
|
71
75
|
|
|
@@ -74,34 +78,57 @@ export async function detectSpeechLanguage(input: AudioSourceParam, options: Spe
|
|
|
74
78
|
|
|
75
79
|
case 'whisper': {
|
|
76
80
|
const WhisperSTT = await import('../recognition/WhisperSTT.js')
|
|
81
|
+
const WhisperCommon = await import('../recognition/WhisperCommon.js')
|
|
82
|
+
|
|
83
|
+
const whisperOptions = extendDeep(WhisperSTT.defaultWhisperLanguageDetectionOptions, options.whisper!)
|
|
77
84
|
|
|
78
|
-
const
|
|
85
|
+
const { modelId, modelPath } = await WhisperCommon.loadModelPackage(
|
|
86
|
+
whisperOptions.model,
|
|
87
|
+
undefined,
|
|
88
|
+
callbacks,
|
|
89
|
+
)
|
|
79
90
|
|
|
80
|
-
const {
|
|
91
|
+
const { libPath } = await WhisperSTT.loadLibraryPackages(
|
|
92
|
+
whisperOptions.enableGPU,
|
|
93
|
+
callbacks,
|
|
94
|
+
)
|
|
81
95
|
|
|
82
96
|
logger.end()
|
|
83
97
|
|
|
84
98
|
detectedLanguageProbabilities = await WhisperSTT.detectLanguage(
|
|
85
99
|
sourceRawAudio,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
100
|
+
modelId,
|
|
101
|
+
modelPath,
|
|
102
|
+
libPath,
|
|
103
|
+
whisperOptions,
|
|
104
|
+
callbacks,
|
|
105
|
+
)
|
|
89
106
|
|
|
90
107
|
break
|
|
91
108
|
}
|
|
92
109
|
|
|
93
110
|
case 'whisper.cpp': {
|
|
94
|
-
const
|
|
111
|
+
const WhisperCppCliSTT = await import('../recognition/WhisperCppCliSTT.js')
|
|
112
|
+
const WhisperCommon = await import('../recognition/WhisperCommon.js')
|
|
95
113
|
|
|
96
|
-
const
|
|
114
|
+
const whisperCppCliOptions = options.whisperCpp!
|
|
97
115
|
|
|
98
116
|
logger.end()
|
|
99
117
|
|
|
100
|
-
const {
|
|
118
|
+
const { modelId, modelPath } = await WhisperCommon.loadModelPackage(
|
|
119
|
+
whisperCppCliOptions.model,
|
|
120
|
+
undefined,
|
|
121
|
+
callbacks,
|
|
122
|
+
)
|
|
101
123
|
|
|
102
124
|
logger.end();
|
|
103
125
|
|
|
104
|
-
detectedLanguageProbabilities = await
|
|
126
|
+
detectedLanguageProbabilities = await WhisperCppCliSTT.detectLanguage(
|
|
127
|
+
sourceRawAudio,
|
|
128
|
+
modelId,
|
|
129
|
+
modelPath,
|
|
130
|
+
callbacks,
|
|
131
|
+
)
|
|
105
132
|
|
|
106
133
|
break
|
|
107
134
|
}
|
|
@@ -122,7 +149,7 @@ export async function detectSpeechLanguage(input: AudioSourceParam, options: Spe
|
|
|
122
149
|
}
|
|
123
150
|
|
|
124
151
|
logger.end()
|
|
125
|
-
logger.logDuration('\nTotal language detection time', startTime, chalk.magentaBright)
|
|
152
|
+
logger.logDuration('\nTotal language detection time', startTime, 'info', chalk.magentaBright)
|
|
126
153
|
|
|
127
154
|
return {
|
|
128
155
|
detectedLanguage,
|
|
@@ -140,8 +167,9 @@ export interface SpeechLanguageDetectionResult {
|
|
|
140
167
|
inputRawAudio: RawAudio
|
|
141
168
|
}
|
|
142
169
|
|
|
143
|
-
export async function detectSpeechLanguageByParts(sourceRawAudio: RawAudio, getResultsForAudioPart: (audioPart: RawAudio) => Promise<LanguageDetectionResults>,
|
|
144
|
-
|
|
170
|
+
export async function detectSpeechLanguageByParts(sourceRawAudio: RawAudio, getResultsForAudioPart: (audioPart: RawAudio) => Promise<LanguageDetectionResults>, maxAudioPartDuration = 30, hopDuration = 25, callbacks?: SpeechLanguageDetectionCallbacks) {
|
|
171
|
+
callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks }
|
|
172
|
+
const logger = new Logger(callbacks.logLevel)
|
|
145
173
|
|
|
146
174
|
const audioDuration = getRawAudioDuration(sourceRawAudio)
|
|
147
175
|
|
|
@@ -152,12 +180,14 @@ export async function detectSpeechLanguageByParts(sourceRawAudio: RawAudio, getR
|
|
|
152
180
|
const resultsForParts: LanguageDetectionResults[] = []
|
|
153
181
|
|
|
154
182
|
for (let audioTimeOffset = 0; audioTimeOffset < audioDuration; audioTimeOffset += hopDuration) {
|
|
155
|
-
|
|
156
|
-
const endOffset = Math.min(audioTimeOffset + audioPartDuration, audioDuration)
|
|
157
|
-
const audioPartLength = endOffset - startOffset
|
|
183
|
+
callbacks?.abortSignal?.throwIfAborted()
|
|
158
184
|
|
|
159
|
-
|
|
160
|
-
const
|
|
185
|
+
const startTimeOffset = audioTimeOffset
|
|
186
|
+
const endTimeOffset = Math.min(audioTimeOffset + maxAudioPartDuration, audioDuration)
|
|
187
|
+
const audioPartDuration = endTimeOffset - startTimeOffset
|
|
188
|
+
|
|
189
|
+
logger.logTitledMessage(`\nDetect speech language starting at audio offset`, `${startTimeOffset.toFixed(1)}`, 'info', chalk.magentaBright)
|
|
190
|
+
const audioPart = sliceRawAudioByTime(sourceRawAudio, startTimeOffset, endTimeOffset)
|
|
161
191
|
|
|
162
192
|
const resultsForPart = await getResultsForAudioPart(audioPart)
|
|
163
193
|
|
|
@@ -173,7 +203,11 @@ export async function detectSpeechLanguageByParts(sourceRawAudio: RawAudio, getR
|
|
|
173
203
|
|
|
174
204
|
logger.logTitledMessage(`Top candidates`, topCandidatesStrings.join(', '))
|
|
175
205
|
|
|
176
|
-
if (
|
|
206
|
+
if (callbacks?.onPart) {
|
|
207
|
+
callbacks.onPart(sortedResultsForPart, startTimeOffset, endTimeOffset)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (audioPartDuration < maxAudioPartDuration) {
|
|
177
211
|
break
|
|
178
212
|
}
|
|
179
213
|
}
|
|
@@ -196,7 +230,7 @@ export async function detectSpeechLanguageByParts(sourceRawAudio: RawAudio, getR
|
|
|
196
230
|
|
|
197
231
|
export type SpeechLanguageDetectionEngine = 'silero' | 'whisper' | 'whisper.cpp'
|
|
198
232
|
|
|
199
|
-
export interface SpeechLanguageDetectionOptions {
|
|
233
|
+
export interface SpeechLanguageDetectionOptions extends API.OperationOptions {
|
|
200
234
|
engine?: SpeechLanguageDetectionEngine
|
|
201
235
|
defaultLanguage?: string,
|
|
202
236
|
fallbackThresholdProbability?: number
|
|
@@ -207,9 +241,9 @@ export interface SpeechLanguageDetectionOptions {
|
|
|
207
241
|
|
|
208
242
|
whisper?: WhisperLanguageDetectionOptions
|
|
209
243
|
|
|
210
|
-
whisperCpp?:
|
|
244
|
+
whisperCpp?: WhisperCppCliOptions
|
|
211
245
|
|
|
212
|
-
vad?: API.
|
|
246
|
+
vad?: API.VoiceActivityDetectionOptions
|
|
213
247
|
}
|
|
214
248
|
|
|
215
249
|
export const defaultSpeechLanguageDetectionOptions: SpeechLanguageDetectionOptions = {
|
|
@@ -236,6 +270,12 @@ export const defaultSpeechLanguageDetectionOptions: SpeechLanguageDetectionOptio
|
|
|
236
270
|
}
|
|
237
271
|
}
|
|
238
272
|
|
|
273
|
+
export interface SpeechLanguageDetectionCallbacks extends API.OperationCallbacks {
|
|
274
|
+
onPart?: SpeechLanguageDetectionPartCallback
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export type SpeechLanguageDetectionPartCallback = (partResults: LanguageDetectionResults, partStartTime: number, partEndTime: number) => Promise<void>
|
|
278
|
+
|
|
239
279
|
export const speechLanguageDetectionEngines: API.EngineMetadata[] = [
|
|
240
280
|
{
|
|
241
281
|
id: 'silero',
|
|
@@ -251,8 +291,8 @@ export const speechLanguageDetectionEngines: API.EngineMetadata[] = [
|
|
|
251
291
|
},
|
|
252
292
|
{
|
|
253
293
|
id: 'whisper.cpp',
|
|
254
|
-
name: 'OpenAI Whisper (C++ port)',
|
|
255
|
-
description: 'Uses the language tokens produced by
|
|
294
|
+
name: 'OpenAI Whisper (C++ port) CLI',
|
|
295
|
+
description: 'Uses the language tokens produced by whisper.cpp to classify the spoken langauge.',
|
|
256
296
|
type: 'local'
|
|
257
297
|
},
|
|
258
298
|
]
|
package/src/api/SpeechSearch.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { AudioSourceParam } from "../audio/AudioUtilities.js";
|
|
2
|
+
import { OperationCallbacks } from "./Common.js";
|
|
2
3
|
|
|
3
4
|
export async function searchSpeech(inputAudio: AudioSourceParam, text: string, options: SpeechSearchOptions): Promise<SpeechSearchResult> {
|
|
4
5
|
return {}
|
|
5
6
|
}
|
|
6
7
|
|
|
7
|
-
export interface SpeechSearchOptions {
|
|
8
|
+
export interface SpeechSearchOptions extends OperationCallbacks {
|
|
8
9
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export interface SpeechSearchResult {
|
|
12
13
|
}
|
|
14
|
+
|
|
15
|
+
export interface SpeechSearchCallbacks extends OperationCallbacks {
|
|
16
|
+
|
|
17
|
+
}
|
|
@@ -9,54 +9,59 @@ import { AudioSourceParam, RawAudio, ensureRawAudio, normalizeAudioLevelInPlace,
|
|
|
9
9
|
import { Logger } from '../utilities/Logger.js'
|
|
10
10
|
|
|
11
11
|
import { Timeline, addWordTextOffsetsToTimelineInPlace, wordTimelineToSegmentSentenceTimeline } from '../utilities/Timeline.js'
|
|
12
|
-
import { WhisperPartCallback, type
|
|
12
|
+
import { type WhisperOptions, type WhisperPartCallback, type WhisperTokenCallback } from '../recognition/WhisperSTT.js'
|
|
13
13
|
import { formatLanguageCodeWithName, getShortLanguageCode, normalizeIdentifierToLanguageCode, parseLangIdentifier } from '../utilities/Locale.js'
|
|
14
14
|
import { type EngineMetadata } from './Common.js'
|
|
15
15
|
import { type SpeechLanguageDetectionOptions, detectSpeechLanguage } from './API.js'
|
|
16
16
|
import { type SubtitlesConfig } from '../subtitles/Subtitles.js'
|
|
17
17
|
|
|
18
18
|
import { type OpenAICloudSTTOptions } from '../recognition/OpenAICloudSTT.js'
|
|
19
|
-
import { type
|
|
19
|
+
import { type WhisperCppCliOptions } from '../recognition/WhisperCppCliSTT.js'
|
|
20
20
|
|
|
21
21
|
const log = logToStderr
|
|
22
22
|
|
|
23
23
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
24
24
|
// Speech translation
|
|
25
25
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
26
|
-
export async function translateSpeech(input: AudioSourceParam, options: SpeechTranslationOptions,
|
|
27
|
-
|
|
26
|
+
export async function translateSpeech(input: AudioSourceParam, options: SpeechTranslationOptions, callbacks?: SpeechTranslationCallbacks): Promise<SpeechTranslationResult> {
|
|
27
|
+
options = extendDeep(defaultSpeechTranslationOptions, options)
|
|
28
|
+
callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks }
|
|
28
29
|
|
|
29
|
-
const
|
|
30
|
+
const logger = new Logger(callbacks.logLevel)
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
const startTimestamp = logger.getTimestamp()
|
|
32
33
|
|
|
33
|
-
const inputRawAudio = await ensureRawAudio(input)
|
|
34
|
+
const inputRawAudio = await ensureRawAudio(input, undefined, undefined, callbacks)
|
|
34
35
|
|
|
35
36
|
let sourceRawAudio: RawAudio
|
|
36
37
|
let isolatedRawAudio: RawAudio | undefined
|
|
37
38
|
let backgroundRawAudio: RawAudio | undefined
|
|
38
39
|
|
|
39
40
|
if (options.isolate) {
|
|
40
|
-
logger.
|
|
41
|
-
logger.end();
|
|
41
|
+
logger.logTitledMessage(`Isolate vocals`, '');
|
|
42
42
|
|
|
43
|
-
({ isolatedRawAudio, backgroundRawAudio } = await API.isolate(
|
|
43
|
+
({ isolatedRawAudio, backgroundRawAudio } = await API.isolate(
|
|
44
|
+
inputRawAudio,
|
|
45
|
+
options.sourceSeparation!,
|
|
46
|
+
{ ...callbacks, logLevel: logger.logLevel }))
|
|
44
47
|
|
|
45
48
|
logger.end()
|
|
46
|
-
logger.log(``)
|
|
47
49
|
|
|
48
50
|
logger.start(`Resample audio to 16kHz mono`)
|
|
49
|
-
sourceRawAudio = await ensureRawAudio(isolatedRawAudio, 16000, 1)
|
|
51
|
+
sourceRawAudio = await ensureRawAudio(isolatedRawAudio, 16000, 1, callbacks)
|
|
50
52
|
} else {
|
|
51
53
|
logger.start(`Resample audio to 16kHz mono`)
|
|
52
|
-
sourceRawAudio = await ensureRawAudio(inputRawAudio, 16000, 1)
|
|
54
|
+
sourceRawAudio = await ensureRawAudio(inputRawAudio, 16000, 1, callbacks)
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
let sourceUncropTimeline: Timeline | undefined
|
|
56
58
|
|
|
57
59
|
if (options.crop) {
|
|
58
60
|
logger.start('Crop using voice activity detection');
|
|
59
|
-
({ timeline: sourceUncropTimeline, croppedRawAudio: sourceRawAudio } = await API.detectVoiceActivity(
|
|
61
|
+
({ timeline: sourceUncropTimeline, croppedRawAudio: sourceRawAudio } = await API.detectVoiceActivity(
|
|
62
|
+
sourceRawAudio,
|
|
63
|
+
options.vad!,
|
|
64
|
+
{ ...callbacks, logLevel: 'warning' }))
|
|
60
65
|
|
|
61
66
|
logger.end()
|
|
62
67
|
}
|
|
@@ -75,7 +80,11 @@ export async function translateSpeech(input: AudioSourceParam, options: SpeechTr
|
|
|
75
80
|
logger.logTitledMessage('Source language specified', formatLanguageCodeWithName(options.sourceLanguage))
|
|
76
81
|
} else {
|
|
77
82
|
logger.start('No source language specified. Detect speech language')
|
|
78
|
-
const { detectedLanguage } = await detectSpeechLanguage(
|
|
83
|
+
const { detectedLanguage } = await detectSpeechLanguage(
|
|
84
|
+
sourceRawAudio,
|
|
85
|
+
options.languageDetection!,
|
|
86
|
+
{ abortSignal: callbacks.abortSignal, logLevel: 'warning' }
|
|
87
|
+
)
|
|
79
88
|
|
|
80
89
|
options.sourceLanguage = detectedLanguage
|
|
81
90
|
|
|
@@ -102,70 +111,87 @@ export async function translateSpeech(input: AudioSourceParam, options: SpeechTr
|
|
|
102
111
|
switch (engine) {
|
|
103
112
|
case 'whisper': {
|
|
104
113
|
const WhisperSTT = await import('../recognition/WhisperSTT.js')
|
|
114
|
+
const WhisperCommon = await import('../recognition/WhisperCommon.js')
|
|
105
115
|
|
|
106
|
-
const whisperOptions = options.whisper!
|
|
116
|
+
const whisperOptions: WhisperOptions = extendDeep(WhisperSTT.defaultWhisperOptions, options.whisper!)
|
|
107
117
|
|
|
108
118
|
const shortSourceLanguageCode = getShortLanguageCode(sourceLanguage)
|
|
109
119
|
const shortTargetLanguageCode = getShortLanguageCode(targetLanguage)
|
|
110
120
|
|
|
111
|
-
const { modelName, modelDir } = await WhisperSTT.loadPackagesAndGetPaths(whisperOptions.model, shortSourceLanguageCode)
|
|
112
|
-
|
|
113
121
|
if (shortTargetLanguageCode != 'en') {
|
|
114
122
|
throw new Error('Whisper translation only supports English as target language')
|
|
115
123
|
}
|
|
116
124
|
|
|
117
|
-
if (modelName.endsWith('.en')) {
|
|
118
|
-
throw new Error('Whisper translation tasks are only possible with a multilingual model')
|
|
119
|
-
}
|
|
120
|
-
|
|
121
125
|
if (shortSourceLanguageCode == 'en' && shortTargetLanguageCode == 'en') {
|
|
122
126
|
throw new Error('Both translation source and target languages are English')
|
|
123
127
|
}
|
|
124
128
|
|
|
129
|
+
const { modelId, modelPath } = await WhisperCommon.loadModelPackage(
|
|
130
|
+
whisperOptions.model,
|
|
131
|
+
shortSourceLanguageCode,
|
|
132
|
+
callbacks,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
const { libPath } = await WhisperSTT.loadLibraryPackages(
|
|
136
|
+
whisperOptions.enableGPU,
|
|
137
|
+
callbacks,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
if (modelId.endsWith('.en')) {
|
|
141
|
+
throw new Error(`Whisper translation task is not supported with model '${modelId}', since it's not multilingual model.`)
|
|
142
|
+
}
|
|
143
|
+
|
|
125
144
|
logger.end();
|
|
126
145
|
|
|
127
146
|
({ transcript, timeline: wordTimeline } = await WhisperSTT.recognize(
|
|
128
147
|
sourceRawAudio,
|
|
129
|
-
|
|
130
|
-
|
|
148
|
+
modelId,
|
|
149
|
+
modelPath,
|
|
150
|
+
libPath,
|
|
131
151
|
'translate',
|
|
132
152
|
sourceLanguage,
|
|
133
153
|
whisperOptions,
|
|
134
|
-
|
|
154
|
+
callbacks,
|
|
135
155
|
))
|
|
136
156
|
|
|
137
157
|
break
|
|
138
158
|
}
|
|
139
159
|
|
|
140
160
|
case 'whisper.cpp': {
|
|
141
|
-
const
|
|
161
|
+
const WhisperCppCliSTT = await import('../recognition/WhisperCppCliSTT.js')
|
|
162
|
+
const WhisperCommon = await import('../recognition/WhisperCommon.js')
|
|
142
163
|
|
|
143
|
-
const
|
|
164
|
+
const whisperCppCliOptions = options.whisperCpp!
|
|
144
165
|
|
|
145
166
|
const shortSourceLanguageCode = getShortLanguageCode(sourceLanguage)
|
|
146
167
|
const shortTargetLanguageCode = getShortLanguageCode(targetLanguage)
|
|
147
168
|
|
|
148
169
|
logger.end()
|
|
149
170
|
|
|
150
|
-
const {
|
|
171
|
+
const { modelId, modelPath } = await WhisperCommon.loadModelPackage(
|
|
172
|
+
whisperCppCliOptions.model,
|
|
173
|
+
shortSourceLanguageCode,
|
|
174
|
+
callbacks,
|
|
175
|
+
)
|
|
151
176
|
|
|
152
177
|
if (shortTargetLanguageCode != 'en') {
|
|
153
178
|
throw new Error('Whisper.cpp translation only supports English as target language')
|
|
154
179
|
}
|
|
155
180
|
|
|
156
|
-
if (
|
|
181
|
+
if (modelId.endsWith('.en')) {
|
|
157
182
|
throw new Error('Whisper.cpp translation tasks are only possible with a multilingual model')
|
|
158
183
|
}
|
|
159
184
|
|
|
160
185
|
logger.end();
|
|
161
186
|
|
|
162
|
-
({ transcript, timeline: wordTimeline } = await
|
|
187
|
+
({ transcript, timeline: wordTimeline } = await WhisperCppCliSTT.recognize(
|
|
163
188
|
sourceRawAudio,
|
|
164
189
|
'translate',
|
|
165
190
|
shortSourceLanguageCode,
|
|
166
|
-
|
|
191
|
+
modelId,
|
|
167
192
|
modelPath,
|
|
168
|
-
|
|
193
|
+
whisperCppCliOptions,
|
|
194
|
+
callbacks,
|
|
169
195
|
))
|
|
170
196
|
|
|
171
197
|
break
|
|
@@ -189,7 +215,13 @@ export async function translateSpeech(input: AudioSourceParam, options: SpeechTr
|
|
|
189
215
|
|
|
190
216
|
logger.end();
|
|
191
217
|
|
|
192
|
-
({ transcript, timeline: segmentTimeline } = await OpenAICloudSTT.recognize(
|
|
218
|
+
({ transcript, timeline: segmentTimeline } = await OpenAICloudSTT.recognize(
|
|
219
|
+
sourceRawAudio,
|
|
220
|
+
shortSourceLanguageCode,
|
|
221
|
+
openAICloudSTTOptions,
|
|
222
|
+
'translate',
|
|
223
|
+
callbacks,
|
|
224
|
+
))
|
|
193
225
|
|
|
194
226
|
break
|
|
195
227
|
}
|
|
@@ -219,7 +251,7 @@ export async function translateSpeech(input: AudioSourceParam, options: SpeechTr
|
|
|
219
251
|
}
|
|
220
252
|
|
|
221
253
|
logger.log('')
|
|
222
|
-
logger.logDuration(`Total speech translation time`, startTimestamp, chalk.magentaBright)
|
|
254
|
+
logger.logDuration(`Total speech translation time`, startTimestamp, 'info', chalk.magentaBright)
|
|
223
255
|
|
|
224
256
|
return {
|
|
225
257
|
transcript,
|
|
@@ -250,7 +282,7 @@ export interface SpeechTranslationResult {
|
|
|
250
282
|
|
|
251
283
|
export type SpeechTranslationEngine = 'whisper' | 'whisper.cpp' | 'openai-cloud'
|
|
252
284
|
|
|
253
|
-
export interface SpeechTranslationOptions {
|
|
285
|
+
export interface SpeechTranslationOptions extends API.OperationOptions {
|
|
254
286
|
engine?: SpeechTranslationEngine
|
|
255
287
|
|
|
256
288
|
sourceLanguage?: string
|
|
@@ -261,11 +293,11 @@ export interface SpeechTranslationOptions {
|
|
|
261
293
|
|
|
262
294
|
languageDetection?: SpeechLanguageDetectionOptions
|
|
263
295
|
subtitles?: SubtitlesConfig
|
|
264
|
-
vad?: API.
|
|
296
|
+
vad?: API.VoiceActivityDetectionOptions
|
|
265
297
|
sourceSeparation?: API.SourceSeparationOptions
|
|
266
298
|
|
|
267
299
|
whisper?: WhisperOptions
|
|
268
|
-
whisperCpp?:
|
|
300
|
+
whisperCpp?: WhisperCppCliOptions
|
|
269
301
|
openAICloud?: OpenAICloudSTTOptions
|
|
270
302
|
}
|
|
271
303
|
|
|
@@ -297,6 +329,11 @@ export const defaultSpeechTranslationOptions: SpeechTranslationOptions = {
|
|
|
297
329
|
},
|
|
298
330
|
}
|
|
299
331
|
|
|
332
|
+
export interface SpeechTranslationCallbacks extends API.OperationCallbacks {
|
|
333
|
+
onPart?: WhisperPartCallback
|
|
334
|
+
onToken?: WhisperTokenCallback
|
|
335
|
+
}
|
|
336
|
+
|
|
300
337
|
export const speechTranslationEngines: EngineMetadata[] = [
|
|
301
338
|
{
|
|
302
339
|
id: 'whisper',
|
|
@@ -306,7 +343,7 @@ export const speechTranslationEngines: EngineMetadata[] = [
|
|
|
306
343
|
},
|
|
307
344
|
{
|
|
308
345
|
id: 'whisper.cpp',
|
|
309
|
-
name: 'OpenAI Whisper (C++ port)',
|
|
346
|
+
name: 'OpenAI Whisper (C++ port) CLI',
|
|
310
347
|
description: `Uses Whisper's speech translation capability to produce an English transcript from speech in a different language.`,
|
|
311
348
|
type: 'local'
|
|
312
349
|
},
|