echogarden 2.10.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.MIT.md +7 -0
- package/README.md +9 -1
- package/data/lexicons/heteronyms.en.json +44 -10
- package/data/lexicons/words.en.json +726 -22
- package/data/schemas/options.json +91 -153
- package/dist/alignment/DTWMfccSequenceAlignment.js.map +1 -1
- package/dist/alignment/SemanticTextAlignment.d.ts +4 -2
- package/dist/alignment/SemanticTextAlignment.d.ts.map +1 -1
- package/dist/alignment/SemanticTextAlignment.js +7 -7
- package/dist/alignment/SemanticTextAlignment.js.map +1 -1
- package/dist/alignment/SpeechAlignment.d.ts +9 -10
- package/dist/alignment/SpeechAlignment.d.ts.map +1 -1
- package/dist/alignment/SpeechAlignment.js +23 -96
- package/dist/alignment/SpeechAlignment.js.map +1 -1
- package/dist/api/APIOptions.d.ts +1 -1
- package/dist/api/APIOptions.d.ts.map +1 -1
- package/dist/api/Alignment.d.ts +8 -6
- package/dist/api/Alignment.d.ts.map +1 -1
- package/dist/api/Alignment.js +31 -40
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/Common.d.ts +7 -0
- package/dist/api/Common.d.ts.map +1 -1
- package/dist/api/Common.js.map +1 -1
- package/dist/api/Denoising.d.ts +5 -2
- package/dist/api/Denoising.d.ts.map +1 -1
- package/dist/api/Denoising.js +15 -15
- package/dist/api/Denoising.js.map +1 -1
- package/dist/api/GlobalOptions.d.ts +2 -8
- package/dist/api/GlobalOptions.d.ts.map +1 -1
- package/dist/api/GlobalOptions.js +2 -13
- package/dist/api/GlobalOptions.js.map +1 -1
- package/dist/api/Recognition.d.ts +11 -12
- package/dist/api/Recognition.d.ts.map +1 -1
- package/dist/api/Recognition.js +32 -82
- package/dist/api/Recognition.js.map +1 -1
- package/dist/api/SourceSeparation.d.ts +7 -2
- package/dist/api/SourceSeparation.d.ts.map +1 -1
- package/dist/api/SourceSeparation.js +12 -10
- package/dist/api/SourceSeparation.js.map +1 -1
- package/dist/api/SpeechLanguageDetection.d.ts +11 -7
- package/dist/api/SpeechLanguageDetection.d.ts.map +1 -1
- package/dist/api/SpeechLanguageDetection.js +37 -30
- package/dist/api/SpeechLanguageDetection.js.map +1 -1
- package/dist/api/SpeechSearch.d.ts +4 -1
- package/dist/api/SpeechSearch.d.ts.map +1 -1
- package/dist/api/SpeechSearch.js.map +1 -1
- package/dist/api/SpeechTranslation.d.ts +10 -6
- package/dist/api/SpeechTranslation.d.ts.map +1 -1
- package/dist/api/SpeechTranslation.js +28 -26
- package/dist/api/SpeechTranslation.js.map +1 -1
- package/dist/api/Synthesis.d.ts +13 -8
- package/dist/api/Synthesis.d.ts.map +1 -1
- package/dist/api/Synthesis.js +67 -89
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/api/TextLanguageDetection.d.ts +4 -2
- package/dist/api/TextLanguageDetection.d.ts.map +1 -1
- package/dist/api/TextLanguageDetection.js +4 -7
- package/dist/api/TextLanguageDetection.js.map +1 -1
- package/dist/api/TextTranslation.d.ts +4 -2
- package/dist/api/TextTranslation.d.ts.map +1 -1
- package/dist/api/TextTranslation.js +13 -24
- package/dist/api/TextTranslation.js.map +1 -1
- package/dist/api/TimelineTranslationAlignment.d.ts +6 -3
- package/dist/api/TimelineTranslationAlignment.d.ts.map +1 -1
- package/dist/api/TimelineTranslationAlignment.js +20 -11
- package/dist/api/TimelineTranslationAlignment.js.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.d.ts +6 -4
- package/dist/api/TranscriptAndTranslationAlignment.d.ts.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.js +11 -12
- package/dist/api/TranscriptAndTranslationAlignment.js.map +1 -1
- package/dist/api/TranslationAlignment.d.ts +6 -4
- package/dist/api/TranslationAlignment.d.ts.map +1 -1
- package/dist/api/TranslationAlignment.js +20 -21
- package/dist/api/TranslationAlignment.js.map +1 -1
- package/dist/api/VoiceActivityDetection.d.ts +9 -8
- package/dist/api/VoiceActivityDetection.d.ts.map +1 -1
- package/dist/api/VoiceActivityDetection.js +20 -43
- package/dist/api/VoiceActivityDetection.js.map +1 -1
- package/dist/audio/AudioBufferConversion.js.map +1 -1
- package/dist/audio/AudioPlayer.d.ts +1 -3
- package/dist/audio/AudioPlayer.d.ts.map +1 -1
- package/dist/audio/AudioPlayer.js +3 -188
- package/dist/audio/AudioPlayer.js.map +1 -1
- package/dist/audio/AudioUtilities.d.ts +2 -1
- package/dist/audio/AudioUtilities.d.ts.map +1 -1
- package/dist/audio/AudioUtilities.js +2 -2
- package/dist/audio/AudioUtilities.js.map +1 -1
- package/dist/build-tools/MakeTarballsForInstalledPackages.js +3 -3
- package/dist/build-tools/MakeTarballsForInstalledPackages.js.map +1 -1
- package/dist/cli/CLI.d.ts.map +1 -1
- package/dist/cli/CLI.js +139 -92
- package/dist/cli/CLI.js.map +1 -1
- package/dist/codecs/FFMpegTranscoder.d.ts +4 -3
- package/dist/codecs/FFMpegTranscoder.d.ts.map +1 -1
- package/dist/codecs/FFMpegTranscoder.js +16 -14
- package/dist/codecs/FFMpegTranscoder.js.map +1 -1
- package/dist/codecs/TIMITCodec.d.ts.map +1 -1
- package/dist/data-structures/DynamicTypedArray.d.ts.map +1 -1
- package/dist/data-structures/DynamicTypedArray.js.map +1 -1
- package/dist/data-structures/Queue.d.ts.map +1 -1
- package/dist/data-structures/WindowedList.d.ts.map +1 -1
- package/dist/data-structures/WindowedList.js.map +1 -1
- package/dist/denoising/NSNet2.d.ts +3 -2
- package/dist/denoising/NSNet2.d.ts.map +1 -1
- package/dist/denoising/NSNet2.js +4 -4
- package/dist/denoising/NSNet2.js.map +1 -1
- package/dist/denoising/RNNoise.d.ts +2 -1
- package/dist/denoising/RNNoise.d.ts.map +1 -1
- package/dist/denoising/RNNoise.js +10 -6
- package/dist/denoising/RNNoise.js.map +1 -1
- package/dist/dsp/BiquadFilter.d.ts.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.d.ts.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.js.map +1 -1
- package/dist/dsp/FFT.d.ts.map +1 -1
- package/dist/dsp/FFT.js +2 -1
- package/dist/dsp/FFT.js.map +1 -1
- package/dist/dsp/KWeightingFilter.d.ts.map +1 -1
- package/dist/dsp/KWeightingFilter.js.map +1 -1
- package/dist/dsp/LoudnessEstimator.d.ts.map +1 -1
- package/dist/dsp/LoudnessEstimator.js.map +1 -1
- package/dist/dsp/MFCC.d.ts +3 -2
- package/dist/dsp/MFCC.d.ts.map +1 -1
- package/dist/dsp/MFCC.js +4 -4
- package/dist/dsp/MFCC.js.map +1 -1
- package/dist/dsp/MelSpectrogram.d.ts +10 -8
- package/dist/dsp/MelSpectrogram.d.ts.map +1 -1
- package/dist/dsp/MelSpectrogram.js +31 -34
- package/dist/dsp/MelSpectrogram.js.map +1 -1
- package/dist/dsp/Rubberband.d.ts.map +1 -1
- package/dist/dsp/Rubberband.js +8 -3
- package/dist/dsp/Rubberband.js.map +1 -1
- package/dist/dsp/Sonic.d.ts.map +1 -1
- package/dist/dsp/Sonic.js +1 -1
- package/dist/dsp/Sonic.js.map +1 -1
- package/dist/dsp/SpeexResampler.d.ts.map +1 -1
- package/dist/dsp/SpeexResampler.js +1 -1
- package/dist/dsp/SpeexResampler.js.map +1 -1
- package/dist/encodings/Ascii.d.ts +1 -1
- package/dist/encodings/Ascii.d.ts.map +1 -1
- package/dist/encodings/Base64.js.map +1 -1
- package/dist/encodings/Utf16.d.ts.map +1 -1
- package/dist/encodings/Utf8.d.ts.map +1 -1
- package/dist/math/VectorMath.d.ts +1 -0
- package/dist/math/VectorMath.d.ts.map +1 -1
- package/dist/math/VectorMath.js +9 -5
- package/dist/math/VectorMath.js.map +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts.map +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts.map +1 -1
- package/dist/nlp/EspeakPhonemizer.js +2 -2
- package/dist/nlp/EspeakPhonemizer.js.map +1 -1
- package/dist/nlp/IPA.d.ts +2 -2
- package/dist/nlp/Segmentation.d.ts +1 -1
- package/dist/nlp/Segmentation.d.ts.map +1 -1
- package/dist/nlp/Segmentation.js +8 -4
- package/dist/nlp/Segmentation.js.map +1 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts +2 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts.map +1 -1
- package/dist/recognition/AmazonTranscribeSTT.js +3 -3
- package/dist/recognition/AmazonTranscribeSTT.js.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts +2 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.js +4 -4
- package/dist/recognition/AzureCognitiveServicesSTT.js.map +1 -1
- package/dist/recognition/DeepgramSTT.d.ts +2 -1
- package/dist/recognition/DeepgramSTT.d.ts.map +1 -1
- package/dist/recognition/DeepgramSTT.js +12 -13
- package/dist/recognition/DeepgramSTT.js.map +1 -1
- package/dist/recognition/GoogleCloudSTT.d.ts +2 -1
- package/dist/recognition/GoogleCloudSTT.d.ts.map +1 -1
- package/dist/recognition/GoogleCloudSTT.js +11 -10
- package/dist/recognition/GoogleCloudSTT.js.map +1 -1
- package/dist/recognition/OpenAICloudSTT.d.ts +2 -1
- package/dist/recognition/OpenAICloudSTT.d.ts.map +1 -1
- package/dist/recognition/OpenAICloudSTT.js +6 -6
- package/dist/recognition/OpenAICloudSTT.js.map +1 -1
- package/dist/recognition/WhisperCommon.d.ts +9 -0
- package/dist/recognition/WhisperCommon.d.ts.map +1 -0
- package/dist/recognition/WhisperCommon.js +52 -0
- package/dist/recognition/WhisperCommon.js.map +1 -0
- package/dist/recognition/{WhisperCppSTT.d.ts → WhisperCppCliSTT.d.ts} +14 -16
- package/dist/recognition/WhisperCppCliSTT.d.ts.map +1 -0
- package/dist/recognition/{WhisperCppSTT.js → WhisperCppCliSTT.js} +55 -84
- package/dist/recognition/WhisperCppCliSTT.js.map +1 -0
- package/dist/recognition/WhisperSTT.d.ts +72 -85
- package/dist/recognition/WhisperSTT.d.ts.map +1 -1
- package/dist/recognition/WhisperSTT.js +384 -519
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/server/Client.d.ts +2 -2
- package/dist/server/Client.d.ts.map +1 -1
- package/dist/server/Client.js.map +1 -1
- package/dist/server/Worker.d.ts +6 -7
- package/dist/server/Worker.d.ts.map +1 -1
- package/dist/server/Worker.js +42 -44
- package/dist/server/Worker.js.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.d.ts +3 -2
- package/dist/source-separation/MDXNetSourceSeparation.d.ts.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.js +10 -8
- package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts +3 -2
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js +5 -5
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts +5 -3
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.js +8 -8
- package/dist/speech-language-detection/SileroLanguageDetection.js.map +1 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts +2 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts.map +1 -1
- package/dist/speech-search/DTWSpeechSearch.js +4 -4
- package/dist/speech-search/DTWSpeechSearch.js.map +1 -1
- package/dist/subtitles/Subtitles.d.ts +13 -1
- package/dist/subtitles/Subtitles.d.ts.map +1 -1
- package/dist/subtitles/Subtitles.js +22 -22
- package/dist/subtitles/Subtitles.js.map +1 -1
- package/dist/synthesis/AwsPollyTTS.d.ts +3 -2
- package/dist/synthesis/AwsPollyTTS.d.ts.map +1 -1
- package/dist/synthesis/AwsPollyTTS.js +5 -5
- package/dist/synthesis/AwsPollyTTS.js.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts +2 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.js +3 -3
- package/dist/synthesis/AzureCognitiveServicesTTS.js.map +1 -1
- package/dist/synthesis/CoquiServerTTS.d.ts +2 -1
- package/dist/synthesis/CoquiServerTTS.d.ts.map +1 -1
- package/dist/synthesis/CoquiServerTTS.js +7 -8
- package/dist/synthesis/CoquiServerTTS.js.map +1 -1
- package/dist/synthesis/DeepgramTTS.d.ts +2 -2
- package/dist/synthesis/DeepgramTTS.d.ts.map +1 -1
- package/dist/synthesis/DeepgramTTS.js +13 -13
- package/dist/synthesis/DeepgramTTS.js.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.d.ts +3 -3
- package/dist/synthesis/ElevenLabsTTS.d.ts.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.js +22 -21
- package/dist/synthesis/ElevenLabsTTS.js.map +1 -1
- package/dist/synthesis/EspeakTTS.d.ts +11 -9
- package/dist/synthesis/EspeakTTS.d.ts.map +1 -1
- package/dist/synthesis/EspeakTTS.js +118 -68
- package/dist/synthesis/EspeakTTS.js.map +1 -1
- package/dist/synthesis/FliteTTS.d.ts +2 -2
- package/dist/synthesis/FliteTTS.d.ts.map +1 -1
- package/dist/synthesis/FliteTTS.js +2 -2
- package/dist/synthesis/FliteTTS.js.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.d.ts +2 -2
- package/dist/synthesis/GnuSpeechTTS.d.ts.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.js +1 -1
- package/dist/synthesis/GnuSpeechTTS.js.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.d.ts +3 -2
- package/dist/synthesis/GoogleCloudTTS.d.ts.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.js +15 -14
- package/dist/synthesis/GoogleCloudTTS.js.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.d.ts +3 -2
- package/dist/synthesis/GoogleTranslateTTS.d.ts.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.js +11 -11
- package/dist/synthesis/GoogleTranslateTTS.js.map +1 -1
- package/dist/synthesis/KokoroTTS.d.ts +4 -4
- package/dist/synthesis/KokoroTTS.d.ts.map +1 -1
- package/dist/synthesis/KokoroTTS.js +11 -10
- package/dist/synthesis/KokoroTTS.js.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts +4 -3
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.js +41 -20
- package/dist/synthesis/MicrosoftEdgeTTS.js.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.d.ts +2 -2
- package/dist/synthesis/OpenAICloudTTS.d.ts.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.js +6 -5
- package/dist/synthesis/OpenAICloudTTS.js.map +1 -1
- package/dist/synthesis/SamTTS.d.ts +2 -1
- package/dist/synthesis/SamTTS.d.ts.map +1 -1
- package/dist/synthesis/SamTTS.js +2 -2
- package/dist/synthesis/SamTTS.js.map +1 -1
- package/dist/synthesis/SapiTTS.d.ts +2 -2
- package/dist/synthesis/SapiTTS.d.ts.map +1 -1
- package/dist/synthesis/SapiTTS.js +2 -2
- package/dist/synthesis/SapiTTS.js.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.d.ts +2 -2
- package/dist/synthesis/SvoxPicoTTS.d.ts.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.js +3 -3
- package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
- package/dist/synthesis/VitsTTS.d.ts +3 -3
- package/dist/synthesis/VitsTTS.d.ts.map +1 -1
- package/dist/synthesis/VitsTTS.js +14 -11
- package/dist/synthesis/VitsTTS.js.map +1 -1
- package/dist/text-translation/DeepLTextTranslation.d.ts +2 -2
- package/dist/text-translation/DeepLTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/DeepLTextTranslation.js +10 -9
- package/dist/text-translation/DeepLTextTranslation.js.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts +4 -4
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.js +20 -18
- package/dist/text-translation/GoogleTranslateTextTranslation.js.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.d.ts +2 -2
- package/dist/text-translation/NLLBTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.js +4 -6
- package/dist/text-translation/NLLBTextTranslation.js.map +1 -1
- package/dist/typings/TypedArray.d.ts.map +1 -1
- package/dist/utilities/Compression.d.ts +4 -3
- package/dist/utilities/Compression.d.ts.map +1 -1
- package/dist/utilities/Compression.js +9 -9
- package/dist/utilities/Compression.js.map +1 -1
- package/dist/utilities/FileDownloader.d.ts +6 -3
- package/dist/utilities/FileDownloader.d.ts.map +1 -1
- package/dist/utilities/FileDownloader.js +25 -21
- package/dist/utilities/FileDownloader.js.map +1 -1
- package/dist/utilities/FileReader.d.ts.map +1 -1
- package/dist/utilities/FileReader.js.map +1 -1
- package/dist/utilities/FileSystem.js +1 -1
- package/dist/utilities/FileSystem.js.map +1 -1
- package/dist/utilities/FileWriter.d.ts.map +1 -1
- package/dist/utilities/FileWriter.js.map +1 -1
- package/dist/utilities/Hashing.d.ts.map +1 -1
- package/dist/utilities/Hashing.js.map +1 -1
- package/dist/utilities/Locale.js.map +1 -1
- package/dist/utilities/Logger.d.ts +17 -9
- package/dist/utilities/Logger.d.ts.map +1 -1
- package/dist/utilities/Logger.js +50 -35
- package/dist/utilities/Logger.js.map +1 -1
- package/dist/utilities/NpmUtilities.d.ts.map +1 -1
- package/dist/utilities/NpmUtilities.js +4 -5
- package/dist/utilities/NpmUtilities.js.map +1 -1
- package/dist/utilities/ObjectUtilities.js.map +1 -1
- package/dist/utilities/OpenPromise.d.ts.map +1 -1
- package/dist/utilities/OpenPromise.js.map +1 -1
- package/dist/utilities/PackageManager.d.ts +4 -1
- package/dist/utilities/PackageManager.d.ts.map +1 -1
- package/dist/utilities/PackageManager.js +37 -22
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/PathUtilities.d.ts +2 -0
- package/dist/utilities/PathUtilities.d.ts.map +1 -1
- package/dist/utilities/PathUtilities.js +5 -2
- package/dist/utilities/PathUtilities.js.map +1 -1
- package/dist/utilities/RandomGenerator.d.ts.map +1 -1
- package/dist/utilities/SignalChannel.d.ts.map +1 -1
- package/dist/utilities/SmoothEstimator.d.ts.map +1 -1
- package/dist/utilities/SmoothEstimator.js.map +1 -1
- package/dist/utilities/StringBuilder.d.ts.map +1 -1
- package/dist/utilities/TarballMaker.d.ts +4 -3
- package/dist/utilities/TarballMaker.d.ts.map +1 -1
- package/dist/utilities/TarballMaker.js +6 -6
- package/dist/utilities/TarballMaker.js.map +1 -1
- package/dist/utilities/Timeline.js.map +1 -1
- package/dist/utilities/Timer.d.ts.map +1 -1
- package/dist/utilities/Utilities.d.ts +9 -7
- package/dist/utilities/Utilities.d.ts.map +1 -1
- package/dist/utilities/Utilities.js +49 -33
- package/dist/utilities/Utilities.js.map +1 -1
- package/dist/utilities/VirtualFileReadStream.d.ts.map +1 -1
- package/dist/utilities/WebReader.d.ts +2 -1
- package/dist/utilities/WebReader.d.ts.map +1 -1
- package/dist/utilities/WebReader.js +7 -6
- package/dist/utilities/WebReader.js.map +1 -1
- package/dist/utilities/WikipediaReader.d.ts +2 -1
- package/dist/utilities/WikipediaReader.d.ts.map +1 -1
- package/dist/utilities/WikipediaReader.js +1 -5
- package/dist/utilities/WikipediaReader.js.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts +2 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.js +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.js.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js.map +1 -1
- package/docs/API.md +62 -17
- package/docs/CUDA.md +4 -3
- package/docs/Engines.md +8 -7
- package/docs/Licenses.md +0 -3
- package/docs/Options.md +27 -31
- package/docs/Server.md +1 -0
- package/docs/Tasklist.md +2 -1
- package/docs/Technical.md +2 -2
- package/package.json +45 -35
- package/src/alignment/SemanticTextAlignment.ts +14 -7
- package/src/alignment/SpeechAlignment.ts +47 -150
- package/src/api/APIOptions.ts +1 -1
- package/src/api/Alignment.ts +95 -61
- package/src/api/Common.ts +11 -0
- package/src/api/Denoising.ts +22 -17
- package/src/api/GlobalOptions.ts +4 -20
- package/src/api/Recognition.ts +106 -123
- package/src/api/SourceSeparation.ts +39 -21
- package/src/api/SpeechLanguageDetection.ts +77 -37
- package/src/api/SpeechSearch.ts +6 -1
- package/src/api/SpeechTranslation.ts +75 -38
- package/src/api/Synthesis.ts +220 -116
- package/src/api/TextLanguageDetection.ts +10 -12
- package/src/api/TextTranslation.ts +43 -26
- package/src/api/TimelineTranslationAlignment.ts +41 -13
- package/src/api/TranscriptAndTranslationAlignment.ts +28 -15
- package/src/api/TranslationAlignment.ts +53 -24
- package/src/api/VoiceActivityDetection.ts +33 -68
- package/src/audio/AudioPlayer.ts +4 -232
- package/src/audio/AudioUtilities.ts +9 -2
- package/src/build-tools/MakeTarballsForInstalledPackages.ts +4 -3
- package/src/cli/CLI.ts +209 -101
- package/src/codecs/FFMpegTranscoder.ts +18 -16
- package/src/denoising/NSNet2.ts +5 -4
- package/src/denoising/RNNoise.ts +14 -6
- package/src/dsp/FFT.ts +2 -1
- package/src/dsp/MFCC.ts +7 -5
- package/src/dsp/MelSpectrogram.ts +56 -36
- package/src/dsp/Rubberband.ts +10 -3
- package/src/dsp/Sonic.ts +2 -1
- package/src/dsp/SpeexResampler.ts +2 -1
- package/src/encodings/Ascii.ts +1 -1
- package/src/encodings/Base64.ts +1 -1
- package/src/math/VectorMath.ts +10 -6
- package/src/nlp/EspeakPhonemizer.ts +2 -2
- package/src/nlp/Segmentation.ts +9 -4
- package/src/recognition/AmazonTranscribeSTT.ts +4 -3
- package/src/recognition/AzureCognitiveServicesSTT.ts +5 -4
- package/src/recognition/DeepgramSTT.ts +16 -16
- package/src/recognition/GoogleCloudSTT.ts +14 -12
- package/src/recognition/OpenAICloudSTT.ts +12 -6
- package/src/recognition/WhisperCommon.ts +130 -0
- package/src/recognition/{WhisperCppSTT.ts → WhisperCppCliSTT.ts} +73 -133
- package/src/recognition/WhisperSTT.ts +569 -718
- package/src/server/Client.ts +4 -4
- package/src/server/Worker.ts +59 -59
- package/src/source-separation/MDXNetSourceSeparation.ts +15 -10
- package/src/speech-embeddings/WavToVec2BertFeatureEmbeddings.ts +7 -5
- package/src/speech-language-detection/SileroLanguageDetection.ts +18 -9
- package/src/speech-search/DTWSpeechSearch.ts +6 -5
- package/src/subtitles/Subtitles.ts +22 -22
- package/src/synthesis/AwsPollyTTS.ts +12 -5
- package/src/synthesis/AzureCognitiveServicesTTS.ts +11 -3
- package/src/synthesis/CoquiServerTTS.ts +8 -7
- package/src/synthesis/DeepgramTTS.ts +21 -15
- package/src/synthesis/ElevenLabsTTS.ts +33 -23
- package/src/synthesis/EspeakTTS.ts +145 -69
- package/src/synthesis/FliteTTS.ts +3 -3
- package/src/synthesis/GnuSpeechTTS.ts +2 -2
- package/src/synthesis/GoogleCloudTTS.ts +23 -14
- package/src/synthesis/GoogleTranslateTTS.ts +19 -11
- package/src/synthesis/KokoroTTS.ts +37 -14
- package/src/synthesis/MicrosoftEdgeTTS.ts +71 -23
- package/src/synthesis/OpenAICloudTTS.ts +7 -6
- package/src/synthesis/SamTTS.ts +3 -2
- package/src/synthesis/SapiTTS.ts +3 -3
- package/src/synthesis/SvoxPicoTTS.ts +4 -5
- package/src/synthesis/VitsTTS.ts +43 -15
- package/src/text-translation/DeepLTextTranslation.ts +12 -10
- package/src/text-translation/GoogleTranslateTextTranslation.ts +35 -21
- package/src/text-translation/NLLBTextTranslation.ts +5 -9
- package/src/typings/Fillers.d.ts +0 -60
- package/src/typings/TypedArray.ts +12 -1
- package/src/utilities/Compression.ts +10 -9
- package/src/utilities/FileDownloader.ts +38 -23
- package/src/utilities/FileSystem.ts +1 -1
- package/src/utilities/Logger.ts +59 -42
- package/src/utilities/NpmUtilities.ts +4 -6
- package/src/utilities/OpenPromise.ts +1 -2
- package/src/utilities/PackageManager.ts +53 -26
- package/src/utilities/PathUtilities.ts +6 -2
- package/src/utilities/TarballMaker.ts +7 -7
- package/src/utilities/Utilities.ts +58 -41
- package/src/utilities/WebReader.ts +11 -6
- package/src/utilities/WikipediaReader.ts +2 -8
- package/src/voice-activity-detection/AdaptiveGateVAD.ts +13 -8
- package/src/voice-activity-detection/WebRtcVAD.ts +1 -2
- package/tsconfig.json +53 -54
- package/dist/audio/AudioRecorder.d.ts +0 -4
- package/dist/audio/AudioRecorder.d.ts.map +0 -1
- package/dist/audio/AudioRecorder.js +0 -68
- package/dist/audio/AudioRecorder.js.map +0 -1
- package/dist/audio/SoxPath.d.ts +0 -2
- package/dist/audio/SoxPath.d.ts.map +0 -1
- package/dist/audio/SoxPath.js +0 -24
- package/dist/audio/SoxPath.js.map +0 -1
- package/dist/recognition/SileroSTT.d.ts +0 -30
- package/dist/recognition/SileroSTT.d.ts.map +0 -1
- package/dist/recognition/SileroSTT.js +0 -152
- package/dist/recognition/SileroSTT.js.map +0 -1
- package/dist/recognition/VoskSTT.d.ts +0 -11
- package/dist/recognition/VoskSTT.d.ts.map +0 -1
- package/dist/recognition/VoskSTT.js +0 -72
- package/dist/recognition/VoskSTT.js.map +0 -1
- package/dist/recognition/WhisperCppSTT.d.ts.map +0 -1
- package/dist/recognition/WhisperCppSTT.js.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.d.ts +0 -12
- package/dist/synthesis/StreamlabsPollyTTS.d.ts.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.js +0 -88
- package/dist/synthesis/StreamlabsPollyTTS.js.map +0 -1
- package/dist/utilities/BinaryUtilities.d.ts +0 -14
- package/dist/utilities/BinaryUtilities.d.ts.map +0 -1
- package/dist/utilities/BinaryUtilities.js +0 -113
- package/dist/utilities/BinaryUtilities.js.map +0 -1
- package/src/audio/AudioRecorder.ts +0 -91
- package/src/audio/SoxPath.ts +0 -31
- package/src/recognition/SileroSTT.ts +0 -222
- package/src/recognition/VoskSTT.ts +0 -112
- package/src/synthesis/StreamlabsPollyTTS.ts +0 -114
- package/src/utilities/BinaryUtilities.ts +0 -138
- /package/{LICENSE.md → LICENSE.GPLv3.md} +0 -0
package/src/cli/CLI.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { ParsedConfigFile, parseConfigFile, parseJSONConfigFile } from './CLICon
|
|
|
7
7
|
import chalk from 'chalk'
|
|
8
8
|
import { RawAudio, applyGainDecibels, encodeRawAudioToWave, getEmptyRawAudio, getRawAudioDuration, normalizeAudioLevel, sliceRawAudioByTime } from '../audio/AudioUtilities.js'
|
|
9
9
|
import { SubtitlesConfig, subtitlesToText, timelineToSubtitles } from '../subtitles/Subtitles.js'
|
|
10
|
-
import { Logger
|
|
10
|
+
import { Logger } from '../utilities/Logger.js'
|
|
11
11
|
import { isMainThread, parentPort } from 'node:worker_threads'
|
|
12
12
|
import { encodeFromChannels, getDefaultFFMpegOptionsForSpeech } from '../codecs/FFMpegTranscoder.js'
|
|
13
13
|
import { splitToParagraphs, splitToWords } from '../nlp/Segmentation.js'
|
|
@@ -17,7 +17,7 @@ import { Timeline, TimelineEntry, addTimeOffsetToTimeline, addWordTextOffsetsToT
|
|
|
17
17
|
import { ensureDir, existsSync, readAndParseJsonFile, readdir, readFileAsUtf8, writeFileSafe } from '../utilities/FileSystem.js'
|
|
18
18
|
import { formatLanguageCodeWithName, getShortLanguageCode } from '../utilities/Locale.js'
|
|
19
19
|
import { APIOptions } from '../api/APIOptions.js'
|
|
20
|
-
import { ensureAndGetPackagesDir, getVersionTagFromPackageName, loadPackage, resolveVersionTagForUnversionedPackageName } from '../utilities/PackageManager.js'
|
|
20
|
+
import { ensureAndGetPackagesDir, getVersionTagFromPackageName, loadPackage, LoadPackageCallbacks, resolveVersionTagForUnversionedPackageName } from '../utilities/PackageManager.js'
|
|
21
21
|
import { removePackage } from '../utilities/PackageManager.js'
|
|
22
22
|
import { appName } from '../api/Common.js'
|
|
23
23
|
import { ServerOptions, startServer } from '../server/Server.js'
|
|
@@ -26,8 +26,6 @@ import { getDirName, getFileNameWithoutExtension, getLowercaseFileExtension, joi
|
|
|
26
26
|
import { CLIOptions, CLIOptionsKeys } from './CLIOptions.js'
|
|
27
27
|
import { convertHtmlToText, formatIntegerWithLeadingZeros, formatListWithQuotedElements } from '../utilities/StringUtilities.js'
|
|
28
28
|
|
|
29
|
-
//const log = logToStderr
|
|
30
|
-
|
|
31
29
|
async function startIfInWorkerThread() {
|
|
32
30
|
if (isMainThread || !parentPort) {
|
|
33
31
|
return
|
|
@@ -67,7 +65,7 @@ type CLIOperationData = {
|
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
export async function start(processArgs: string[]) {
|
|
70
|
-
const logger = new Logger()
|
|
68
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
71
69
|
|
|
72
70
|
const operationData: CLIOperationData = {
|
|
73
71
|
operation: '',
|
|
@@ -80,10 +78,6 @@ export async function start(processArgs: string[]) {
|
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
try {
|
|
83
|
-
const packageData = await readAndParseJsonFile(resolveToModuleRootDir('package.json'))
|
|
84
|
-
|
|
85
|
-
logger.log(chalk.magentaBright(`Echogarden v${packageData.version}\n`))
|
|
86
|
-
|
|
87
81
|
const operation = processArgs[0]
|
|
88
82
|
|
|
89
83
|
if (!operation || operation == 'help') {
|
|
@@ -110,11 +104,14 @@ export async function start(processArgs: string[]) {
|
|
|
110
104
|
if (!parsedArgumentsLookup.has('config')) {
|
|
111
105
|
const defaultConfigFile = `./${appName}.config`
|
|
112
106
|
const defaultJsonConfigFile = defaultConfigFile + '.json'
|
|
107
|
+
const defaultJson5ConfigFile = defaultConfigFile + '.json5'
|
|
113
108
|
|
|
114
109
|
if (existsSync(defaultConfigFile)) {
|
|
115
110
|
parsedArgumentsLookup.set('config', defaultConfigFile)
|
|
116
111
|
} else if (existsSync(defaultJsonConfigFile)) {
|
|
117
112
|
parsedArgumentsLookup.set('config', defaultJsonConfigFile)
|
|
113
|
+
} else if (existsSync(defaultJson5ConfigFile)) {
|
|
114
|
+
parsedArgumentsLookup.set('config', defaultJsonConfigFile)
|
|
118
115
|
}
|
|
119
116
|
}
|
|
120
117
|
|
|
@@ -126,10 +123,10 @@ export async function start(processArgs: string[]) {
|
|
|
126
123
|
|
|
127
124
|
if (configFilePath.endsWith('.config')) {
|
|
128
125
|
parsedConfigFile = await parseConfigFile(configFilePath)
|
|
129
|
-
} else if (configFilePath.endsWith('.config.json')) {
|
|
126
|
+
} else if (configFilePath.endsWith('.config.json') || configFilePath.endsWith('.config.json5')) {
|
|
130
127
|
parsedConfigFile = await parseJSONConfigFile(configFilePath)
|
|
131
128
|
} else {
|
|
132
|
-
throw new Error(`Specified config file '${configFilePath}' doesn't have a supported extension. Should be either '.config' or '.config.
|
|
129
|
+
throw new Error(`Specified config file '${configFilePath}' doesn't have a supported extension. Should be either '.config', '.config.json', or '.config.json5'`)
|
|
133
130
|
}
|
|
134
131
|
|
|
135
132
|
let sectionName = operation
|
|
@@ -177,9 +174,8 @@ export async function start(processArgs: string[]) {
|
|
|
177
174
|
operationData.cliOptions = await optionsLookupToTypedObject(cliOptionsLookup, 'CLIOptions')
|
|
178
175
|
operationData.operationOptionsLookup = operationsOptionsLookup
|
|
179
176
|
} catch (e: any) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
logger.logTitledMessage(`Error`, e.message, chalk.redBright, 'error')
|
|
177
|
+
logger.logTitledMessage(`Error`, e.message, 'error')
|
|
178
|
+
|
|
183
179
|
process.exit(1)
|
|
184
180
|
}
|
|
185
181
|
|
|
@@ -194,12 +190,10 @@ export async function start(processArgs: string[]) {
|
|
|
194
190
|
try {
|
|
195
191
|
await startWithArgs(operationData)
|
|
196
192
|
} catch (e: any) {
|
|
197
|
-
resetActiveLogger()
|
|
198
|
-
|
|
199
193
|
if (debugMode) {
|
|
200
194
|
logger.log(e, 'error')
|
|
201
195
|
} else {
|
|
202
|
-
logger.logTitledMessage(`Error`, e.message,
|
|
196
|
+
logger.logTitledMessage(`Error`, e.message, 'error')
|
|
203
197
|
}
|
|
204
198
|
|
|
205
199
|
process.exit(1)
|
|
@@ -259,7 +253,10 @@ const help = [
|
|
|
259
253
|
]
|
|
260
254
|
|
|
261
255
|
async function startWithArgs(operationData: CLIOperationData) {
|
|
262
|
-
const logger = new Logger()
|
|
256
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
257
|
+
|
|
258
|
+
const packageData = await readAndParseJsonFile(resolveToModuleRootDir('package.json'))
|
|
259
|
+
logger.log(chalk.magentaBright(`Echogarden v${packageData.version}\n`))
|
|
263
260
|
|
|
264
261
|
switch (operationData.operation) {
|
|
265
262
|
case 'speak':
|
|
@@ -366,14 +363,18 @@ async function startWithArgs(operationData: CLIOperationData) {
|
|
|
366
363
|
}
|
|
367
364
|
|
|
368
365
|
default: {
|
|
369
|
-
logger.logTitledMessage(`Unknown operation`, operationData.operation,
|
|
366
|
+
logger.logTitledMessage(`Unknown operation`, operationData.operation, 'error')
|
|
370
367
|
process.exit(1)
|
|
371
368
|
}
|
|
372
369
|
}
|
|
373
370
|
}
|
|
374
371
|
|
|
375
372
|
export async function speak(operationData: CLIOperationData) {
|
|
376
|
-
const logger = new Logger()
|
|
373
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
374
|
+
|
|
375
|
+
const callbacks: API.SynthesisCallbacks = {
|
|
376
|
+
logLevel: logger.logLevel
|
|
377
|
+
}
|
|
377
378
|
|
|
378
379
|
const { operationArgs, operation, operationOptionsLookup, cliOptions } = operationData
|
|
379
380
|
|
|
@@ -464,7 +465,7 @@ export async function speak(operationData: CLIOperationData) {
|
|
|
464
465
|
}
|
|
465
466
|
|
|
466
467
|
const { fetchDocumentText } = await import('../utilities/WebReader.js')
|
|
467
|
-
const textContent = await fetchDocumentText(url)
|
|
468
|
+
const textContent = await fetchDocumentText(url, { logLevel: API.getGlobalLogLevel() })
|
|
468
469
|
|
|
469
470
|
textSegments = splitToParagraphs(textContent, 'single', 'preserve')
|
|
470
471
|
} else if (operation == 'speak-wikipedia') {
|
|
@@ -472,22 +473,24 @@ export async function speak(operationData: CLIOperationData) {
|
|
|
472
473
|
throw new Error(`speak-wikipedia doesn't provide SSML inputs`)
|
|
473
474
|
}
|
|
474
475
|
|
|
475
|
-
const {
|
|
476
|
+
const { fetchAndParseWikipediaArticle } = await import('../utilities/WikipediaReader.js')
|
|
476
477
|
if (!options.language) {
|
|
477
478
|
options.language = 'en'
|
|
478
479
|
}
|
|
479
480
|
|
|
480
|
-
|
|
481
|
+
await logger.startAsync(`Fetching Wikipedia article '${mainArg}'`)
|
|
482
|
+
textSegments = await fetchAndParseWikipediaArticle(mainArg, getShortLanguageCode(options.language), callbacks)
|
|
483
|
+
logger.end()
|
|
481
484
|
} else {
|
|
482
485
|
throw new Error(`Invalid operation specified: '${operation}'`)
|
|
483
486
|
}
|
|
484
487
|
|
|
485
|
-
async function onSegment(segmentData: API.
|
|
488
|
+
async function onSegment(segmentData: API.SynthesisSegmentCallbackData) {
|
|
486
489
|
if (includesPlaceholderPattern) {
|
|
487
490
|
logger.start('Write output files for segment')
|
|
488
491
|
}
|
|
489
492
|
|
|
490
|
-
await writeOutputFilesForSegment(outputFilenames, segmentData.index, segmentData.total, segmentData.audio as RawAudio, segmentData.timeline, segmentData.transcript, segmentData.language, allowOverwrite)
|
|
493
|
+
await writeOutputFilesForSegment(outputFilenames, segmentData.index, segmentData.total, segmentData.audio as RawAudio, segmentData.timeline, segmentData.transcript, segmentData.language, allowOverwrite, callbacks)
|
|
491
494
|
|
|
492
495
|
logger.end()
|
|
493
496
|
|
|
@@ -506,7 +509,8 @@ export async function speak(operationData: CLIOperationData) {
|
|
|
506
509
|
options.outputAudioFormat!.codec = undefined
|
|
507
510
|
}
|
|
508
511
|
|
|
509
|
-
const { audio: synthesizedAudio, timeline } =
|
|
512
|
+
const { audio: synthesizedAudio, timeline } =
|
|
513
|
+
await API.synthesize(textSegments, options, { ...callbacks, onSegment })
|
|
510
514
|
|
|
511
515
|
if (plainText) {
|
|
512
516
|
addWordTextOffsetsToTimelineInPlace(timeline, plainText)
|
|
@@ -521,7 +525,7 @@ export async function speak(operationData: CLIOperationData) {
|
|
|
521
525
|
continue
|
|
522
526
|
}
|
|
523
527
|
|
|
524
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite)
|
|
528
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks)
|
|
525
529
|
await fileSaver(synthesizedAudio as RawAudio, timeline, textSegments.join('\n\n'), options.subtitles)
|
|
526
530
|
}
|
|
527
531
|
|
|
@@ -529,7 +533,7 @@ export async function speak(operationData: CLIOperationData) {
|
|
|
529
533
|
}
|
|
530
534
|
|
|
531
535
|
export async function transcribe(operationData: CLIOperationData) {
|
|
532
|
-
const logger = new Logger()
|
|
536
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
533
537
|
|
|
534
538
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData
|
|
535
539
|
|
|
@@ -553,7 +557,20 @@ export async function transcribe(operationData: CLIOperationData) {
|
|
|
553
557
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault)
|
|
554
558
|
const { includesPlaceholderPattern } = await checkOutputFilenames(outputFilenames, true, true, true)
|
|
555
559
|
|
|
556
|
-
const
|
|
560
|
+
const callbacks: API.RecognitionCallbacks = { logLevel: logger.logLevel }
|
|
561
|
+
|
|
562
|
+
const {
|
|
563
|
+
transcript,
|
|
564
|
+
timeline,
|
|
565
|
+
wordTimeline,
|
|
566
|
+
language,
|
|
567
|
+
inputRawAudio,
|
|
568
|
+
isolatedRawAudio,
|
|
569
|
+
backgroundRawAudio } = await API.recognize(
|
|
570
|
+
sourceFilename,
|
|
571
|
+
options,
|
|
572
|
+
callbacks,
|
|
573
|
+
)
|
|
557
574
|
|
|
558
575
|
if (outputFilenames.length > 0) {
|
|
559
576
|
logger.start('\nWrite output files')
|
|
@@ -564,11 +581,11 @@ export async function transcribe(operationData: CLIOperationData) {
|
|
|
564
581
|
continue
|
|
565
582
|
}
|
|
566
583
|
|
|
567
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite)
|
|
584
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks)
|
|
568
585
|
|
|
569
586
|
await fileSaver(inputRawAudio, timeline, transcript, options.subtitles)
|
|
570
587
|
|
|
571
|
-
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true)
|
|
588
|
+
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true, callbacks)
|
|
572
589
|
}
|
|
573
590
|
|
|
574
591
|
logger.end()
|
|
@@ -589,7 +606,7 @@ export async function transcribe(operationData: CLIOperationData) {
|
|
|
589
606
|
}
|
|
590
607
|
|
|
591
608
|
export async function align(operationData: CLIOperationData) {
|
|
592
|
-
const logger = new Logger()
|
|
609
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
593
610
|
|
|
594
611
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData
|
|
595
612
|
|
|
@@ -637,7 +654,23 @@ export async function align(operationData: CLIOperationData) {
|
|
|
637
654
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault)
|
|
638
655
|
const { includesPlaceholderPattern } = await checkOutputFilenames(outputFilenames, true, true, true)
|
|
639
656
|
|
|
640
|
-
const
|
|
657
|
+
const callbacks: API.AlignmentCallbacks = {
|
|
658
|
+
logLevel: logger.logLevel
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
const {
|
|
662
|
+
timeline,
|
|
663
|
+
wordTimeline,
|
|
664
|
+
transcript,
|
|
665
|
+
language,
|
|
666
|
+
inputRawAudio,
|
|
667
|
+
isolatedRawAudio,
|
|
668
|
+
backgroundRawAudio } = await API.align(
|
|
669
|
+
audioFilename,
|
|
670
|
+
text,
|
|
671
|
+
options,
|
|
672
|
+
callbacks,
|
|
673
|
+
)
|
|
641
674
|
|
|
642
675
|
if (outputFilenames.length > 0) {
|
|
643
676
|
logger.start('\nWrite output files')
|
|
@@ -649,7 +682,7 @@ export async function align(operationData: CLIOperationData) {
|
|
|
649
682
|
const segmentAudio = sliceRawAudioByTime(inputRawAudio, segmentEntry.startTime, segmentEntry.endTime)
|
|
650
683
|
const sentenceTimeline = addTimeOffsetToTimeline(segmentEntry.timeline!, -segmentEntry.startTime)
|
|
651
684
|
|
|
652
|
-
await writeOutputFilesForSegment(outputFilenames, segmentIndex, timeline.length, segmentAudio, sentenceTimeline, segmentEntry.text, language, allowOverwrite)
|
|
685
|
+
await writeOutputFilesForSegment(outputFilenames, segmentIndex, timeline.length, segmentAudio, sentenceTimeline, segmentEntry.text, language, allowOverwrite, callbacks)
|
|
653
686
|
}
|
|
654
687
|
}
|
|
655
688
|
|
|
@@ -658,11 +691,11 @@ export async function align(operationData: CLIOperationData) {
|
|
|
658
691
|
continue
|
|
659
692
|
}
|
|
660
693
|
|
|
661
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite)
|
|
694
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks)
|
|
662
695
|
|
|
663
696
|
await fileSaver(inputRawAudio, timeline, transcript, options.subtitles)
|
|
664
697
|
|
|
665
|
-
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true)
|
|
698
|
+
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true, callbacks)
|
|
666
699
|
}
|
|
667
700
|
|
|
668
701
|
logger.end()
|
|
@@ -683,7 +716,7 @@ export async function align(operationData: CLIOperationData) {
|
|
|
683
716
|
}
|
|
684
717
|
|
|
685
718
|
export async function alignTranslation(operationData: CLIOperationData) {
|
|
686
|
-
const logger = new Logger()
|
|
719
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
687
720
|
|
|
688
721
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData
|
|
689
722
|
|
|
@@ -732,6 +765,10 @@ export async function alignTranslation(operationData: CLIOperationData) {
|
|
|
732
765
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault)
|
|
733
766
|
const { includesPlaceholderPattern } = await checkOutputFilenames(outputFilenames, true, true, true)
|
|
734
767
|
|
|
768
|
+
const callbacks: API.TranslationAlignmentCallbacks = {
|
|
769
|
+
logLevel: logger.logLevel
|
|
770
|
+
}
|
|
771
|
+
|
|
735
772
|
const {
|
|
736
773
|
timeline,
|
|
737
774
|
wordTimeline,
|
|
@@ -740,7 +777,7 @@ export async function alignTranslation(operationData: CLIOperationData) {
|
|
|
740
777
|
targetLanguage,
|
|
741
778
|
inputRawAudio,
|
|
742
779
|
isolatedRawAudio,
|
|
743
|
-
backgroundRawAudio } = await API.alignTranslation(audioFilename, text, options)
|
|
780
|
+
backgroundRawAudio } = await API.alignTranslation(audioFilename, text, options, callbacks)
|
|
744
781
|
|
|
745
782
|
if (outputFilenames.length > 0) {
|
|
746
783
|
logger.start('\nWrite output files')
|
|
@@ -752,7 +789,7 @@ export async function alignTranslation(operationData: CLIOperationData) {
|
|
|
752
789
|
const segmentAudio = sliceRawAudioByTime(inputRawAudio, segmentEntry.startTime, segmentEntry.endTime)
|
|
753
790
|
const sentenceTimeline = addTimeOffsetToTimeline(segmentEntry.timeline!, -segmentEntry.startTime)
|
|
754
791
|
|
|
755
|
-
await writeOutputFilesForSegment(outputFilenames, segmentIndex, timeline.length, segmentAudio, sentenceTimeline, segmentEntry.text, targetLanguage, allowOverwrite)
|
|
792
|
+
await writeOutputFilesForSegment(outputFilenames, segmentIndex, timeline.length, segmentAudio, sentenceTimeline, segmentEntry.text, targetLanguage, allowOverwrite, callbacks)
|
|
756
793
|
}
|
|
757
794
|
}
|
|
758
795
|
|
|
@@ -761,11 +798,11 @@ export async function alignTranslation(operationData: CLIOperationData) {
|
|
|
761
798
|
continue
|
|
762
799
|
}
|
|
763
800
|
|
|
764
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite)
|
|
801
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks)
|
|
765
802
|
|
|
766
803
|
await fileSaver(inputRawAudio, timeline, translatedTranscript, options.subtitles)
|
|
767
804
|
|
|
768
|
-
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true)
|
|
805
|
+
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true, callbacks)
|
|
769
806
|
}
|
|
770
807
|
|
|
771
808
|
logger.end()
|
|
@@ -786,7 +823,7 @@ export async function alignTranslation(operationData: CLIOperationData) {
|
|
|
786
823
|
}
|
|
787
824
|
|
|
788
825
|
export async function alignTranscriptAndTranslation(operationData: CLIOperationData) {
|
|
789
|
-
const logger = new Logger()
|
|
826
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
790
827
|
|
|
791
828
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData
|
|
792
829
|
|
|
@@ -865,6 +902,10 @@ export async function alignTranscriptAndTranslation(operationData: CLIOperationD
|
|
|
865
902
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault)
|
|
866
903
|
const { includesPlaceholderPattern } = await checkOutputFilenames(outputFilenames, true, true, true)
|
|
867
904
|
|
|
905
|
+
const callbacks: API.TranscriptAndTranslationAlignmentCallbacks = {
|
|
906
|
+
logLevel: logger.logLevel
|
|
907
|
+
}
|
|
908
|
+
|
|
868
909
|
const {
|
|
869
910
|
timeline,
|
|
870
911
|
wordTimeline,
|
|
@@ -877,7 +918,13 @@ export async function alignTranscriptAndTranslation(operationData: CLIOperationD
|
|
|
877
918
|
|
|
878
919
|
inputRawAudio,
|
|
879
920
|
isolatedRawAudio,
|
|
880
|
-
backgroundRawAudio } = await API.alignTranscriptAndTranslation(
|
|
921
|
+
backgroundRawAudio } = await API.alignTranscriptAndTranslation(
|
|
922
|
+
audioFilename,
|
|
923
|
+
transcript,
|
|
924
|
+
translatedTranscript,
|
|
925
|
+
options,
|
|
926
|
+
callbacks
|
|
927
|
+
)
|
|
881
928
|
|
|
882
929
|
if (outputFilenames.length > 0) {
|
|
883
930
|
logger.start('\nWrite output files')
|
|
@@ -888,11 +935,11 @@ export async function alignTranscriptAndTranslation(operationData: CLIOperationD
|
|
|
888
935
|
continue
|
|
889
936
|
}
|
|
890
937
|
|
|
891
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite)
|
|
938
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks)
|
|
892
939
|
|
|
893
940
|
await fileSaver(inputRawAudio, timeline, transcript, options.subtitles)
|
|
894
941
|
|
|
895
|
-
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true)
|
|
942
|
+
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true, callbacks)
|
|
896
943
|
|
|
897
944
|
const fileExtension = getLowercaseFileExtension(outputFilename)
|
|
898
945
|
|
|
@@ -900,7 +947,7 @@ export async function alignTranscriptAndTranslation(operationData: CLIOperationD
|
|
|
900
947
|
const pathWithoutExtension = outputFilename.substring(0, outputFilename.lastIndexOf('.'))
|
|
901
948
|
const translatedOutputPath = `${pathWithoutExtension}.translated.${fileExtension}`
|
|
902
949
|
|
|
903
|
-
const translatedFileSaver = getFileSaver(translatedOutputPath, allowOverwrite)
|
|
950
|
+
const translatedFileSaver = getFileSaver(translatedOutputPath, allowOverwrite, callbacks)
|
|
904
951
|
await translatedFileSaver(inputRawAudio, translatedTimeline, translatedTranscript, options.subtitles)
|
|
905
952
|
}
|
|
906
953
|
}
|
|
@@ -923,7 +970,7 @@ export async function alignTranscriptAndTranslation(operationData: CLIOperationD
|
|
|
923
970
|
}
|
|
924
971
|
|
|
925
972
|
export async function alignTimelineTranslation(operationData: CLIOperationData) {
|
|
926
|
-
const logger = new Logger()
|
|
973
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
927
974
|
|
|
928
975
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData
|
|
929
976
|
|
|
@@ -971,11 +1018,20 @@ export async function alignTimelineTranslation(operationData: CLIOperationData)
|
|
|
971
1018
|
|
|
972
1019
|
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'TimelineTranslationAlignmentOptions')
|
|
973
1020
|
|
|
1021
|
+
const callbacks: API.TimelineTranslationAlignmentCallbacks = {
|
|
1022
|
+
logLevel: logger.logLevel
|
|
1023
|
+
}
|
|
1024
|
+
|
|
974
1025
|
const {
|
|
975
1026
|
timeline: translationTimeline,
|
|
976
1027
|
wordTimeline: translationWordTimeline,
|
|
977
1028
|
rawAudio
|
|
978
|
-
} = await API.alignTimelineTranslation(
|
|
1029
|
+
} = await API.alignTimelineTranslation(
|
|
1030
|
+
timeline,
|
|
1031
|
+
translationText,
|
|
1032
|
+
options,
|
|
1033
|
+
callbacks,
|
|
1034
|
+
)
|
|
979
1035
|
|
|
980
1036
|
if (outputFilenames.length > 0) {
|
|
981
1037
|
logger.start('\nWrite output files')
|
|
@@ -988,7 +1044,7 @@ export async function alignTimelineTranslation(operationData: CLIOperationData)
|
|
|
988
1044
|
continue
|
|
989
1045
|
}
|
|
990
1046
|
|
|
991
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite)
|
|
1047
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks)
|
|
992
1048
|
|
|
993
1049
|
await fileSaver(getEmptyRawAudio(1, 16000), translationTimeline, translationText, options.subtitles)
|
|
994
1050
|
}
|
|
@@ -1009,7 +1065,7 @@ export async function alignTimelineTranslation(operationData: CLIOperationData)
|
|
|
1009
1065
|
}
|
|
1010
1066
|
|
|
1011
1067
|
export async function translateText(operationData: CLIOperationData) {
|
|
1012
|
-
const logger = new Logger()
|
|
1068
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
1013
1069
|
|
|
1014
1070
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData
|
|
1015
1071
|
|
|
@@ -1045,6 +1101,10 @@ export async function translateText(operationData: CLIOperationData) {
|
|
|
1045
1101
|
|
|
1046
1102
|
await checkOutputFilenames(outputFilenames, false, true, true)
|
|
1047
1103
|
|
|
1104
|
+
const callbacks: API.TextTranslationCallbacks = {
|
|
1105
|
+
logLevel: logger.logLevel
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1048
1108
|
const {
|
|
1049
1109
|
text,
|
|
1050
1110
|
translatedText,
|
|
@@ -1053,7 +1113,7 @@ export async function translateText(operationData: CLIOperationData) {
|
|
|
1053
1113
|
|
|
1054
1114
|
sourceLanguage,
|
|
1055
1115
|
targetLanguage,
|
|
1056
|
-
} = await API.translateText(inputText, options)
|
|
1116
|
+
} = await API.translateText(inputText, options, callbacks)
|
|
1057
1117
|
|
|
1058
1118
|
if (outputFilenames.length > 0) {
|
|
1059
1119
|
logger.start('\nWrite output files')
|
|
@@ -1063,7 +1123,7 @@ export async function translateText(operationData: CLIOperationData) {
|
|
|
1063
1123
|
continue
|
|
1064
1124
|
}
|
|
1065
1125
|
|
|
1066
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite)
|
|
1126
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks)
|
|
1067
1127
|
|
|
1068
1128
|
await fileSaver(getEmptyRawAudio(1, 16000), translationPairs as any as Timeline, translatedText, undefined)
|
|
1069
1129
|
}
|
|
@@ -1076,7 +1136,7 @@ export async function translateText(operationData: CLIOperationData) {
|
|
|
1076
1136
|
}
|
|
1077
1137
|
|
|
1078
1138
|
export async function translateSpeech(operationData: CLIOperationData) {
|
|
1079
|
-
const logger = new Logger()
|
|
1139
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
1080
1140
|
|
|
1081
1141
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData
|
|
1082
1142
|
|
|
@@ -1101,6 +1161,10 @@ export async function translateSpeech(operationData: CLIOperationData) {
|
|
|
1101
1161
|
|
|
1102
1162
|
await checkOutputFilenames(outputFilenames, true, true, true)
|
|
1103
1163
|
|
|
1164
|
+
const callbacks: API.SpeechTranslationCallbacks = {
|
|
1165
|
+
logLevel: logger.logLevel
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1104
1168
|
const {
|
|
1105
1169
|
transcript,
|
|
1106
1170
|
|
|
@@ -1113,7 +1177,7 @@ export async function translateSpeech(operationData: CLIOperationData) {
|
|
|
1113
1177
|
inputRawAudio,
|
|
1114
1178
|
isolatedRawAudio,
|
|
1115
1179
|
backgroundRawAudio
|
|
1116
|
-
} = await API.translateSpeech(inputFilename, options)
|
|
1180
|
+
} = await API.translateSpeech(inputFilename, options, callbacks)
|
|
1117
1181
|
|
|
1118
1182
|
if (outputFilenames.length > 0) {
|
|
1119
1183
|
logger.start('\nWrite output files')
|
|
@@ -1124,11 +1188,11 @@ export async function translateSpeech(operationData: CLIOperationData) {
|
|
|
1124
1188
|
continue
|
|
1125
1189
|
}
|
|
1126
1190
|
|
|
1127
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite)
|
|
1191
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks)
|
|
1128
1192
|
|
|
1129
1193
|
await fileSaver(inputRawAudio, timeline, transcript, options.subtitles)
|
|
1130
1194
|
|
|
1131
|
-
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true)
|
|
1195
|
+
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true, callbacks)
|
|
1132
1196
|
}
|
|
1133
1197
|
|
|
1134
1198
|
logger.end()
|
|
@@ -1173,7 +1237,7 @@ export async function translateSpeech(operationData: CLIOperationData) {
|
|
|
1173
1237
|
}
|
|
1174
1238
|
|
|
1175
1239
|
export async function detectLanguage(operationData: CLIOperationData, mode: 'speech' | 'text' | 'auto') {
|
|
1176
|
-
const logger = new Logger()
|
|
1240
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
1177
1241
|
|
|
1178
1242
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData
|
|
1179
1243
|
|
|
@@ -1211,7 +1275,15 @@ export async function detectLanguage(operationData: CLIOperationData, mode: 'spe
|
|
|
1211
1275
|
text = subtitlesToText(text)
|
|
1212
1276
|
}
|
|
1213
1277
|
|
|
1214
|
-
const
|
|
1278
|
+
const callbacks: API.TextLanguageDetectionCallbacks = {
|
|
1279
|
+
logLevel: logger.logLevel
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
const { detectedLanguage, detectedLanguageProbabilities } = await API.detectTextLanguage(
|
|
1283
|
+
text,
|
|
1284
|
+
options,
|
|
1285
|
+
callbacks
|
|
1286
|
+
)
|
|
1215
1287
|
|
|
1216
1288
|
results = detectedLanguageProbabilities
|
|
1217
1289
|
} else {
|
|
@@ -1224,7 +1296,15 @@ export async function detectLanguage(operationData: CLIOperationData, mode: 'spe
|
|
|
1224
1296
|
|
|
1225
1297
|
await checkOutputFilenames(outputFilenames, false, true, false)
|
|
1226
1298
|
|
|
1227
|
-
const
|
|
1299
|
+
const callbacks: API.SpeechLanguageDetectionCallbacks = {
|
|
1300
|
+
logLevel: logger.logLevel
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
const { detectedLanguage, detectedLanguageProbabilities } = await API.detectSpeechLanguage(
|
|
1304
|
+
inputFilePath,
|
|
1305
|
+
options,
|
|
1306
|
+
callbacks
|
|
1307
|
+
)
|
|
1228
1308
|
|
|
1229
1309
|
results = detectedLanguageProbabilities
|
|
1230
1310
|
}
|
|
@@ -1234,8 +1314,12 @@ export async function detectLanguage(operationData: CLIOperationData, mode: 'spe
|
|
|
1234
1314
|
|
|
1235
1315
|
const resultsAsText = results.map(result => `${formatLanguageCodeWithName(result.language)}: ${result.probability.toFixed(5)}`).join('\n')
|
|
1236
1316
|
|
|
1317
|
+
const callbacks: API.OperationCallbacks = {
|
|
1318
|
+
logLevel: logger.logLevel
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1237
1321
|
for (const outputFilename of outputFilenames) {
|
|
1238
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite)
|
|
1322
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks)
|
|
1239
1323
|
|
|
1240
1324
|
await fileSaver(getEmptyRawAudio(0, 0), results as any, resultsAsText)
|
|
1241
1325
|
}
|
|
@@ -1250,7 +1334,7 @@ export async function detectLanguage(operationData: CLIOperationData, mode: 'spe
|
|
|
1250
1334
|
}
|
|
1251
1335
|
|
|
1252
1336
|
export async function detectVoiceActivity(operationData: CLIOperationData) {
|
|
1253
|
-
const logger = new Logger()
|
|
1337
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
1254
1338
|
|
|
1255
1339
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData
|
|
1256
1340
|
|
|
@@ -1269,13 +1353,21 @@ export async function detectVoiceActivity(operationData: CLIOperationData) {
|
|
|
1269
1353
|
cliOptions.play = outputFilenames.length === 0
|
|
1270
1354
|
}
|
|
1271
1355
|
|
|
1272
|
-
const options = await optionsLookupToTypedObject(operationOptionsLookup, '
|
|
1356
|
+
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'VoiceActivityDetectionOptions')
|
|
1273
1357
|
|
|
1274
1358
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault)
|
|
1275
1359
|
|
|
1276
1360
|
await checkOutputFilenames(outputFilenames, true, true, true)
|
|
1277
1361
|
|
|
1278
|
-
|
|
1362
|
+
const callbacks: API.VoiceActivityDetectionCallbacks = {
|
|
1363
|
+
logLevel: logger.logLevel
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
let { timeline, verboseTimeline, inputRawAudio, croppedRawAudio } = await API.detectVoiceActivity(
|
|
1367
|
+
audioFilename,
|
|
1368
|
+
options,
|
|
1369
|
+
callbacks,
|
|
1370
|
+
)
|
|
1279
1371
|
|
|
1280
1372
|
if (outputFilenames.length > 0) {
|
|
1281
1373
|
logger.start('\nWrite output files')
|
|
@@ -1286,7 +1378,7 @@ export async function detectVoiceActivity(operationData: CLIOperationData) {
|
|
|
1286
1378
|
continue
|
|
1287
1379
|
}
|
|
1288
1380
|
|
|
1289
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite)
|
|
1381
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks)
|
|
1290
1382
|
|
|
1291
1383
|
await fileSaver(inputRawAudio, timeline, '', { maxAddedDuration: 0 })
|
|
1292
1384
|
|
|
@@ -1297,7 +1389,7 @@ export async function detectVoiceActivity(operationData: CLIOperationData) {
|
|
|
1297
1389
|
|
|
1298
1390
|
const isolatedOutputFilePath = `${pathWithoutExtension}.cropped.${fileExtension}`
|
|
1299
1391
|
|
|
1300
|
-
const fileSaver = getFileSaver(isolatedOutputFilePath, allowOverwrite)
|
|
1392
|
+
const fileSaver = getFileSaver(isolatedOutputFilePath, allowOverwrite, callbacks)
|
|
1301
1393
|
|
|
1302
1394
|
await fileSaver(croppedRawAudio, [], '')
|
|
1303
1395
|
}
|
|
@@ -1317,7 +1409,7 @@ export async function detectVoiceActivity(operationData: CLIOperationData) {
|
|
|
1317
1409
|
}
|
|
1318
1410
|
|
|
1319
1411
|
export async function denoise(operationData: CLIOperationData) {
|
|
1320
|
-
const logger = new Logger()
|
|
1412
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
1321
1413
|
|
|
1322
1414
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData
|
|
1323
1415
|
|
|
@@ -1342,14 +1434,18 @@ export async function denoise(operationData: CLIOperationData) {
|
|
|
1342
1434
|
|
|
1343
1435
|
await checkOutputFilenames(outputFilenames, true, false, false)
|
|
1344
1436
|
|
|
1345
|
-
const
|
|
1437
|
+
const callbacks: API.DenoisingCallbacks = {
|
|
1438
|
+
logLevel: logger.logLevel
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
const { denoisedAudio } = await API.denoise(audioFilename, options, callbacks)
|
|
1346
1442
|
|
|
1347
1443
|
if (outputFilenames.length > 0) {
|
|
1348
1444
|
logger.start('\nWrite output files')
|
|
1349
1445
|
}
|
|
1350
1446
|
|
|
1351
1447
|
for (const outputFilename of outputFilenames) {
|
|
1352
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite)
|
|
1448
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks)
|
|
1353
1449
|
|
|
1354
1450
|
await fileSaver(denoisedAudio, [], '')
|
|
1355
1451
|
}
|
|
@@ -1362,7 +1458,7 @@ export async function denoise(operationData: CLIOperationData) {
|
|
|
1362
1458
|
}
|
|
1363
1459
|
|
|
1364
1460
|
export async function isolate(operationData: CLIOperationData) {
|
|
1365
|
-
const logger = new Logger()
|
|
1461
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
1366
1462
|
|
|
1367
1463
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData
|
|
1368
1464
|
|
|
@@ -1387,14 +1483,22 @@ export async function isolate(operationData: CLIOperationData) {
|
|
|
1387
1483
|
|
|
1388
1484
|
await checkOutputFilenames(outputFilenames, true, false, false)
|
|
1389
1485
|
|
|
1390
|
-
const
|
|
1486
|
+
const callbacks: API.SourceSeparationCallbacks = {
|
|
1487
|
+
logLevel: logger.logLevel
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
const { inputRawAudio, isolatedRawAudio, backgroundRawAudio } = await API.isolate(
|
|
1491
|
+
audioFilename,
|
|
1492
|
+
options,
|
|
1493
|
+
callbacks,
|
|
1494
|
+
)
|
|
1391
1495
|
|
|
1392
1496
|
if (outputFilenames.length > 0) {
|
|
1393
1497
|
logger.start('\nWrite output files')
|
|
1394
1498
|
}
|
|
1395
1499
|
|
|
1396
1500
|
for (let outputFilename of outputFilenames) {
|
|
1397
|
-
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, false)
|
|
1501
|
+
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, false, callbacks)
|
|
1398
1502
|
}
|
|
1399
1503
|
|
|
1400
1504
|
logger.end()
|
|
@@ -1405,7 +1509,7 @@ export async function isolate(operationData: CLIOperationData) {
|
|
|
1405
1509
|
}
|
|
1406
1510
|
|
|
1407
1511
|
export async function listEngines(operationData: CLIOperationData) {
|
|
1408
|
-
const logger = new Logger()
|
|
1512
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
1409
1513
|
|
|
1410
1514
|
const { operationArgs } = operationData
|
|
1411
1515
|
|
|
@@ -1512,10 +1616,10 @@ export async function listEngines(operationData: CLIOperationData) {
|
|
|
1512
1616
|
}
|
|
1513
1617
|
|
|
1514
1618
|
for (const [index, engine] of engines.entries()) {
|
|
1515
|
-
logger.logTitledMessage('Identifier', chalk.magentaBright(engine.id),
|
|
1516
|
-
logger.logTitledMessage('Name', engine.name,
|
|
1517
|
-
logger.logTitledMessage('Description', engine.description,
|
|
1518
|
-
logger.logTitledMessage('Type', engine.type,
|
|
1619
|
+
logger.logTitledMessage('Identifier', chalk.magentaBright(engine.id), 'output')
|
|
1620
|
+
logger.logTitledMessage('Name', engine.name, 'output')
|
|
1621
|
+
logger.logTitledMessage('Description', engine.description, 'output')
|
|
1622
|
+
logger.logTitledMessage('Type', engine.type, 'output')
|
|
1519
1623
|
|
|
1520
1624
|
if (index < engines.length - 1) {
|
|
1521
1625
|
logger.log('', 'output')
|
|
@@ -1524,7 +1628,7 @@ export async function listEngines(operationData: CLIOperationData) {
|
|
|
1524
1628
|
}
|
|
1525
1629
|
|
|
1526
1630
|
export async function listTTSVoices(operationData: CLIOperationData) {
|
|
1527
|
-
const logger = new Logger()
|
|
1631
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
1528
1632
|
|
|
1529
1633
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData
|
|
1530
1634
|
|
|
@@ -1549,7 +1653,11 @@ export async function listTTSVoices(operationData: CLIOperationData) {
|
|
|
1549
1653
|
|
|
1550
1654
|
await checkOutputFilenames(outputFilenames, false, true, false)
|
|
1551
1655
|
|
|
1552
|
-
const
|
|
1656
|
+
const callbacks: API.VoiceListRequestCallbacks = {
|
|
1657
|
+
logLevel: logger.logLevel
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
const { voiceList } = await API.requestVoiceList(options, callbacks)
|
|
1553
1661
|
|
|
1554
1662
|
const voiceListText = voiceList.map(entry => {
|
|
1555
1663
|
const nameText = entry.name
|
|
@@ -1571,7 +1679,7 @@ export async function listTTSVoices(operationData: CLIOperationData) {
|
|
|
1571
1679
|
logger.start('\nWrite output files')
|
|
1572
1680
|
|
|
1573
1681
|
for (const filename of outputFilenames) {
|
|
1574
|
-
const fileSaver = getFileSaver(filename, allowOverwrite)
|
|
1682
|
+
const fileSaver = getFileSaver(filename, allowOverwrite, callbacks)
|
|
1575
1683
|
|
|
1576
1684
|
const { default: stripAnsi } = await import('strip-ansi')
|
|
1577
1685
|
const voiceListTextWithoutColors = stripAnsi(voiceListText)
|
|
@@ -1586,7 +1694,11 @@ export async function listTTSVoices(operationData: CLIOperationData) {
|
|
|
1586
1694
|
}
|
|
1587
1695
|
|
|
1588
1696
|
export async function installPackages(operationData: CLIOperationData) {
|
|
1589
|
-
const
|
|
1697
|
+
const callbacks: LoadPackageCallbacks = {
|
|
1698
|
+
logLevel: API.getGlobalLogLevel()
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
const logger = new Logger(callbacks.logLevel)
|
|
1590
1702
|
|
|
1591
1703
|
const { operationArgs } = operationData
|
|
1592
1704
|
|
|
@@ -1598,11 +1710,9 @@ export async function installPackages(operationData: CLIOperationData) {
|
|
|
1598
1710
|
|
|
1599
1711
|
for (const packageName of operationArgs) {
|
|
1600
1712
|
try {
|
|
1601
|
-
await loadPackage(packageName)
|
|
1713
|
+
await loadPackage(packageName, callbacks)
|
|
1602
1714
|
} catch (e) {
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
logger.logTitledMessage(`Failed installing package ${packageName}`, e, chalk.redBright, 'error')
|
|
1715
|
+
logger.logTitledMessage(`Failed installing package ${packageName}`, e, 'error')
|
|
1606
1716
|
failedPackageNames.push(packageName)
|
|
1607
1717
|
}
|
|
1608
1718
|
}
|
|
@@ -1617,7 +1727,7 @@ export async function installPackages(operationData: CLIOperationData) {
|
|
|
1617
1727
|
}
|
|
1618
1728
|
|
|
1619
1729
|
export async function uninstallPackages(operationData: CLIOperationData) {
|
|
1620
|
-
const logger = new Logger()
|
|
1730
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
1621
1731
|
|
|
1622
1732
|
const { operationArgs } = operationData
|
|
1623
1733
|
|
|
@@ -1631,9 +1741,7 @@ export async function uninstallPackages(operationData: CLIOperationData) {
|
|
|
1631
1741
|
try {
|
|
1632
1742
|
await removePackage(packageName)
|
|
1633
1743
|
} catch (e) {
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
logger.logTitledMessage(`Failed uninstalling package ${packageName}`, e, chalk.redBright, 'error')
|
|
1744
|
+
logger.logTitledMessage(`Failed uninstalling package ${packageName}`, e, 'error')
|
|
1637
1745
|
failedPackageNames.push(packageName)
|
|
1638
1746
|
}
|
|
1639
1747
|
}
|
|
@@ -1644,7 +1752,7 @@ export async function uninstallPackages(operationData: CLIOperationData) {
|
|
|
1644
1752
|
}
|
|
1645
1753
|
|
|
1646
1754
|
export async function listPackages(operationData: CLIOperationData) {
|
|
1647
|
-
const logger = new Logger()
|
|
1755
|
+
const logger = new Logger(API.getGlobalLogLevel())
|
|
1648
1756
|
|
|
1649
1757
|
const packagesDir = await ensureAndGetPackagesDir()
|
|
1650
1758
|
|
|
@@ -1688,7 +1796,7 @@ export async function serve(operationData: CLIOperationData) {
|
|
|
1688
1796
|
await startServer(options, onServerStarted)
|
|
1689
1797
|
}
|
|
1690
1798
|
|
|
1691
|
-
async function writeSourceSeparationOutputIfNeeded(outputFilename: string, isolatedRawAudio: RawAudio | undefined, backgroundRawAudio: RawAudio | undefined, allowOverwrite: boolean, prefixIsolated: boolean) {
|
|
1799
|
+
async function writeSourceSeparationOutputIfNeeded(outputFilename: string, isolatedRawAudio: RawAudio | undefined, backgroundRawAudio: RawAudio | undefined, allowOverwrite: boolean, prefixIsolated: boolean, callbacks: API.OperationCallbacks) {
|
|
1692
1800
|
// Write source separation output if needed
|
|
1693
1801
|
const fileExtension = getLowercaseFileExtension(outputFilename)
|
|
1694
1802
|
|
|
@@ -1698,18 +1806,18 @@ async function writeSourceSeparationOutputIfNeeded(outputFilename: string, isola
|
|
|
1698
1806
|
{
|
|
1699
1807
|
const isolatedOutputFilePath = prefixIsolated ? `${pathWithoutExtension}.isolated.${fileExtension}` : outputFilename
|
|
1700
1808
|
|
|
1701
|
-
await saveAudioWithBitrate(isolatedRawAudio, isolatedOutputFilePath, fileExtension, 64)
|
|
1809
|
+
await saveAudioWithBitrate(isolatedRawAudio, isolatedOutputFilePath, fileExtension, 64, callbacks)
|
|
1702
1810
|
}
|
|
1703
1811
|
|
|
1704
1812
|
{
|
|
1705
1813
|
const backgroundOutputFilePath = `${pathWithoutExtension}.background.${fileExtension}`
|
|
1706
1814
|
|
|
1707
|
-
await saveAudioWithBitrate(backgroundRawAudio, backgroundOutputFilePath, fileExtension, 128)
|
|
1815
|
+
await saveAudioWithBitrate(backgroundRawAudio, backgroundOutputFilePath, fileExtension, 128, callbacks)
|
|
1708
1816
|
}
|
|
1709
1817
|
}
|
|
1710
1818
|
}
|
|
1711
1819
|
|
|
1712
|
-
async function saveAudioWithBitrate(rawAudio: RawAudio, filepath: string, fileExtension: string, bitrate: number) {
|
|
1820
|
+
async function saveAudioWithBitrate(rawAudio: RawAudio, filepath: string, fileExtension: string, bitrate: number, callbacks: API.OperationCallbacks) {
|
|
1713
1821
|
const fileDir = parsePath(filepath).dir || './'
|
|
1714
1822
|
|
|
1715
1823
|
if (fileExtension == 'wav') {
|
|
@@ -1721,7 +1829,7 @@ async function saveAudioWithBitrate(rawAudio: RawAudio, filepath: string, fileEx
|
|
|
1721
1829
|
ffmpegOptions.filename = filepath
|
|
1722
1830
|
|
|
1723
1831
|
await ensureDir(fileDir)
|
|
1724
|
-
await encodeFromChannels(rawAudio, ffmpegOptions)
|
|
1832
|
+
await encodeFromChannels(rawAudio, ffmpegOptions, callbacks)
|
|
1725
1833
|
}
|
|
1726
1834
|
}
|
|
1727
1835
|
|
|
@@ -1798,12 +1906,12 @@ async function optionsLookupToTypedObject<K extends keyof APIOptions>(cliOptions
|
|
|
1798
1906
|
throw new Error(`The property '${key}' is not a Boolean, and cannot be negated using the 'not-' prefix.`)
|
|
1799
1907
|
} else if (optionType == 'array' || optionType == 'object') {
|
|
1800
1908
|
try {
|
|
1801
|
-
parsedValue =
|
|
1909
|
+
parsedValue = parseJson(value, true)
|
|
1802
1910
|
} catch (e) {
|
|
1803
1911
|
parsedValue = value
|
|
1804
1912
|
}
|
|
1805
1913
|
} else if (optionIsUnion) {
|
|
1806
|
-
const { parsedValue: json5ParsedValue, jsonType } =
|
|
1914
|
+
const { parsedValue: json5ParsedValue, jsonType } = parseJSONAndGetType(value, true)
|
|
1807
1915
|
|
|
1808
1916
|
if (jsonType === 'number' || jsonType === 'boolean' || jsonType === 'array' || jsonType === 'object') {
|
|
1809
1917
|
parsedValue = json5ParsedValue
|
|
@@ -1881,7 +1989,7 @@ async function checkOutputFilenames(outputFilenames: string[], acceptMediaOutput
|
|
|
1881
1989
|
return { includesPlaceholderPattern }
|
|
1882
1990
|
}
|
|
1883
1991
|
|
|
1884
|
-
async function writeOutputFilesForSegment(outputFilenames: string[], index: number, total: number, audio: RawAudio, timeline: Timeline, text: string, language: string, allowOverwrite: boolean) {
|
|
1992
|
+
async function writeOutputFilesForSegment(outputFilenames: string[], index: number, total: number, audio: RawAudio, timeline: Timeline, text: string, language: string, allowOverwrite: boolean, callbacks: API.OperationCallbacks) {
|
|
1885
1993
|
const digitCount = Math.max((total + 1).toString().length, 2)
|
|
1886
1994
|
|
|
1887
1995
|
const segmentWords = (await splitToWords(text, language)).nonPunctuationWords
|
|
@@ -1907,14 +2015,14 @@ async function writeOutputFilesForSegment(outputFilenames: string[], index: numb
|
|
|
1907
2015
|
const fileExtension = getLowercaseFileExtension(outputFilename)
|
|
1908
2016
|
const segmentFilename = joinPath(fileDir, `${formatIntegerWithLeadingZeros(index + 1, digitCount)} - ${initialText}.${fileExtension}`)
|
|
1909
2017
|
|
|
1910
|
-
const fileSaver = getFileSaver(segmentFilename, allowOverwrite)
|
|
2018
|
+
const fileSaver = getFileSaver(segmentFilename, allowOverwrite, callbacks)
|
|
1911
2019
|
await fileSaver(audio, timeline, text)
|
|
1912
2020
|
}
|
|
1913
2021
|
}
|
|
1914
2022
|
|
|
1915
2023
|
type FileSaver = (audio: RawAudio, timeline: Timeline, text: string, subtitlesConfig?: SubtitlesConfig) => Promise<void>
|
|
1916
2024
|
|
|
1917
|
-
function getFileSaver(outputFilePath: string, allowOverwrite: boolean): FileSaver {
|
|
2025
|
+
function getFileSaver(outputFilePath: string, allowOverwrite: boolean, callbacks: API.OperationCallbacks): FileSaver {
|
|
1918
2026
|
const parsedPath = parsePath(outputFilePath)
|
|
1919
2027
|
|
|
1920
2028
|
const fileDir = parsedPath.dir || './'
|
|
@@ -1945,7 +2053,7 @@ function getFileSaver(outputFilePath: string, allowOverwrite: boolean): FileSave
|
|
|
1945
2053
|
await ensureDir(fileDir)
|
|
1946
2054
|
|
|
1947
2055
|
const roundedTimeline = roundTimelineProperties(timeline)
|
|
1948
|
-
return writeFileSafe(outputFilePath,
|
|
2056
|
+
return writeFileSafe(outputFilePath, stringifyAndFormatJson(roundedTimeline))
|
|
1949
2057
|
}
|
|
1950
2058
|
} else if (fileExtension == 'srt') {
|
|
1951
2059
|
fileSaver = async (audio, timeline, text, subtitlesConfig) => {
|
|
@@ -1993,7 +2101,7 @@ function getFileSaver(outputFilePath: string, allowOverwrite: boolean): FileSave
|
|
|
1993
2101
|
|
|
1994
2102
|
await ensureDir(fileDir)
|
|
1995
2103
|
|
|
1996
|
-
await encodeFromChannels(audio, ffmpegOptions)
|
|
2104
|
+
await encodeFromChannels(audio, ffmpegOptions, callbacks)
|
|
1997
2105
|
|
|
1998
2106
|
return
|
|
1999
2107
|
}
|