echogarden 2.10.2 → 3.0.1
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 +129 -71
- 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 +158 -71
- 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,18 +1,17 @@
|
|
|
1
|
+
import * as API from './API.js'
|
|
2
|
+
|
|
1
3
|
import { extendDeep } from '../utilities/ObjectUtilities.js'
|
|
2
4
|
|
|
3
5
|
import { Logger } from '../utilities/Logger.js'
|
|
4
6
|
|
|
5
|
-
import * as API from './API.js'
|
|
6
|
-
import { logToStderr } from '../utilities/Utilities.js'
|
|
7
7
|
import { languageCodeToName } from '../utilities/Locale.js'
|
|
8
8
|
import { LanguageDetectionResults } from './LanguageDetectionCommon.js'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export async function detectTextLanguage(input: string, options: TextLanguageDetectionOptions): Promise<TextLanguageDetectionResult> {
|
|
13
|
-
const logger = new Logger()
|
|
14
|
-
|
|
10
|
+
export async function detectTextLanguage(input: string, options: TextLanguageDetectionOptions, callbacks?: TextLanguageDetectionCallbacks): Promise<TextLanguageDetectionResult> {
|
|
15
11
|
options = extendDeep(defaultTextLanguageDetectionOptions, options)
|
|
12
|
+
callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks }
|
|
13
|
+
|
|
14
|
+
const logger = new Logger(callbacks.logLevel)
|
|
16
15
|
|
|
17
16
|
const defaultLanguage = options.defaultLanguage!
|
|
18
17
|
const fallbackThresholdProbability = options.fallbackThresholdProbability!
|
|
@@ -84,22 +83,21 @@ export interface LanguageDetectionGroupResultsEntry {
|
|
|
84
83
|
|
|
85
84
|
export type TextLanguageDetectionEngine = 'tinyld' | 'fasttext'
|
|
86
85
|
|
|
87
|
-
export interface TextLanguageDetectionOptions {
|
|
86
|
+
export interface TextLanguageDetectionOptions extends API.OperationOptions {
|
|
88
87
|
engine?: TextLanguageDetectionEngine
|
|
89
88
|
defaultLanguage?: string
|
|
90
89
|
fallbackThresholdProbability?: number
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
94
|
-
// Constants
|
|
95
|
-
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
96
|
-
|
|
97
92
|
export const defaultTextLanguageDetectionOptions: TextLanguageDetectionOptions = {
|
|
98
93
|
engine: 'tinyld',
|
|
99
94
|
defaultLanguage: 'en',
|
|
100
95
|
fallbackThresholdProbability: 0.05,
|
|
101
96
|
}
|
|
102
97
|
|
|
98
|
+
export interface TextLanguageDetectionCallbacks extends API.OperationCallbacks {
|
|
99
|
+
}
|
|
100
|
+
|
|
103
101
|
export const textLanguageDetectionEngines: API.EngineMetadata[] = [
|
|
104
102
|
{
|
|
105
103
|
id: 'tinyld',
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
|
+
|
|
3
|
+
import * as API from './API.js'
|
|
4
|
+
|
|
2
5
|
import { formatLanguageCodeWithName, normalizeIdentifierToLanguageCode, parseLangIdentifier } from '../utilities/Locale.js'
|
|
3
6
|
import { Logger } from '../utilities/Logger.js'
|
|
4
7
|
import { extendDeep } from '../utilities/ObjectUtilities.js'
|
|
5
|
-
import * as API from './API.js'
|
|
6
8
|
import { defaultGoogleTranslateTextTranslationOptions, type GoogleTranslateTextTranslationOptions } from '../text-translation/GoogleTranslateTextTranslation.js'
|
|
7
9
|
|
|
8
|
-
export async function translateText(inputText: string, options: TextTranslationOptions): Promise<TextTranslationResult> {
|
|
9
|
-
|
|
10
|
+
export async function translateText(inputText: string, options: TextTranslationOptions, callbacks?: TextTranslationCallbacks): Promise<TextTranslationResult> {
|
|
11
|
+
options = extendDeep(defaultTextTranslationOptions, options)
|
|
12
|
+
callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks }
|
|
10
13
|
|
|
11
|
-
const
|
|
14
|
+
const logger = new Logger(callbacks.logLevel)
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
const startTimestamp = logger.getTimestamp()
|
|
14
17
|
|
|
15
18
|
if (options.sourceLanguage) {
|
|
16
19
|
const languageData = await parseLangIdentifier(options.sourceLanguage)
|
|
@@ -21,7 +24,11 @@ export async function translateText(inputText: string, options: TextTranslationO
|
|
|
21
24
|
logger.logTitledMessage('Source language specified', formatLanguageCodeWithName(options.sourceLanguage))
|
|
22
25
|
} else {
|
|
23
26
|
logger.start('No source language specified. Detect text language')
|
|
24
|
-
const { detectedLanguage } = await API.detectTextLanguage(
|
|
27
|
+
const { detectedLanguage } = await API.detectTextLanguage(
|
|
28
|
+
inputText,
|
|
29
|
+
options.languageDetection!,
|
|
30
|
+
{ abortSignal: callbacks.abortSignal, logLevel: 'warning' },
|
|
31
|
+
)
|
|
25
32
|
|
|
26
33
|
options.sourceLanguage = detectedLanguage
|
|
27
34
|
|
|
@@ -44,9 +51,14 @@ export async function translateText(inputText: string, options: TextTranslationO
|
|
|
44
51
|
|
|
45
52
|
logger.end()
|
|
46
53
|
|
|
47
|
-
logger.logTitledMessage(`Warning`, `The nllb text translation engine is currently a work-in-progress and doesn't work correctly.`,
|
|
54
|
+
logger.logTitledMessage(`Warning`, `The nllb text translation engine is currently a work-in-progress and doesn't work correctly.`, 'warning')
|
|
48
55
|
|
|
49
|
-
translationPairs = await NLLBTextTranslation.translateText(
|
|
56
|
+
translationPairs = await NLLBTextTranslation.translateText(
|
|
57
|
+
inputText,
|
|
58
|
+
options.sourceLanguage,
|
|
59
|
+
options.targetLanguage,
|
|
60
|
+
callbacks,
|
|
61
|
+
)
|
|
50
62
|
|
|
51
63
|
translatedText = translationPairs.map(pair => {
|
|
52
64
|
const translated = pair.translatedText
|
|
@@ -68,7 +80,14 @@ export async function translateText(inputText: string, options: TextTranslationO
|
|
|
68
80
|
|
|
69
81
|
logger.end();
|
|
70
82
|
|
|
71
|
-
({ translationPairs, translatedText } = await GoogleTranslateTextTranslation.translateText(
|
|
83
|
+
({ translationPairs, translatedText } = await GoogleTranslateTextTranslation.translateText(
|
|
84
|
+
inputText,
|
|
85
|
+
options.sourceLanguage,
|
|
86
|
+
options.targetLanguage,
|
|
87
|
+
options.plainText!,
|
|
88
|
+
googleTranslateOptions,
|
|
89
|
+
callbacks,
|
|
90
|
+
))
|
|
72
91
|
|
|
73
92
|
break
|
|
74
93
|
}
|
|
@@ -78,9 +97,15 @@ export async function translateText(inputText: string, options: TextTranslationO
|
|
|
78
97
|
|
|
79
98
|
logger.end()
|
|
80
99
|
|
|
81
|
-
logger.logTitledMessage(`Warning`, `The deepl text translation engine is currently a work-in-progress and doesn't work correctly.`,
|
|
100
|
+
logger.logTitledMessage(`Warning`, `The deepl text translation engine is currently a work-in-progress and doesn't work correctly.`, 'warning')
|
|
101
|
+
|
|
102
|
+
translationPairs = await DeepLTextTranslation.translateText(
|
|
103
|
+
inputText,
|
|
104
|
+
options.sourceLanguage,
|
|
105
|
+
options.targetLanguage,
|
|
106
|
+
callbacks
|
|
107
|
+
)
|
|
82
108
|
|
|
83
|
-
translationPairs = await DeepLTextTranslation.translateText(inputText, options.sourceLanguage, options.targetLanguage)
|
|
84
109
|
translatedText = ''
|
|
85
110
|
|
|
86
111
|
break
|
|
@@ -95,7 +120,7 @@ export async function translateText(inputText: string, options: TextTranslationO
|
|
|
95
120
|
logger.end()
|
|
96
121
|
|
|
97
122
|
logger.log('')
|
|
98
|
-
logger.logDuration(`Total text translation time`, startTimestamp, chalk.magentaBright)
|
|
123
|
+
logger.logDuration(`Total text translation time`, startTimestamp, 'info', chalk.magentaBright)
|
|
99
124
|
|
|
100
125
|
return {
|
|
101
126
|
text: inputText,
|
|
@@ -108,7 +133,7 @@ export async function translateText(inputText: string, options: TextTranslationO
|
|
|
108
133
|
}
|
|
109
134
|
}
|
|
110
135
|
|
|
111
|
-
export interface TextTranslationOptions {
|
|
136
|
+
export interface TextTranslationOptions extends API.OperationOptions {
|
|
112
137
|
engine?: TextTranslationEngine
|
|
113
138
|
|
|
114
139
|
sourceLanguage?: string
|
|
@@ -150,7 +175,8 @@ export const defaultTextTranslationOptions: TextTranslationOptions = {
|
|
|
150
175
|
sourceLanguage: undefined,
|
|
151
176
|
targetLanguage: 'en',
|
|
152
177
|
|
|
153
|
-
languageDetection:
|
|
178
|
+
languageDetection: {
|
|
179
|
+
},
|
|
154
180
|
|
|
155
181
|
plainText: {
|
|
156
182
|
paragraphBreaks: 'double',
|
|
@@ -166,23 +192,14 @@ export const defaultTextTranslationOptions: TextTranslationOptions = {
|
|
|
166
192
|
},
|
|
167
193
|
}
|
|
168
194
|
|
|
195
|
+
export interface TextTranslationCallbacks extends API.OperationCallbacks {
|
|
196
|
+
}
|
|
197
|
+
|
|
169
198
|
export const textTranslationEngines: API.EngineMetadata[] = [
|
|
170
|
-
{
|
|
171
|
-
id: 'nllb',
|
|
172
|
-
name: 'NLLB',
|
|
173
|
-
description: 'No Language Left Behind (NLLB) is a deep learning machine translation model by Facebook Research (work-in-progress, do not use).',
|
|
174
|
-
type: 'local'
|
|
175
|
-
},
|
|
176
199
|
{
|
|
177
200
|
id: 'google-translate',
|
|
178
201
|
name: 'Google Translate',
|
|
179
202
|
description: 'Unoffical text translation API used by the Google Translate web interface.',
|
|
180
203
|
type: 'cloud'
|
|
181
204
|
},
|
|
182
|
-
{
|
|
183
|
-
id: 'deepl',
|
|
184
|
-
name: 'DeepL',
|
|
185
|
-
description: 'Unoffical text translation API used by the DeepL web interface (work-in-progress, do not use).',
|
|
186
|
-
type: 'cloud'
|
|
187
|
-
},
|
|
188
205
|
]
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
|
+
|
|
3
|
+
import * as API from './API.js'
|
|
4
|
+
|
|
2
5
|
import { AudioSourceParam, RawAudio, ensureRawAudio } from '../audio/AudioUtilities.js'
|
|
3
6
|
import { SubtitlesConfig } from '../subtitles/Subtitles.js'
|
|
4
7
|
import { formatLanguageCodeWithName, getShortLanguageCode, parseLangIdentifier } from '../utilities/Locale.js'
|
|
5
8
|
import { Logger } from '../utilities/Logger.js'
|
|
6
9
|
import { extendDeep } from '../utilities/ObjectUtilities.js'
|
|
7
10
|
import { Timeline, addWordTextOffsetsToTimelineInPlace, wordTimelineToSegmentSentenceTimeline } from '../utilities/Timeline.js'
|
|
8
|
-
import * as API from './API.js'
|
|
9
11
|
|
|
10
|
-
export async function alignTimelineTranslation(inputTimeline: Timeline, translatedTranscript: string, options: TimelineTranslationAlignmentOptions): Promise<TimelineTranslationAlignmentResult> {
|
|
11
|
-
|
|
12
|
+
export async function alignTimelineTranslation(inputTimeline: Timeline, translatedTranscript: string, options: TimelineTranslationAlignmentOptions, callbacks?: TimelineTranslationAlignmentCallbacks): Promise<TimelineTranslationAlignmentResult> {
|
|
13
|
+
options = extendDeep(defaultTimelineTranslationAlignmentOptions, options)
|
|
14
|
+
callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks }
|
|
12
15
|
|
|
13
|
-
const
|
|
16
|
+
const logger = new Logger(callbacks.logLevel)
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
const startTimestamp = logger.getTimestamp()
|
|
16
19
|
|
|
17
20
|
let rawAudio: RawAudio | undefined
|
|
18
21
|
|
|
19
22
|
if (options.audio) {
|
|
20
|
-
rawAudio = await ensureRawAudio(options.audio)
|
|
23
|
+
rawAudio = await ensureRawAudio(options.audio, undefined, undefined, callbacks)
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
let sourceLanguage = options.sourceLanguage
|
|
@@ -33,7 +36,11 @@ export async function alignTimelineTranslation(inputTimeline: Timeline, translat
|
|
|
33
36
|
logger.start('No source language specified. Detect source language')
|
|
34
37
|
|
|
35
38
|
const timelineText = inputTimeline.map(entry => entry.text).join(' ')
|
|
36
|
-
const { detectedLanguage } = await API.detectTextLanguage(
|
|
39
|
+
const { detectedLanguage } = await API.detectTextLanguage(
|
|
40
|
+
timelineText,
|
|
41
|
+
options.languageDetection!,
|
|
42
|
+
{ abortSignal: callbacks.abortSignal, logLevel: 'warning' },
|
|
43
|
+
)
|
|
37
44
|
|
|
38
45
|
sourceLanguage = detectedLanguage
|
|
39
46
|
|
|
@@ -52,7 +59,12 @@ export async function alignTimelineTranslation(inputTimeline: Timeline, translat
|
|
|
52
59
|
logger.logTitledMessage('Target language specified', formatLanguageCodeWithName(targetLanguage))
|
|
53
60
|
} else {
|
|
54
61
|
logger.start('No target language specified. Detect target language')
|
|
55
|
-
|
|
62
|
+
|
|
63
|
+
const { detectedLanguage } = await API.detectTextLanguage(
|
|
64
|
+
translatedTranscript,
|
|
65
|
+
options.languageDetection!,
|
|
66
|
+
{ abortSignal: callbacks.abortSignal, logLevel: 'warning' },
|
|
67
|
+
)
|
|
56
68
|
|
|
57
69
|
targetLanguage = detectedLanguage
|
|
58
70
|
|
|
@@ -83,7 +95,9 @@ export async function alignTimelineTranslation(inputTimeline: Timeline, translat
|
|
|
83
95
|
mappedWordTimeline = await alignTimelineToTextSemantically(
|
|
84
96
|
inputTimeline,
|
|
85
97
|
translatedTranscript,
|
|
86
|
-
targetLanguage
|
|
98
|
+
targetLanguage,
|
|
99
|
+
callbacks,
|
|
100
|
+
)
|
|
87
101
|
|
|
88
102
|
break
|
|
89
103
|
}
|
|
@@ -100,7 +114,7 @@ export async function alignTimelineTranslation(inputTimeline: Timeline, translat
|
|
|
100
114
|
const { segmentTimeline: mappedTimeline } = await wordTimelineToSegmentSentenceTimeline(mappedWordTimeline, translatedTranscript, targetLanguage)
|
|
101
115
|
|
|
102
116
|
logger.end()
|
|
103
|
-
logger.logDuration(`Total timeline translation alignment time`, startTimestamp, chalk.magentaBright)
|
|
117
|
+
logger.logDuration(`Total timeline translation alignment time`, startTimestamp, 'info', chalk.magentaBright)
|
|
104
118
|
|
|
105
119
|
logger.end()
|
|
106
120
|
|
|
@@ -126,7 +140,7 @@ export interface TimelineTranslationAlignmentResult {
|
|
|
126
140
|
rawAudio?: RawAudio
|
|
127
141
|
}
|
|
128
142
|
|
|
129
|
-
export interface TimelineTranslationAlignmentOptions {
|
|
143
|
+
export interface TimelineTranslationAlignmentOptions extends API.OperationOptions {
|
|
130
144
|
engine?: 'e5'
|
|
131
145
|
|
|
132
146
|
sourceLanguage?: string
|
|
@@ -152,11 +166,25 @@ const defaultTimelineTranslationAlignmentOptions: TimelineTranslationAlignmentOp
|
|
|
152
166
|
|
|
153
167
|
audio: undefined,
|
|
154
168
|
|
|
155
|
-
languageDetection:
|
|
169
|
+
languageDetection: {
|
|
170
|
+
},
|
|
156
171
|
|
|
157
|
-
subtitles:
|
|
172
|
+
subtitles: {
|
|
173
|
+
},
|
|
158
174
|
|
|
159
175
|
e5: {
|
|
160
176
|
model: 'small-fp16',
|
|
161
177
|
}
|
|
162
178
|
}
|
|
179
|
+
|
|
180
|
+
export interface TimelineTranslationAlignmentCallbacks extends API.OperationCallbacks {
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export const timelineTranslationAlignmentEngines: API.EngineMetadata[] = [
|
|
184
|
+
{
|
|
185
|
+
id: 'e5',
|
|
186
|
+
name: 'E5',
|
|
187
|
+
description: 'E5 embedding model.',
|
|
188
|
+
type: 'local'
|
|
189
|
+
},
|
|
190
|
+
]
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
|
|
3
|
+
import * as API from './API.js'
|
|
4
|
+
|
|
1
5
|
import { extendDeep } from '../utilities/ObjectUtilities.js'
|
|
2
6
|
|
|
3
|
-
import { logToStderr } from '../utilities/Utilities.js'
|
|
4
7
|
import { AudioSourceParam, RawAudio } from '../audio/AudioUtilities.js'
|
|
5
8
|
import { Logger } from '../utilities/Logger.js'
|
|
6
9
|
|
|
7
|
-
import * as API from './API.js'
|
|
8
10
|
import { Timeline } from '../utilities/Timeline.js'
|
|
9
|
-
import chalk from 'chalk'
|
|
10
11
|
import { type SubtitlesConfig } from '../subtitles/Subtitles.js'
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
export async function alignTranscriptAndTranslation(input: AudioSourceParam, transcript: string, translatedTranscript: string, options: TranscriptAndTranslationAlignmentOptions, callbacks?: TranscriptAndTranslationAlignmentCallbacks): Promise<TranscriptAndTranslationAlignmentResult> {
|
|
14
|
+
options = extendDeep(defaultTranscriptAndTranslationAlignmentOptions, options)
|
|
15
|
+
callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks }
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
const logger = new Logger()
|
|
17
|
+
const logger = new Logger(callbacks.logLevel)
|
|
16
18
|
|
|
17
19
|
const startTimestamp = logger.getTimestamp()
|
|
18
20
|
|
|
19
|
-
options = extendDeep(defaultTranscriptAndTranslationAlignmentOptions, options)
|
|
20
|
-
|
|
21
21
|
if (options.sourceLanguage && !options.alignment?.language) {
|
|
22
22
|
options.alignment = extendDeep(options.alignment || {}, { language: options.sourceLanguage })
|
|
23
23
|
}
|
|
@@ -31,16 +31,26 @@ export async function alignTranscriptAndTranslation(input: AudioSourceParam, tra
|
|
|
31
31
|
|
|
32
32
|
switch (options.engine) {
|
|
33
33
|
case 'two-stage': {
|
|
34
|
-
logger.logTitledMessage(`Start stage 1`, `Align speech to transcript`, chalk.magentaBright)
|
|
34
|
+
logger.logTitledMessage(`Start stage 1`, `Align speech to transcript`, 'info', chalk.magentaBright)
|
|
35
35
|
logger.end()
|
|
36
36
|
|
|
37
|
-
alignmentResult = await API.align(
|
|
37
|
+
alignmentResult = await API.align(
|
|
38
|
+
input,
|
|
39
|
+
transcript,
|
|
40
|
+
options.alignment!,
|
|
41
|
+
callbacks
|
|
42
|
+
)
|
|
38
43
|
|
|
39
44
|
logger.log(``)
|
|
40
|
-
logger.logTitledMessage(`Start stage 2`, `Align timeline to translated transcript`, chalk.magentaBright)
|
|
45
|
+
logger.logTitledMessage(`Start stage 2`, `Align timeline to translated transcript`, 'info', chalk.magentaBright)
|
|
41
46
|
logger.end()
|
|
42
47
|
|
|
43
|
-
timelineAlignmentResult = await API.alignTimelineTranslation(
|
|
48
|
+
timelineAlignmentResult = await API.alignTimelineTranslation(
|
|
49
|
+
alignmentResult.timeline,
|
|
50
|
+
translatedTranscript,
|
|
51
|
+
options.timelineAlignment!,
|
|
52
|
+
callbacks,
|
|
53
|
+
)
|
|
44
54
|
|
|
45
55
|
break
|
|
46
56
|
}
|
|
@@ -53,7 +63,7 @@ export async function alignTranscriptAndTranslation(input: AudioSourceParam, tra
|
|
|
53
63
|
logger.end()
|
|
54
64
|
|
|
55
65
|
logger.log(``)
|
|
56
|
-
logger.logDuration(`Total transcript and translation alignment time`, startTimestamp, chalk.magentaBright)
|
|
66
|
+
logger.logDuration(`Total transcript and translation alignment time`, startTimestamp, 'info', chalk.magentaBright)
|
|
57
67
|
|
|
58
68
|
return {
|
|
59
69
|
timeline: alignmentResult.timeline,
|
|
@@ -94,7 +104,7 @@ export interface TranscriptAndTranslationAlignmentResult {
|
|
|
94
104
|
|
|
95
105
|
export type TranscriptAndTranslationAlignmentEngine = 'two-stage'
|
|
96
106
|
|
|
97
|
-
export interface TranscriptAndTranslationAlignmentOptions {
|
|
107
|
+
export interface TranscriptAndTranslationAlignmentOptions extends API.OperationOptions {
|
|
98
108
|
engine?: TranscriptAndTranslationAlignmentEngine
|
|
99
109
|
|
|
100
110
|
sourceLanguage?: string
|
|
@@ -110,7 +120,7 @@ export interface TranscriptAndTranslationAlignmentOptions {
|
|
|
110
120
|
|
|
111
121
|
languageDetection?: API.TextLanguageDetectionOptions
|
|
112
122
|
|
|
113
|
-
vad?: API.
|
|
123
|
+
vad?: API.VoiceActivityDetectionOptions
|
|
114
124
|
|
|
115
125
|
plainText?: API.PlainTextOptions
|
|
116
126
|
|
|
@@ -154,6 +164,9 @@ export const defaultTranscriptAndTranslationAlignmentOptions: TranscriptAndTrans
|
|
|
154
164
|
},
|
|
155
165
|
}
|
|
156
166
|
|
|
167
|
+
export interface TranscriptAndTranslationAlignmentCallbacks extends API.OperationCallbacks {
|
|
168
|
+
}
|
|
169
|
+
|
|
157
170
|
export const TranscriptAndTranslationAlignmentEngines: API.EngineMetadata[] = [
|
|
158
171
|
{
|
|
159
172
|
id: 'two-stage',
|
|
@@ -1,52 +1,56 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
|
|
3
|
+
import * as API from './API.js'
|
|
4
|
+
|
|
1
5
|
import { extendDeep } from '../utilities/ObjectUtilities.js'
|
|
2
6
|
|
|
3
|
-
import { logToStderr } from '../utilities/Utilities.js'
|
|
4
7
|
import { AudioSourceParam, RawAudio, ensureRawAudio, normalizeAudioLevelInPlace, trimAudioEnd } from '../audio/AudioUtilities.js'
|
|
5
8
|
import { Logger } from '../utilities/Logger.js'
|
|
6
9
|
|
|
7
|
-
import * as API from './API.js'
|
|
8
10
|
import { Timeline, addWordTextOffsetsToTimelineInPlace, wordTimelineToSegmentSentenceTimeline } from '../utilities/Timeline.js'
|
|
9
11
|
import { formatLanguageCodeWithName, getShortLanguageCode, normalizeIdentifierToLanguageCode, parseLangIdentifier } from '../utilities/Locale.js'
|
|
10
12
|
import { type WhisperAlignmentOptions } from '../recognition/WhisperSTT.js'
|
|
11
|
-
import chalk from 'chalk'
|
|
12
13
|
import { type SubtitlesConfig } from '../subtitles/Subtitles.js'
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
export async function alignTranslation(input: AudioSourceParam, translatedTranscript: string, options: TranslationAlignmentOptions, callbacks?: TranslationAlignmentCallbacks): Promise<TranslationAlignmentResult> {
|
|
16
|
+
options = extendDeep(defaultTranslationAlignmentOptions, options)
|
|
17
|
+
callbacks = { logLevel: API.getGlobalLogLevel(), ...callbacks }
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
const logger = new Logger()
|
|
19
|
+
const logger = new Logger(callbacks.logLevel)
|
|
18
20
|
|
|
19
21
|
const startTimestamp = logger.getTimestamp()
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const inputRawAudio = await ensureRawAudio(input)
|
|
23
|
+
const inputRawAudio = await ensureRawAudio(input, undefined, undefined, callbacks)
|
|
24
24
|
|
|
25
25
|
let sourceRawAudio: RawAudio
|
|
26
26
|
let isolatedRawAudio: RawAudio | undefined
|
|
27
27
|
let backgroundRawAudio: RawAudio | undefined
|
|
28
28
|
|
|
29
29
|
if (options.isolate) {
|
|
30
|
-
logger.
|
|
31
|
-
logger.end();
|
|
30
|
+
logger.logTitledMessage(`Isolate vocals`, '');
|
|
32
31
|
|
|
33
|
-
({ isolatedRawAudio, backgroundRawAudio } = await API.isolate(
|
|
32
|
+
({ isolatedRawAudio, backgroundRawAudio } = await API.isolate(
|
|
33
|
+
inputRawAudio,
|
|
34
|
+
options.sourceSeparation!,
|
|
35
|
+
{ ...callbacks, logLevel: logger.logLevel }))
|
|
34
36
|
|
|
35
37
|
logger.end()
|
|
36
|
-
logger.log(``)
|
|
37
38
|
|
|
38
39
|
logger.start(`Resample audio to 16kHz mono`)
|
|
39
|
-
sourceRawAudio = await ensureRawAudio(isolatedRawAudio, 16000, 1)
|
|
40
|
+
sourceRawAudio = await ensureRawAudio(isolatedRawAudio, 16000, 1, callbacks)
|
|
40
41
|
} else {
|
|
41
42
|
logger.start(`Resample audio to 16kHz mono`)
|
|
42
|
-
sourceRawAudio = await ensureRawAudio(inputRawAudio, 16000, 1)
|
|
43
|
+
sourceRawAudio = await ensureRawAudio(inputRawAudio, 16000, 1, callbacks)
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
let sourceUncropTimeline: Timeline | undefined
|
|
46
47
|
|
|
47
48
|
if (options.crop) {
|
|
48
49
|
logger.start('Crop using voice activity detection');
|
|
49
|
-
({ timeline: sourceUncropTimeline, croppedRawAudio: sourceRawAudio } = await API.detectVoiceActivity(
|
|
50
|
+
({ timeline: sourceUncropTimeline, croppedRawAudio: sourceRawAudio } = await API.detectVoiceActivity(
|
|
51
|
+
sourceRawAudio,
|
|
52
|
+
options.vad!,
|
|
53
|
+
{ ...callbacks, logLevel: 'warning' }))
|
|
50
54
|
|
|
51
55
|
logger.end()
|
|
52
56
|
}
|
|
@@ -69,7 +73,10 @@ export async function alignTranslation(input: AudioSourceParam, translatedTransc
|
|
|
69
73
|
logger.logTitledMessage('Source language specified', formatLanguageCodeWithName(sourceLanguage))
|
|
70
74
|
} else {
|
|
71
75
|
logger.start('No source language specified. Detect speech language')
|
|
72
|
-
const { detectedLanguage } = await API.detectSpeechLanguage(
|
|
76
|
+
const { detectedLanguage } = await API.detectSpeechLanguage(
|
|
77
|
+
sourceRawAudio,
|
|
78
|
+
options.languageDetection!,
|
|
79
|
+
{ ...callbacks, logLevel: 'warning' })
|
|
73
80
|
|
|
74
81
|
sourceLanguage = detectedLanguage
|
|
75
82
|
|
|
@@ -86,6 +93,7 @@ export async function alignTranslation(input: AudioSourceParam, translatedTransc
|
|
|
86
93
|
switch (options.engine) {
|
|
87
94
|
case 'whisper': {
|
|
88
95
|
const WhisperSTT = await import('../recognition/WhisperSTT.js')
|
|
96
|
+
const WhisperCommon = await import('../recognition/WhisperCommon.js')
|
|
89
97
|
|
|
90
98
|
const shortSourceLanguageCode = getShortLanguageCode(sourceLanguage)
|
|
91
99
|
const shortTargetLanguageCode = getShortLanguageCode(targetLanguage)
|
|
@@ -98,17 +106,35 @@ export async function alignTranslation(input: AudioSourceParam, translatedTransc
|
|
|
98
106
|
throw new Error('Both translation source and target languages are English')
|
|
99
107
|
}
|
|
100
108
|
|
|
101
|
-
const whisperAlignmnentOptions = options.whisper!
|
|
109
|
+
const whisperAlignmnentOptions: WhisperAlignmentOptions = extendDeep(WhisperSTT.defaultWhisperAlignmentOptions, options.whisper!)
|
|
102
110
|
|
|
103
|
-
const {
|
|
111
|
+
const { modelId, modelPath } = await WhisperCommon.loadModelPackage(
|
|
112
|
+
whisperAlignmnentOptions.model,
|
|
113
|
+
shortSourceLanguageCode,
|
|
114
|
+
callbacks,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
const { libPath } = await WhisperSTT.loadLibraryPackages(
|
|
118
|
+
whisperAlignmnentOptions.enableGPU,
|
|
119
|
+
callbacks,
|
|
120
|
+
)
|
|
104
121
|
|
|
105
122
|
logger.end()
|
|
106
123
|
|
|
107
|
-
if (
|
|
124
|
+
if (modelId.endsWith('.en')) {
|
|
108
125
|
throw new Error('Whisper translation tasks are only possible with a multilingual model')
|
|
109
126
|
}
|
|
110
127
|
|
|
111
|
-
mappedTimeline = await WhisperSTT.alignEnglishTranslation(
|
|
128
|
+
mappedTimeline = await WhisperSTT.alignEnglishTranslation(
|
|
129
|
+
sourceRawAudio,
|
|
130
|
+
translatedTranscript,
|
|
131
|
+
modelId,
|
|
132
|
+
modelPath,
|
|
133
|
+
libPath,
|
|
134
|
+
shortSourceLanguageCode,
|
|
135
|
+
whisperAlignmnentOptions,
|
|
136
|
+
callbacks
|
|
137
|
+
)
|
|
112
138
|
|
|
113
139
|
break
|
|
114
140
|
}
|
|
@@ -130,7 +156,7 @@ export async function alignTranslation(input: AudioSourceParam, translatedTransc
|
|
|
130
156
|
const { segmentTimeline } = await wordTimelineToSegmentSentenceTimeline(mappedTimeline, translatedTranscript, sourceLanguage, options.plainText?.paragraphBreaks, options.plainText?.whitespace)
|
|
131
157
|
|
|
132
158
|
logger.end()
|
|
133
|
-
logger.logDuration(`Total translation alignment time`, startTimestamp, chalk.magentaBright)
|
|
159
|
+
logger.logDuration(`Total translation alignment time`, startTimestamp, 'info', chalk.magentaBright)
|
|
134
160
|
|
|
135
161
|
return {
|
|
136
162
|
timeline: segmentTimeline,
|
|
@@ -161,7 +187,7 @@ export interface TranslationAlignmentResult {
|
|
|
161
187
|
|
|
162
188
|
export type TranslationAlignmentEngine = 'whisper'
|
|
163
189
|
|
|
164
|
-
export interface TranslationAlignmentOptions {
|
|
190
|
+
export interface TranslationAlignmentOptions extends API.OperationOptions {
|
|
165
191
|
engine?: TranslationAlignmentEngine
|
|
166
192
|
|
|
167
193
|
sourceLanguage?: string
|
|
@@ -173,7 +199,7 @@ export interface TranslationAlignmentOptions {
|
|
|
173
199
|
|
|
174
200
|
languageDetection?: API.SpeechLanguageDetectionOptions
|
|
175
201
|
|
|
176
|
-
vad?: API.
|
|
202
|
+
vad?: API.VoiceActivityDetectionOptions
|
|
177
203
|
|
|
178
204
|
plainText?: API.PlainTextOptions
|
|
179
205
|
|
|
@@ -216,6 +242,9 @@ export const defaultTranslationAlignmentOptions: TranslationAlignmentOptions = {
|
|
|
216
242
|
}
|
|
217
243
|
}
|
|
218
244
|
|
|
245
|
+
export interface TranslationAlignmentCallbacks extends API.OperationCallbacks {
|
|
246
|
+
}
|
|
247
|
+
|
|
219
248
|
export const translationAlignmentEngines: API.EngineMetadata[] = [
|
|
220
249
|
{
|
|
221
250
|
id: 'whisper',
|