echogarden 2.10.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.MIT.md +7 -0
- package/README.md +9 -1
- package/data/lexicons/heteronyms.en.json +44 -10
- package/data/lexicons/words.en.json +726 -22
- package/data/schemas/options.json +91 -153
- package/dist/alignment/DTWMfccSequenceAlignment.js.map +1 -1
- package/dist/alignment/SemanticTextAlignment.d.ts +4 -2
- package/dist/alignment/SemanticTextAlignment.d.ts.map +1 -1
- package/dist/alignment/SemanticTextAlignment.js +7 -7
- package/dist/alignment/SemanticTextAlignment.js.map +1 -1
- package/dist/alignment/SpeechAlignment.d.ts +9 -10
- package/dist/alignment/SpeechAlignment.d.ts.map +1 -1
- package/dist/alignment/SpeechAlignment.js +23 -96
- package/dist/alignment/SpeechAlignment.js.map +1 -1
- package/dist/api/APIOptions.d.ts +1 -1
- package/dist/api/APIOptions.d.ts.map +1 -1
- package/dist/api/Alignment.d.ts +8 -6
- package/dist/api/Alignment.d.ts.map +1 -1
- package/dist/api/Alignment.js +31 -40
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/Common.d.ts +7 -0
- package/dist/api/Common.d.ts.map +1 -1
- package/dist/api/Common.js.map +1 -1
- package/dist/api/Denoising.d.ts +5 -2
- package/dist/api/Denoising.d.ts.map +1 -1
- package/dist/api/Denoising.js +15 -15
- package/dist/api/Denoising.js.map +1 -1
- package/dist/api/GlobalOptions.d.ts +2 -8
- package/dist/api/GlobalOptions.d.ts.map +1 -1
- package/dist/api/GlobalOptions.js +2 -13
- package/dist/api/GlobalOptions.js.map +1 -1
- package/dist/api/Recognition.d.ts +11 -12
- package/dist/api/Recognition.d.ts.map +1 -1
- package/dist/api/Recognition.js +32 -82
- package/dist/api/Recognition.js.map +1 -1
- package/dist/api/SourceSeparation.d.ts +7 -2
- package/dist/api/SourceSeparation.d.ts.map +1 -1
- package/dist/api/SourceSeparation.js +12 -10
- package/dist/api/SourceSeparation.js.map +1 -1
- package/dist/api/SpeechLanguageDetection.d.ts +11 -7
- package/dist/api/SpeechLanguageDetection.d.ts.map +1 -1
- package/dist/api/SpeechLanguageDetection.js +37 -30
- package/dist/api/SpeechLanguageDetection.js.map +1 -1
- package/dist/api/SpeechSearch.d.ts +4 -1
- package/dist/api/SpeechSearch.d.ts.map +1 -1
- package/dist/api/SpeechSearch.js.map +1 -1
- package/dist/api/SpeechTranslation.d.ts +10 -6
- package/dist/api/SpeechTranslation.d.ts.map +1 -1
- package/dist/api/SpeechTranslation.js +28 -26
- package/dist/api/SpeechTranslation.js.map +1 -1
- package/dist/api/Synthesis.d.ts +13 -8
- package/dist/api/Synthesis.d.ts.map +1 -1
- package/dist/api/Synthesis.js +67 -89
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/api/TextLanguageDetection.d.ts +4 -2
- package/dist/api/TextLanguageDetection.d.ts.map +1 -1
- package/dist/api/TextLanguageDetection.js +4 -7
- package/dist/api/TextLanguageDetection.js.map +1 -1
- package/dist/api/TextTranslation.d.ts +4 -2
- package/dist/api/TextTranslation.d.ts.map +1 -1
- package/dist/api/TextTranslation.js +13 -24
- package/dist/api/TextTranslation.js.map +1 -1
- package/dist/api/TimelineTranslationAlignment.d.ts +6 -3
- package/dist/api/TimelineTranslationAlignment.d.ts.map +1 -1
- package/dist/api/TimelineTranslationAlignment.js +20 -11
- package/dist/api/TimelineTranslationAlignment.js.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.d.ts +6 -4
- package/dist/api/TranscriptAndTranslationAlignment.d.ts.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.js +11 -12
- package/dist/api/TranscriptAndTranslationAlignment.js.map +1 -1
- package/dist/api/TranslationAlignment.d.ts +6 -4
- package/dist/api/TranslationAlignment.d.ts.map +1 -1
- package/dist/api/TranslationAlignment.js +20 -21
- package/dist/api/TranslationAlignment.js.map +1 -1
- package/dist/api/VoiceActivityDetection.d.ts +9 -8
- package/dist/api/VoiceActivityDetection.d.ts.map +1 -1
- package/dist/api/VoiceActivityDetection.js +20 -43
- package/dist/api/VoiceActivityDetection.js.map +1 -1
- package/dist/audio/AudioBufferConversion.js.map +1 -1
- package/dist/audio/AudioPlayer.d.ts +1 -3
- package/dist/audio/AudioPlayer.d.ts.map +1 -1
- package/dist/audio/AudioPlayer.js +3 -188
- package/dist/audio/AudioPlayer.js.map +1 -1
- package/dist/audio/AudioUtilities.d.ts +2 -1
- package/dist/audio/AudioUtilities.d.ts.map +1 -1
- package/dist/audio/AudioUtilities.js +2 -2
- package/dist/audio/AudioUtilities.js.map +1 -1
- package/dist/build-tools/MakeTarballsForInstalledPackages.js +3 -3
- package/dist/build-tools/MakeTarballsForInstalledPackages.js.map +1 -1
- package/dist/cli/CLI.d.ts.map +1 -1
- package/dist/cli/CLI.js +139 -92
- package/dist/cli/CLI.js.map +1 -1
- package/dist/codecs/FFMpegTranscoder.d.ts +4 -3
- package/dist/codecs/FFMpegTranscoder.d.ts.map +1 -1
- package/dist/codecs/FFMpegTranscoder.js +16 -14
- package/dist/codecs/FFMpegTranscoder.js.map +1 -1
- package/dist/codecs/TIMITCodec.d.ts.map +1 -1
- package/dist/data-structures/DynamicTypedArray.d.ts.map +1 -1
- package/dist/data-structures/DynamicTypedArray.js.map +1 -1
- package/dist/data-structures/Queue.d.ts.map +1 -1
- package/dist/data-structures/WindowedList.d.ts.map +1 -1
- package/dist/data-structures/WindowedList.js.map +1 -1
- package/dist/denoising/NSNet2.d.ts +3 -2
- package/dist/denoising/NSNet2.d.ts.map +1 -1
- package/dist/denoising/NSNet2.js +4 -4
- package/dist/denoising/NSNet2.js.map +1 -1
- package/dist/denoising/RNNoise.d.ts +2 -1
- package/dist/denoising/RNNoise.d.ts.map +1 -1
- package/dist/denoising/RNNoise.js +10 -6
- package/dist/denoising/RNNoise.js.map +1 -1
- package/dist/dsp/BiquadFilter.d.ts.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.d.ts.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.js.map +1 -1
- package/dist/dsp/FFT.d.ts.map +1 -1
- package/dist/dsp/FFT.js +2 -1
- package/dist/dsp/FFT.js.map +1 -1
- package/dist/dsp/KWeightingFilter.d.ts.map +1 -1
- package/dist/dsp/KWeightingFilter.js.map +1 -1
- package/dist/dsp/LoudnessEstimator.d.ts.map +1 -1
- package/dist/dsp/LoudnessEstimator.js.map +1 -1
- package/dist/dsp/MFCC.d.ts +3 -2
- package/dist/dsp/MFCC.d.ts.map +1 -1
- package/dist/dsp/MFCC.js +4 -4
- package/dist/dsp/MFCC.js.map +1 -1
- package/dist/dsp/MelSpectrogram.d.ts +10 -8
- package/dist/dsp/MelSpectrogram.d.ts.map +1 -1
- package/dist/dsp/MelSpectrogram.js +31 -34
- package/dist/dsp/MelSpectrogram.js.map +1 -1
- package/dist/dsp/Rubberband.d.ts.map +1 -1
- package/dist/dsp/Rubberband.js +8 -3
- package/dist/dsp/Rubberband.js.map +1 -1
- package/dist/dsp/Sonic.d.ts.map +1 -1
- package/dist/dsp/Sonic.js +1 -1
- package/dist/dsp/Sonic.js.map +1 -1
- package/dist/dsp/SpeexResampler.d.ts.map +1 -1
- package/dist/dsp/SpeexResampler.js +1 -1
- package/dist/dsp/SpeexResampler.js.map +1 -1
- package/dist/encodings/Ascii.d.ts +1 -1
- package/dist/encodings/Ascii.d.ts.map +1 -1
- package/dist/encodings/Base64.js.map +1 -1
- package/dist/encodings/Utf16.d.ts.map +1 -1
- package/dist/encodings/Utf8.d.ts.map +1 -1
- package/dist/math/VectorMath.d.ts +1 -0
- package/dist/math/VectorMath.d.ts.map +1 -1
- package/dist/math/VectorMath.js +9 -5
- package/dist/math/VectorMath.js.map +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts.map +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts.map +1 -1
- package/dist/nlp/EspeakPhonemizer.js +2 -2
- package/dist/nlp/EspeakPhonemizer.js.map +1 -1
- package/dist/nlp/IPA.d.ts +2 -2
- package/dist/nlp/Segmentation.d.ts +1 -1
- package/dist/nlp/Segmentation.d.ts.map +1 -1
- package/dist/nlp/Segmentation.js +8 -4
- package/dist/nlp/Segmentation.js.map +1 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts +2 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts.map +1 -1
- package/dist/recognition/AmazonTranscribeSTT.js +3 -3
- package/dist/recognition/AmazonTranscribeSTT.js.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts +2 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.js +4 -4
- package/dist/recognition/AzureCognitiveServicesSTT.js.map +1 -1
- package/dist/recognition/DeepgramSTT.d.ts +2 -1
- package/dist/recognition/DeepgramSTT.d.ts.map +1 -1
- package/dist/recognition/DeepgramSTT.js +12 -13
- package/dist/recognition/DeepgramSTT.js.map +1 -1
- package/dist/recognition/GoogleCloudSTT.d.ts +2 -1
- package/dist/recognition/GoogleCloudSTT.d.ts.map +1 -1
- package/dist/recognition/GoogleCloudSTT.js +11 -10
- package/dist/recognition/GoogleCloudSTT.js.map +1 -1
- package/dist/recognition/OpenAICloudSTT.d.ts +2 -1
- package/dist/recognition/OpenAICloudSTT.d.ts.map +1 -1
- package/dist/recognition/OpenAICloudSTT.js +6 -6
- package/dist/recognition/OpenAICloudSTT.js.map +1 -1
- package/dist/recognition/WhisperCommon.d.ts +9 -0
- package/dist/recognition/WhisperCommon.d.ts.map +1 -0
- package/dist/recognition/WhisperCommon.js +52 -0
- package/dist/recognition/WhisperCommon.js.map +1 -0
- package/dist/recognition/{WhisperCppSTT.d.ts → WhisperCppCliSTT.d.ts} +14 -16
- package/dist/recognition/WhisperCppCliSTT.d.ts.map +1 -0
- package/dist/recognition/{WhisperCppSTT.js → WhisperCppCliSTT.js} +55 -84
- package/dist/recognition/WhisperCppCliSTT.js.map +1 -0
- package/dist/recognition/WhisperSTT.d.ts +72 -85
- package/dist/recognition/WhisperSTT.d.ts.map +1 -1
- package/dist/recognition/WhisperSTT.js +384 -519
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/server/Client.d.ts +2 -2
- package/dist/server/Client.d.ts.map +1 -1
- package/dist/server/Client.js.map +1 -1
- package/dist/server/Worker.d.ts +6 -7
- package/dist/server/Worker.d.ts.map +1 -1
- package/dist/server/Worker.js +42 -44
- package/dist/server/Worker.js.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.d.ts +3 -2
- package/dist/source-separation/MDXNetSourceSeparation.d.ts.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.js +10 -8
- package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts +3 -2
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js +5 -5
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts +5 -3
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.js +8 -8
- package/dist/speech-language-detection/SileroLanguageDetection.js.map +1 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts +2 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts.map +1 -1
- package/dist/speech-search/DTWSpeechSearch.js +4 -4
- package/dist/speech-search/DTWSpeechSearch.js.map +1 -1
- package/dist/subtitles/Subtitles.d.ts +13 -1
- package/dist/subtitles/Subtitles.d.ts.map +1 -1
- package/dist/subtitles/Subtitles.js +22 -22
- package/dist/subtitles/Subtitles.js.map +1 -1
- package/dist/synthesis/AwsPollyTTS.d.ts +3 -2
- package/dist/synthesis/AwsPollyTTS.d.ts.map +1 -1
- package/dist/synthesis/AwsPollyTTS.js +5 -5
- package/dist/synthesis/AwsPollyTTS.js.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts +2 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.js +3 -3
- package/dist/synthesis/AzureCognitiveServicesTTS.js.map +1 -1
- package/dist/synthesis/CoquiServerTTS.d.ts +2 -1
- package/dist/synthesis/CoquiServerTTS.d.ts.map +1 -1
- package/dist/synthesis/CoquiServerTTS.js +7 -8
- package/dist/synthesis/CoquiServerTTS.js.map +1 -1
- package/dist/synthesis/DeepgramTTS.d.ts +2 -2
- package/dist/synthesis/DeepgramTTS.d.ts.map +1 -1
- package/dist/synthesis/DeepgramTTS.js +13 -13
- package/dist/synthesis/DeepgramTTS.js.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.d.ts +3 -3
- package/dist/synthesis/ElevenLabsTTS.d.ts.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.js +22 -21
- package/dist/synthesis/ElevenLabsTTS.js.map +1 -1
- package/dist/synthesis/EspeakTTS.d.ts +11 -9
- package/dist/synthesis/EspeakTTS.d.ts.map +1 -1
- package/dist/synthesis/EspeakTTS.js +118 -68
- package/dist/synthesis/EspeakTTS.js.map +1 -1
- package/dist/synthesis/FliteTTS.d.ts +2 -2
- package/dist/synthesis/FliteTTS.d.ts.map +1 -1
- package/dist/synthesis/FliteTTS.js +2 -2
- package/dist/synthesis/FliteTTS.js.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.d.ts +2 -2
- package/dist/synthesis/GnuSpeechTTS.d.ts.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.js +1 -1
- package/dist/synthesis/GnuSpeechTTS.js.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.d.ts +3 -2
- package/dist/synthesis/GoogleCloudTTS.d.ts.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.js +15 -14
- package/dist/synthesis/GoogleCloudTTS.js.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.d.ts +3 -2
- package/dist/synthesis/GoogleTranslateTTS.d.ts.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.js +11 -11
- package/dist/synthesis/GoogleTranslateTTS.js.map +1 -1
- package/dist/synthesis/KokoroTTS.d.ts +4 -4
- package/dist/synthesis/KokoroTTS.d.ts.map +1 -1
- package/dist/synthesis/KokoroTTS.js +11 -10
- package/dist/synthesis/KokoroTTS.js.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts +4 -3
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.js +41 -20
- package/dist/synthesis/MicrosoftEdgeTTS.js.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.d.ts +2 -2
- package/dist/synthesis/OpenAICloudTTS.d.ts.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.js +6 -5
- package/dist/synthesis/OpenAICloudTTS.js.map +1 -1
- package/dist/synthesis/SamTTS.d.ts +2 -1
- package/dist/synthesis/SamTTS.d.ts.map +1 -1
- package/dist/synthesis/SamTTS.js +2 -2
- package/dist/synthesis/SamTTS.js.map +1 -1
- package/dist/synthesis/SapiTTS.d.ts +2 -2
- package/dist/synthesis/SapiTTS.d.ts.map +1 -1
- package/dist/synthesis/SapiTTS.js +2 -2
- package/dist/synthesis/SapiTTS.js.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.d.ts +2 -2
- package/dist/synthesis/SvoxPicoTTS.d.ts.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.js +3 -3
- package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
- package/dist/synthesis/VitsTTS.d.ts +3 -3
- package/dist/synthesis/VitsTTS.d.ts.map +1 -1
- package/dist/synthesis/VitsTTS.js +14 -11
- package/dist/synthesis/VitsTTS.js.map +1 -1
- package/dist/text-translation/DeepLTextTranslation.d.ts +2 -2
- package/dist/text-translation/DeepLTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/DeepLTextTranslation.js +10 -9
- package/dist/text-translation/DeepLTextTranslation.js.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts +4 -4
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.js +20 -18
- package/dist/text-translation/GoogleTranslateTextTranslation.js.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.d.ts +2 -2
- package/dist/text-translation/NLLBTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.js +4 -6
- package/dist/text-translation/NLLBTextTranslation.js.map +1 -1
- package/dist/typings/TypedArray.d.ts.map +1 -1
- package/dist/utilities/Compression.d.ts +4 -3
- package/dist/utilities/Compression.d.ts.map +1 -1
- package/dist/utilities/Compression.js +9 -9
- package/dist/utilities/Compression.js.map +1 -1
- package/dist/utilities/FileDownloader.d.ts +6 -3
- package/dist/utilities/FileDownloader.d.ts.map +1 -1
- package/dist/utilities/FileDownloader.js +25 -21
- package/dist/utilities/FileDownloader.js.map +1 -1
- package/dist/utilities/FileReader.d.ts.map +1 -1
- package/dist/utilities/FileReader.js.map +1 -1
- package/dist/utilities/FileSystem.js +1 -1
- package/dist/utilities/FileSystem.js.map +1 -1
- package/dist/utilities/FileWriter.d.ts.map +1 -1
- package/dist/utilities/FileWriter.js.map +1 -1
- package/dist/utilities/Hashing.d.ts.map +1 -1
- package/dist/utilities/Hashing.js.map +1 -1
- package/dist/utilities/Locale.js.map +1 -1
- package/dist/utilities/Logger.d.ts +17 -9
- package/dist/utilities/Logger.d.ts.map +1 -1
- package/dist/utilities/Logger.js +50 -35
- package/dist/utilities/Logger.js.map +1 -1
- package/dist/utilities/NpmUtilities.d.ts.map +1 -1
- package/dist/utilities/NpmUtilities.js +4 -5
- package/dist/utilities/NpmUtilities.js.map +1 -1
- package/dist/utilities/ObjectUtilities.js.map +1 -1
- package/dist/utilities/OpenPromise.d.ts.map +1 -1
- package/dist/utilities/OpenPromise.js.map +1 -1
- package/dist/utilities/PackageManager.d.ts +4 -1
- package/dist/utilities/PackageManager.d.ts.map +1 -1
- package/dist/utilities/PackageManager.js +37 -22
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/PathUtilities.d.ts +2 -0
- package/dist/utilities/PathUtilities.d.ts.map +1 -1
- package/dist/utilities/PathUtilities.js +5 -2
- package/dist/utilities/PathUtilities.js.map +1 -1
- package/dist/utilities/RandomGenerator.d.ts.map +1 -1
- package/dist/utilities/SignalChannel.d.ts.map +1 -1
- package/dist/utilities/SmoothEstimator.d.ts.map +1 -1
- package/dist/utilities/SmoothEstimator.js.map +1 -1
- package/dist/utilities/StringBuilder.d.ts.map +1 -1
- package/dist/utilities/TarballMaker.d.ts +4 -3
- package/dist/utilities/TarballMaker.d.ts.map +1 -1
- package/dist/utilities/TarballMaker.js +6 -6
- package/dist/utilities/TarballMaker.js.map +1 -1
- package/dist/utilities/Timeline.js.map +1 -1
- package/dist/utilities/Timer.d.ts.map +1 -1
- package/dist/utilities/Utilities.d.ts +9 -7
- package/dist/utilities/Utilities.d.ts.map +1 -1
- package/dist/utilities/Utilities.js +49 -33
- package/dist/utilities/Utilities.js.map +1 -1
- package/dist/utilities/VirtualFileReadStream.d.ts.map +1 -1
- package/dist/utilities/WebReader.d.ts +2 -1
- package/dist/utilities/WebReader.d.ts.map +1 -1
- package/dist/utilities/WebReader.js +7 -6
- package/dist/utilities/WebReader.js.map +1 -1
- package/dist/utilities/WikipediaReader.d.ts +2 -1
- package/dist/utilities/WikipediaReader.d.ts.map +1 -1
- package/dist/utilities/WikipediaReader.js +1 -5
- package/dist/utilities/WikipediaReader.js.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts +2 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.js +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.js.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js.map +1 -1
- package/docs/API.md +62 -17
- package/docs/CUDA.md +4 -3
- package/docs/Engines.md +8 -7
- package/docs/Licenses.md +0 -3
- package/docs/Options.md +27 -31
- package/docs/Server.md +1 -0
- package/docs/Tasklist.md +2 -1
- package/docs/Technical.md +2 -2
- package/package.json +45 -35
- package/src/alignment/SemanticTextAlignment.ts +14 -7
- package/src/alignment/SpeechAlignment.ts +47 -150
- package/src/api/APIOptions.ts +1 -1
- package/src/api/Alignment.ts +95 -61
- package/src/api/Common.ts +11 -0
- package/src/api/Denoising.ts +22 -17
- package/src/api/GlobalOptions.ts +4 -20
- package/src/api/Recognition.ts +106 -123
- package/src/api/SourceSeparation.ts +39 -21
- package/src/api/SpeechLanguageDetection.ts +77 -37
- package/src/api/SpeechSearch.ts +6 -1
- package/src/api/SpeechTranslation.ts +75 -38
- package/src/api/Synthesis.ts +220 -116
- package/src/api/TextLanguageDetection.ts +10 -12
- package/src/api/TextTranslation.ts +43 -26
- package/src/api/TimelineTranslationAlignment.ts +41 -13
- package/src/api/TranscriptAndTranslationAlignment.ts +28 -15
- package/src/api/TranslationAlignment.ts +53 -24
- package/src/api/VoiceActivityDetection.ts +33 -68
- package/src/audio/AudioPlayer.ts +4 -232
- package/src/audio/AudioUtilities.ts +9 -2
- package/src/build-tools/MakeTarballsForInstalledPackages.ts +4 -3
- package/src/cli/CLI.ts +209 -101
- package/src/codecs/FFMpegTranscoder.ts +18 -16
- package/src/denoising/NSNet2.ts +5 -4
- package/src/denoising/RNNoise.ts +14 -6
- package/src/dsp/FFT.ts +2 -1
- package/src/dsp/MFCC.ts +7 -5
- package/src/dsp/MelSpectrogram.ts +56 -36
- package/src/dsp/Rubberband.ts +10 -3
- package/src/dsp/Sonic.ts +2 -1
- package/src/dsp/SpeexResampler.ts +2 -1
- package/src/encodings/Ascii.ts +1 -1
- package/src/encodings/Base64.ts +1 -1
- package/src/math/VectorMath.ts +10 -6
- package/src/nlp/EspeakPhonemizer.ts +2 -2
- package/src/nlp/Segmentation.ts +9 -4
- package/src/recognition/AmazonTranscribeSTT.ts +4 -3
- package/src/recognition/AzureCognitiveServicesSTT.ts +5 -4
- package/src/recognition/DeepgramSTT.ts +16 -16
- package/src/recognition/GoogleCloudSTT.ts +14 -12
- package/src/recognition/OpenAICloudSTT.ts +12 -6
- package/src/recognition/WhisperCommon.ts +130 -0
- package/src/recognition/{WhisperCppSTT.ts → WhisperCppCliSTT.ts} +73 -133
- package/src/recognition/WhisperSTT.ts +569 -718
- package/src/server/Client.ts +4 -4
- package/src/server/Worker.ts +59 -59
- package/src/source-separation/MDXNetSourceSeparation.ts +15 -10
- package/src/speech-embeddings/WavToVec2BertFeatureEmbeddings.ts +7 -5
- package/src/speech-language-detection/SileroLanguageDetection.ts +18 -9
- package/src/speech-search/DTWSpeechSearch.ts +6 -5
- package/src/subtitles/Subtitles.ts +22 -22
- package/src/synthesis/AwsPollyTTS.ts +12 -5
- package/src/synthesis/AzureCognitiveServicesTTS.ts +11 -3
- package/src/synthesis/CoquiServerTTS.ts +8 -7
- package/src/synthesis/DeepgramTTS.ts +21 -15
- package/src/synthesis/ElevenLabsTTS.ts +33 -23
- package/src/synthesis/EspeakTTS.ts +145 -69
- package/src/synthesis/FliteTTS.ts +3 -3
- package/src/synthesis/GnuSpeechTTS.ts +2 -2
- package/src/synthesis/GoogleCloudTTS.ts +23 -14
- package/src/synthesis/GoogleTranslateTTS.ts +19 -11
- package/src/synthesis/KokoroTTS.ts +37 -14
- package/src/synthesis/MicrosoftEdgeTTS.ts +71 -23
- package/src/synthesis/OpenAICloudTTS.ts +7 -6
- package/src/synthesis/SamTTS.ts +3 -2
- package/src/synthesis/SapiTTS.ts +3 -3
- package/src/synthesis/SvoxPicoTTS.ts +4 -5
- package/src/synthesis/VitsTTS.ts +43 -15
- package/src/text-translation/DeepLTextTranslation.ts +12 -10
- package/src/text-translation/GoogleTranslateTextTranslation.ts +35 -21
- package/src/text-translation/NLLBTextTranslation.ts +5 -9
- package/src/typings/Fillers.d.ts +0 -60
- package/src/typings/TypedArray.ts +12 -1
- package/src/utilities/Compression.ts +10 -9
- package/src/utilities/FileDownloader.ts +38 -23
- package/src/utilities/FileSystem.ts +1 -1
- package/src/utilities/Logger.ts +59 -42
- package/src/utilities/NpmUtilities.ts +4 -6
- package/src/utilities/OpenPromise.ts +1 -2
- package/src/utilities/PackageManager.ts +53 -26
- package/src/utilities/PathUtilities.ts +6 -2
- package/src/utilities/TarballMaker.ts +7 -7
- package/src/utilities/Utilities.ts +58 -41
- package/src/utilities/WebReader.ts +11 -6
- package/src/utilities/WikipediaReader.ts +2 -8
- package/src/voice-activity-detection/AdaptiveGateVAD.ts +13 -8
- package/src/voice-activity-detection/WebRtcVAD.ts +1 -2
- package/tsconfig.json +53 -54
- package/dist/audio/AudioRecorder.d.ts +0 -4
- package/dist/audio/AudioRecorder.d.ts.map +0 -1
- package/dist/audio/AudioRecorder.js +0 -68
- package/dist/audio/AudioRecorder.js.map +0 -1
- package/dist/audio/SoxPath.d.ts +0 -2
- package/dist/audio/SoxPath.d.ts.map +0 -1
- package/dist/audio/SoxPath.js +0 -24
- package/dist/audio/SoxPath.js.map +0 -1
- package/dist/recognition/SileroSTT.d.ts +0 -30
- package/dist/recognition/SileroSTT.d.ts.map +0 -1
- package/dist/recognition/SileroSTT.js +0 -152
- package/dist/recognition/SileroSTT.js.map +0 -1
- package/dist/recognition/VoskSTT.d.ts +0 -11
- package/dist/recognition/VoskSTT.d.ts.map +0 -1
- package/dist/recognition/VoskSTT.js +0 -72
- package/dist/recognition/VoskSTT.js.map +0 -1
- package/dist/recognition/WhisperCppSTT.d.ts.map +0 -1
- package/dist/recognition/WhisperCppSTT.js.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.d.ts +0 -12
- package/dist/synthesis/StreamlabsPollyTTS.d.ts.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.js +0 -88
- package/dist/synthesis/StreamlabsPollyTTS.js.map +0 -1
- package/dist/utilities/BinaryUtilities.d.ts +0 -14
- package/dist/utilities/BinaryUtilities.d.ts.map +0 -1
- package/dist/utilities/BinaryUtilities.js +0 -113
- package/dist/utilities/BinaryUtilities.js.map +0 -1
- package/src/audio/AudioRecorder.ts +0 -91
- package/src/audio/SoxPath.ts +0 -31
- package/src/recognition/SileroSTT.ts +0 -222
- package/src/recognition/VoskSTT.ts +0 -112
- package/src/synthesis/StreamlabsPollyTTS.ts +0 -114
- package/src/utilities/BinaryUtilities.ts +0 -138
- /package/{LICENSE.md → LICENSE.GPLv3.md} +0 -0
package/dist/cli/CLI.js
CHANGED
|
@@ -6,7 +6,7 @@ import { parseConfigFile, parseJSONConfigFile } from './CLIConfigFile.js';
|
|
|
6
6
|
import chalk from 'chalk';
|
|
7
7
|
import { applyGainDecibels, encodeRawAudioToWave, getEmptyRawAudio, getRawAudioDuration, normalizeAudioLevel, sliceRawAudioByTime } from '../audio/AudioUtilities.js';
|
|
8
8
|
import { subtitlesToText, timelineToSubtitles } from '../subtitles/Subtitles.js';
|
|
9
|
-
import { Logger
|
|
9
|
+
import { Logger } from '../utilities/Logger.js';
|
|
10
10
|
import { isMainThread, parentPort } from 'node:worker_threads';
|
|
11
11
|
import { encodeFromChannels, getDefaultFFMpegOptionsForSpeech } from '../codecs/FFMpegTranscoder.js';
|
|
12
12
|
import { splitToParagraphs, splitToWords } from '../nlp/Segmentation.js';
|
|
@@ -23,7 +23,6 @@ import { OpenPromise } from '../utilities/OpenPromise.js';
|
|
|
23
23
|
import { getDirName, getFileNameWithoutExtension, getLowercaseFileExtension, joinPath, parsePath, resolveToModuleRootDir } from '../utilities/PathUtilities.js';
|
|
24
24
|
import { CLIOptionsKeys } from './CLIOptions.js';
|
|
25
25
|
import { convertHtmlToText, formatIntegerWithLeadingZeros, formatListWithQuotedElements } from '../utilities/StringUtilities.js';
|
|
26
|
-
//const log = logToStderr
|
|
27
26
|
async function startIfInWorkerThread() {
|
|
28
27
|
if (isMainThread || !parentPort) {
|
|
29
28
|
return;
|
|
@@ -45,7 +44,7 @@ async function startIfInWorkerThread() {
|
|
|
45
44
|
start(process.argv.slice(2));
|
|
46
45
|
}
|
|
47
46
|
export async function start(processArgs) {
|
|
48
|
-
const logger = new Logger();
|
|
47
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
49
48
|
const operationData = {
|
|
50
49
|
operation: '',
|
|
51
50
|
operationArgs: [],
|
|
@@ -54,8 +53,6 @@ export async function start(processArgs) {
|
|
|
54
53
|
operationOptionsLookup: new Map(),
|
|
55
54
|
};
|
|
56
55
|
try {
|
|
57
|
-
const packageData = await readAndParseJsonFile(resolveToModuleRootDir('package.json'));
|
|
58
|
-
logger.log(chalk.magentaBright(`Echogarden v${packageData.version}\n`));
|
|
59
56
|
const operation = processArgs[0];
|
|
60
57
|
if (!operation || operation == 'help') {
|
|
61
58
|
logger.log(`Supported operations:\n\n${help.join('\n')}`);
|
|
@@ -76,12 +73,16 @@ export async function start(processArgs) {
|
|
|
76
73
|
if (!parsedArgumentsLookup.has('config')) {
|
|
77
74
|
const defaultConfigFile = `./${appName}.config`;
|
|
78
75
|
const defaultJsonConfigFile = defaultConfigFile + '.json';
|
|
76
|
+
const defaultJson5ConfigFile = defaultConfigFile + '.json5';
|
|
79
77
|
if (existsSync(defaultConfigFile)) {
|
|
80
78
|
parsedArgumentsLookup.set('config', defaultConfigFile);
|
|
81
79
|
}
|
|
82
80
|
else if (existsSync(defaultJsonConfigFile)) {
|
|
83
81
|
parsedArgumentsLookup.set('config', defaultJsonConfigFile);
|
|
84
82
|
}
|
|
83
|
+
else if (existsSync(defaultJson5ConfigFile)) {
|
|
84
|
+
parsedArgumentsLookup.set('config', defaultJsonConfigFile);
|
|
85
|
+
}
|
|
85
86
|
}
|
|
86
87
|
if (parsedArgumentsLookup.has('config')) {
|
|
87
88
|
const configFilePath = parsedArgumentsLookup.get('config');
|
|
@@ -90,11 +91,11 @@ export async function start(processArgs) {
|
|
|
90
91
|
if (configFilePath.endsWith('.config')) {
|
|
91
92
|
parsedConfigFile = await parseConfigFile(configFilePath);
|
|
92
93
|
}
|
|
93
|
-
else if (configFilePath.endsWith('.config.json')) {
|
|
94
|
+
else if (configFilePath.endsWith('.config.json') || configFilePath.endsWith('.config.json5')) {
|
|
94
95
|
parsedConfigFile = await parseJSONConfigFile(configFilePath);
|
|
95
96
|
}
|
|
96
97
|
else {
|
|
97
|
-
throw new Error(`Specified config file '${configFilePath}' doesn't have a supported extension. Should be either '.config' or '.config.
|
|
98
|
+
throw new Error(`Specified config file '${configFilePath}' doesn't have a supported extension. Should be either '.config', '.config.json', or '.config.json5'`);
|
|
98
99
|
}
|
|
99
100
|
let sectionName = operation;
|
|
100
101
|
if (sectionName.startsWith('speak-')) {
|
|
@@ -136,8 +137,7 @@ export async function start(processArgs) {
|
|
|
136
137
|
operationData.operationOptionsLookup = operationsOptionsLookup;
|
|
137
138
|
}
|
|
138
139
|
catch (e) {
|
|
139
|
-
|
|
140
|
-
logger.logTitledMessage(`Error`, e.message, chalk.redBright, 'error');
|
|
140
|
+
logger.logTitledMessage(`Error`, e.message, 'error');
|
|
141
141
|
process.exit(1);
|
|
142
142
|
}
|
|
143
143
|
for (const key in operationData.globalOptions) {
|
|
@@ -149,12 +149,11 @@ export async function start(processArgs) {
|
|
|
149
149
|
await startWithArgs(operationData);
|
|
150
150
|
}
|
|
151
151
|
catch (e) {
|
|
152
|
-
resetActiveLogger();
|
|
153
152
|
if (debugMode) {
|
|
154
153
|
logger.log(e, 'error');
|
|
155
154
|
}
|
|
156
155
|
else {
|
|
157
|
-
logger.logTitledMessage(`Error`, e.message,
|
|
156
|
+
logger.logTitledMessage(`Error`, e.message, 'error');
|
|
158
157
|
}
|
|
159
158
|
process.exit(1);
|
|
160
159
|
}
|
|
@@ -209,7 +208,9 @@ const help = [
|
|
|
209
208
|
`Options reference: ${chalk.blueBright('https://bit.ly/echogarden-options')}`
|
|
210
209
|
];
|
|
211
210
|
async function startWithArgs(operationData) {
|
|
212
|
-
const logger = new Logger();
|
|
211
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
212
|
+
const packageData = await readAndParseJsonFile(resolveToModuleRootDir('package.json'));
|
|
213
|
+
logger.log(chalk.magentaBright(`Echogarden v${packageData.version}\n`));
|
|
213
214
|
switch (operationData.operation) {
|
|
214
215
|
case 'speak':
|
|
215
216
|
case 'speak-file':
|
|
@@ -295,13 +296,16 @@ async function startWithArgs(operationData) {
|
|
|
295
296
|
break;
|
|
296
297
|
}
|
|
297
298
|
default: {
|
|
298
|
-
logger.logTitledMessage(`Unknown operation`, operationData.operation,
|
|
299
|
+
logger.logTitledMessage(`Unknown operation`, operationData.operation, 'error');
|
|
299
300
|
process.exit(1);
|
|
300
301
|
}
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
304
|
export async function speak(operationData) {
|
|
304
|
-
const logger = new Logger();
|
|
305
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
306
|
+
const callbacks = {
|
|
307
|
+
logLevel: logger.logLevel
|
|
308
|
+
};
|
|
305
309
|
const { operationArgs, operation, operationOptionsLookup, cliOptions } = operationData;
|
|
306
310
|
const mainArg = operationArgs[0];
|
|
307
311
|
const outputFilenames = operationArgs.slice(1);
|
|
@@ -382,18 +386,20 @@ export async function speak(operationData) {
|
|
|
382
386
|
throw new Error(`'${url}' is not a valid URL. Only 'http://' and 'https://' protocols are supported`);
|
|
383
387
|
}
|
|
384
388
|
const { fetchDocumentText } = await import('../utilities/WebReader.js');
|
|
385
|
-
const textContent = await fetchDocumentText(url);
|
|
389
|
+
const textContent = await fetchDocumentText(url, { logLevel: API.getGlobalLogLevel() });
|
|
386
390
|
textSegments = splitToParagraphs(textContent, 'single', 'preserve');
|
|
387
391
|
}
|
|
388
392
|
else if (operation == 'speak-wikipedia') {
|
|
389
393
|
if (options.ssml) {
|
|
390
394
|
throw new Error(`speak-wikipedia doesn't provide SSML inputs`);
|
|
391
395
|
}
|
|
392
|
-
const {
|
|
396
|
+
const { fetchAndParseWikipediaArticle } = await import('../utilities/WikipediaReader.js');
|
|
393
397
|
if (!options.language) {
|
|
394
398
|
options.language = 'en';
|
|
395
399
|
}
|
|
396
|
-
|
|
400
|
+
await logger.startAsync(`Fetching Wikipedia article '${mainArg}'`);
|
|
401
|
+
textSegments = await fetchAndParseWikipediaArticle(mainArg, getShortLanguageCode(options.language), callbacks);
|
|
402
|
+
logger.end();
|
|
397
403
|
}
|
|
398
404
|
else {
|
|
399
405
|
throw new Error(`Invalid operation specified: '${operation}'`);
|
|
@@ -402,7 +408,7 @@ export async function speak(operationData) {
|
|
|
402
408
|
if (includesPlaceholderPattern) {
|
|
403
409
|
logger.start('Write output files for segment');
|
|
404
410
|
}
|
|
405
|
-
await writeOutputFilesForSegment(outputFilenames, segmentData.index, segmentData.total, segmentData.audio, segmentData.timeline, segmentData.transcript, segmentData.language, allowOverwrite);
|
|
411
|
+
await writeOutputFilesForSegment(outputFilenames, segmentData.index, segmentData.total, segmentData.audio, segmentData.timeline, segmentData.transcript, segmentData.language, allowOverwrite, callbacks);
|
|
406
412
|
logger.end();
|
|
407
413
|
if (cliOptions.play) {
|
|
408
414
|
let gainAmount = -3 - segmentData.peakDecibelsSoFar;
|
|
@@ -415,7 +421,7 @@ export async function speak(operationData) {
|
|
|
415
421
|
if (options.outputAudioFormat?.codec) {
|
|
416
422
|
options.outputAudioFormat.codec = undefined;
|
|
417
423
|
}
|
|
418
|
-
const { audio: synthesizedAudio, timeline } = await API.synthesize(textSegments, options,
|
|
424
|
+
const { audio: synthesizedAudio, timeline } = await API.synthesize(textSegments, options, { ...callbacks, onSegment });
|
|
419
425
|
if (plainText) {
|
|
420
426
|
addWordTextOffsetsToTimelineInPlace(timeline, plainText);
|
|
421
427
|
}
|
|
@@ -426,13 +432,13 @@ export async function speak(operationData) {
|
|
|
426
432
|
if (isPlaceholderFilePath(outputFilename)) {
|
|
427
433
|
continue;
|
|
428
434
|
}
|
|
429
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite);
|
|
435
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks);
|
|
430
436
|
await fileSaver(synthesizedAudio, timeline, textSegments.join('\n\n'), options.subtitles);
|
|
431
437
|
}
|
|
432
438
|
logger.end();
|
|
433
439
|
}
|
|
434
440
|
export async function transcribe(operationData) {
|
|
435
|
-
const logger = new Logger();
|
|
441
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
436
442
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData;
|
|
437
443
|
const sourceFilename = operationArgs[0];
|
|
438
444
|
const outputFilenames = operationArgs.slice(1);
|
|
@@ -448,7 +454,8 @@ export async function transcribe(operationData) {
|
|
|
448
454
|
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'RecognitionOptions');
|
|
449
455
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault);
|
|
450
456
|
const { includesPlaceholderPattern } = await checkOutputFilenames(outputFilenames, true, true, true);
|
|
451
|
-
const
|
|
457
|
+
const callbacks = { logLevel: logger.logLevel };
|
|
458
|
+
const { transcript, timeline, wordTimeline, language, inputRawAudio, isolatedRawAudio, backgroundRawAudio } = await API.recognize(sourceFilename, options, callbacks);
|
|
452
459
|
if (outputFilenames.length > 0) {
|
|
453
460
|
logger.start('\nWrite output files');
|
|
454
461
|
}
|
|
@@ -456,9 +463,9 @@ export async function transcribe(operationData) {
|
|
|
456
463
|
if (isPlaceholderFilePath(outputFilename)) {
|
|
457
464
|
continue;
|
|
458
465
|
}
|
|
459
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite);
|
|
466
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks);
|
|
460
467
|
await fileSaver(inputRawAudio, timeline, transcript, options.subtitles);
|
|
461
|
-
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true);
|
|
468
|
+
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true, callbacks);
|
|
462
469
|
}
|
|
463
470
|
logger.end();
|
|
464
471
|
if (cliOptions.play) {
|
|
@@ -474,7 +481,7 @@ export async function transcribe(operationData) {
|
|
|
474
481
|
}
|
|
475
482
|
}
|
|
476
483
|
export async function align(operationData) {
|
|
477
|
-
const logger = new Logger();
|
|
484
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
478
485
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData;
|
|
479
486
|
const audioFilename = operationArgs[0];
|
|
480
487
|
const outputFilenames = operationArgs.slice(2);
|
|
@@ -512,7 +519,10 @@ export async function align(operationData) {
|
|
|
512
519
|
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'AlignmentOptions');
|
|
513
520
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault);
|
|
514
521
|
const { includesPlaceholderPattern } = await checkOutputFilenames(outputFilenames, true, true, true);
|
|
515
|
-
const
|
|
522
|
+
const callbacks = {
|
|
523
|
+
logLevel: logger.logLevel
|
|
524
|
+
};
|
|
525
|
+
const { timeline, wordTimeline, transcript, language, inputRawAudio, isolatedRawAudio, backgroundRawAudio } = await API.align(audioFilename, text, options, callbacks);
|
|
516
526
|
if (outputFilenames.length > 0) {
|
|
517
527
|
logger.start('\nWrite output files');
|
|
518
528
|
}
|
|
@@ -521,16 +531,16 @@ export async function align(operationData) {
|
|
|
521
531
|
const segmentEntry = timeline[segmentIndex];
|
|
522
532
|
const segmentAudio = sliceRawAudioByTime(inputRawAudio, segmentEntry.startTime, segmentEntry.endTime);
|
|
523
533
|
const sentenceTimeline = addTimeOffsetToTimeline(segmentEntry.timeline, -segmentEntry.startTime);
|
|
524
|
-
await writeOutputFilesForSegment(outputFilenames, segmentIndex, timeline.length, segmentAudio, sentenceTimeline, segmentEntry.text, language, allowOverwrite);
|
|
534
|
+
await writeOutputFilesForSegment(outputFilenames, segmentIndex, timeline.length, segmentAudio, sentenceTimeline, segmentEntry.text, language, allowOverwrite, callbacks);
|
|
525
535
|
}
|
|
526
536
|
}
|
|
527
537
|
for (const outputFilename of outputFilenames) {
|
|
528
538
|
if (isPlaceholderFilePath(outputFilename)) {
|
|
529
539
|
continue;
|
|
530
540
|
}
|
|
531
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite);
|
|
541
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks);
|
|
532
542
|
await fileSaver(inputRawAudio, timeline, transcript, options.subtitles);
|
|
533
|
-
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true);
|
|
543
|
+
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true, callbacks);
|
|
534
544
|
}
|
|
535
545
|
logger.end();
|
|
536
546
|
if (cliOptions.play) {
|
|
@@ -546,7 +556,7 @@ export async function align(operationData) {
|
|
|
546
556
|
}
|
|
547
557
|
}
|
|
548
558
|
export async function alignTranslation(operationData) {
|
|
549
|
-
const logger = new Logger();
|
|
559
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
550
560
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData;
|
|
551
561
|
const audioFilename = operationArgs[0];
|
|
552
562
|
const outputFilenames = operationArgs.slice(2);
|
|
@@ -584,7 +594,10 @@ export async function alignTranslation(operationData) {
|
|
|
584
594
|
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'TranslationAlignmentOptions');
|
|
585
595
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault);
|
|
586
596
|
const { includesPlaceholderPattern } = await checkOutputFilenames(outputFilenames, true, true, true);
|
|
587
|
-
const
|
|
597
|
+
const callbacks = {
|
|
598
|
+
logLevel: logger.logLevel
|
|
599
|
+
};
|
|
600
|
+
const { timeline, wordTimeline, translatedTranscript, sourceLanguage, targetLanguage, inputRawAudio, isolatedRawAudio, backgroundRawAudio } = await API.alignTranslation(audioFilename, text, options, callbacks);
|
|
588
601
|
if (outputFilenames.length > 0) {
|
|
589
602
|
logger.start('\nWrite output files');
|
|
590
603
|
}
|
|
@@ -593,16 +606,16 @@ export async function alignTranslation(operationData) {
|
|
|
593
606
|
const segmentEntry = timeline[segmentIndex];
|
|
594
607
|
const segmentAudio = sliceRawAudioByTime(inputRawAudio, segmentEntry.startTime, segmentEntry.endTime);
|
|
595
608
|
const sentenceTimeline = addTimeOffsetToTimeline(segmentEntry.timeline, -segmentEntry.startTime);
|
|
596
|
-
await writeOutputFilesForSegment(outputFilenames, segmentIndex, timeline.length, segmentAudio, sentenceTimeline, segmentEntry.text, targetLanguage, allowOverwrite);
|
|
609
|
+
await writeOutputFilesForSegment(outputFilenames, segmentIndex, timeline.length, segmentAudio, sentenceTimeline, segmentEntry.text, targetLanguage, allowOverwrite, callbacks);
|
|
597
610
|
}
|
|
598
611
|
}
|
|
599
612
|
for (const outputFilename of outputFilenames) {
|
|
600
613
|
if (isPlaceholderFilePath(outputFilename)) {
|
|
601
614
|
continue;
|
|
602
615
|
}
|
|
603
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite);
|
|
616
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks);
|
|
604
617
|
await fileSaver(inputRawAudio, timeline, translatedTranscript, options.subtitles);
|
|
605
|
-
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true);
|
|
618
|
+
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true, callbacks);
|
|
606
619
|
}
|
|
607
620
|
logger.end();
|
|
608
621
|
if (cliOptions.play) {
|
|
@@ -618,7 +631,7 @@ export async function alignTranslation(operationData) {
|
|
|
618
631
|
}
|
|
619
632
|
}
|
|
620
633
|
export async function alignTranscriptAndTranslation(operationData) {
|
|
621
|
-
const logger = new Logger();
|
|
634
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
622
635
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData;
|
|
623
636
|
const audioFilename = operationArgs[0];
|
|
624
637
|
const outputFilenames = operationArgs.slice(3);
|
|
@@ -682,7 +695,10 @@ export async function alignTranscriptAndTranslation(operationData) {
|
|
|
682
695
|
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'TranscriptAndTranslationAlignmentOptions');
|
|
683
696
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault);
|
|
684
697
|
const { includesPlaceholderPattern } = await checkOutputFilenames(outputFilenames, true, true, true);
|
|
685
|
-
const
|
|
698
|
+
const callbacks = {
|
|
699
|
+
logLevel: logger.logLevel
|
|
700
|
+
};
|
|
701
|
+
const { timeline, wordTimeline, translatedTimeline, translatedWordTimeline, sourceLanguage, targetLanguage, inputRawAudio, isolatedRawAudio, backgroundRawAudio } = await API.alignTranscriptAndTranslation(audioFilename, transcript, translatedTranscript, options, callbacks);
|
|
686
702
|
if (outputFilenames.length > 0) {
|
|
687
703
|
logger.start('\nWrite output files');
|
|
688
704
|
}
|
|
@@ -690,14 +706,14 @@ export async function alignTranscriptAndTranslation(operationData) {
|
|
|
690
706
|
if (isPlaceholderFilePath(outputFilename)) {
|
|
691
707
|
continue;
|
|
692
708
|
}
|
|
693
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite);
|
|
709
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks);
|
|
694
710
|
await fileSaver(inputRawAudio, timeline, transcript, options.subtitles);
|
|
695
|
-
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true);
|
|
711
|
+
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true, callbacks);
|
|
696
712
|
const fileExtension = getLowercaseFileExtension(outputFilename);
|
|
697
713
|
if (['json', 'txt', 'srt', 'vtt'].includes(fileExtension)) {
|
|
698
714
|
const pathWithoutExtension = outputFilename.substring(0, outputFilename.lastIndexOf('.'));
|
|
699
715
|
const translatedOutputPath = `${pathWithoutExtension}.translated.${fileExtension}`;
|
|
700
|
-
const translatedFileSaver = getFileSaver(translatedOutputPath, allowOverwrite);
|
|
716
|
+
const translatedFileSaver = getFileSaver(translatedOutputPath, allowOverwrite, callbacks);
|
|
701
717
|
await translatedFileSaver(inputRawAudio, translatedTimeline, translatedTranscript, options.subtitles);
|
|
702
718
|
}
|
|
703
719
|
}
|
|
@@ -715,7 +731,7 @@ export async function alignTranscriptAndTranslation(operationData) {
|
|
|
715
731
|
}
|
|
716
732
|
}
|
|
717
733
|
export async function alignTimelineTranslation(operationData) {
|
|
718
|
-
const logger = new Logger();
|
|
734
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
719
735
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData;
|
|
720
736
|
const timelineFilename = operationArgs[0];
|
|
721
737
|
const outputFilenames = operationArgs.slice(2);
|
|
@@ -752,7 +768,10 @@ export async function alignTimelineTranslation(operationData) {
|
|
|
752
768
|
throw new Error(`align only supports reference files with extensions 'txt', 'html', 'htm', 'srt' or 'vtt'`);
|
|
753
769
|
}
|
|
754
770
|
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'TimelineTranslationAlignmentOptions');
|
|
755
|
-
const
|
|
771
|
+
const callbacks = {
|
|
772
|
+
logLevel: logger.logLevel
|
|
773
|
+
};
|
|
774
|
+
const { timeline: translationTimeline, wordTimeline: translationWordTimeline, rawAudio } = await API.alignTimelineTranslation(timeline, translationText, options, callbacks);
|
|
756
775
|
if (outputFilenames.length > 0) {
|
|
757
776
|
logger.start('\nWrite output files');
|
|
758
777
|
}
|
|
@@ -761,7 +780,7 @@ export async function alignTimelineTranslation(operationData) {
|
|
|
761
780
|
if (isPlaceholderFilePath(outputFilename)) {
|
|
762
781
|
continue;
|
|
763
782
|
}
|
|
764
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite);
|
|
783
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks);
|
|
765
784
|
await fileSaver(getEmptyRawAudio(1, 16000), translationTimeline, translationText, options.subtitles);
|
|
766
785
|
}
|
|
767
786
|
logger.end();
|
|
@@ -775,7 +794,7 @@ export async function alignTimelineTranslation(operationData) {
|
|
|
775
794
|
}
|
|
776
795
|
}
|
|
777
796
|
export async function translateText(operationData) {
|
|
778
|
-
const logger = new Logger();
|
|
797
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
779
798
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData;
|
|
780
799
|
const inputFilename = operationArgs[0];
|
|
781
800
|
const outputFilenames = operationArgs.slice(1);
|
|
@@ -803,14 +822,17 @@ export async function translateText(operationData) {
|
|
|
803
822
|
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'TextTranslationOptions');
|
|
804
823
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault);
|
|
805
824
|
await checkOutputFilenames(outputFilenames, false, true, true);
|
|
806
|
-
const
|
|
825
|
+
const callbacks = {
|
|
826
|
+
logLevel: logger.logLevel
|
|
827
|
+
};
|
|
828
|
+
const { text, translatedText, translationPairs, sourceLanguage, targetLanguage, } = await API.translateText(inputText, options, callbacks);
|
|
807
829
|
if (outputFilenames.length > 0) {
|
|
808
830
|
logger.start('\nWrite output files');
|
|
809
831
|
for (const outputFilename of outputFilenames) {
|
|
810
832
|
if (isPlaceholderFilePath(outputFilename)) {
|
|
811
833
|
continue;
|
|
812
834
|
}
|
|
813
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite);
|
|
835
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks);
|
|
814
836
|
await fileSaver(getEmptyRawAudio(1, 16000), translationPairs, translatedText, undefined);
|
|
815
837
|
}
|
|
816
838
|
logger.end();
|
|
@@ -821,7 +843,7 @@ export async function translateText(operationData) {
|
|
|
821
843
|
}
|
|
822
844
|
}
|
|
823
845
|
export async function translateSpeech(operationData) {
|
|
824
|
-
const logger = new Logger();
|
|
846
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
825
847
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData;
|
|
826
848
|
const inputFilename = operationArgs[0];
|
|
827
849
|
const outputFilenames = operationArgs.slice(1);
|
|
@@ -837,7 +859,10 @@ export async function translateSpeech(operationData) {
|
|
|
837
859
|
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'SpeechTranslationOptions');
|
|
838
860
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault);
|
|
839
861
|
await checkOutputFilenames(outputFilenames, true, true, true);
|
|
840
|
-
const
|
|
862
|
+
const callbacks = {
|
|
863
|
+
logLevel: logger.logLevel
|
|
864
|
+
};
|
|
865
|
+
const { transcript, timeline, wordTimeline, sourceLanguage, targetLanguage, inputRawAudio, isolatedRawAudio, backgroundRawAudio } = await API.translateSpeech(inputFilename, options, callbacks);
|
|
841
866
|
if (outputFilenames.length > 0) {
|
|
842
867
|
logger.start('\nWrite output files');
|
|
843
868
|
}
|
|
@@ -845,9 +870,9 @@ export async function translateSpeech(operationData) {
|
|
|
845
870
|
if (isPlaceholderFilePath(outputFilename)) {
|
|
846
871
|
continue;
|
|
847
872
|
}
|
|
848
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite);
|
|
873
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks);
|
|
849
874
|
await fileSaver(inputRawAudio, timeline, transcript, options.subtitles);
|
|
850
|
-
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true);
|
|
875
|
+
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, true, callbacks);
|
|
851
876
|
}
|
|
852
877
|
logger.end();
|
|
853
878
|
if (cliOptions.play) {
|
|
@@ -883,7 +908,7 @@ export async function translateSpeech(operationData) {
|
|
|
883
908
|
}
|
|
884
909
|
}
|
|
885
910
|
export async function detectLanguage(operationData, mode) {
|
|
886
|
-
const logger = new Logger();
|
|
911
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
887
912
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData;
|
|
888
913
|
const inputFilePath = operationArgs[0];
|
|
889
914
|
const outputFilenames = operationArgs.slice(1);
|
|
@@ -908,7 +933,10 @@ export async function detectLanguage(operationData, mode) {
|
|
|
908
933
|
if (inputFileExtension == 'srt' || inputFileExtension == 'vtt') {
|
|
909
934
|
text = subtitlesToText(text);
|
|
910
935
|
}
|
|
911
|
-
const
|
|
936
|
+
const callbacks = {
|
|
937
|
+
logLevel: logger.logLevel
|
|
938
|
+
};
|
|
939
|
+
const { detectedLanguage, detectedLanguageProbabilities } = await API.detectTextLanguage(text, options, callbacks);
|
|
912
940
|
results = detectedLanguageProbabilities;
|
|
913
941
|
}
|
|
914
942
|
else {
|
|
@@ -918,14 +946,20 @@ export async function detectLanguage(operationData, mode) {
|
|
|
918
946
|
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'SpeechLanguageDetectionOptions');
|
|
919
947
|
allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault);
|
|
920
948
|
await checkOutputFilenames(outputFilenames, false, true, false);
|
|
921
|
-
const
|
|
949
|
+
const callbacks = {
|
|
950
|
+
logLevel: logger.logLevel
|
|
951
|
+
};
|
|
952
|
+
const { detectedLanguage, detectedLanguageProbabilities } = await API.detectSpeechLanguage(inputFilePath, options, callbacks);
|
|
922
953
|
results = detectedLanguageProbabilities;
|
|
923
954
|
}
|
|
924
955
|
if (outputFilenames.length > 0) {
|
|
925
956
|
logger.start('\nWrite output files');
|
|
926
957
|
const resultsAsText = results.map(result => `${formatLanguageCodeWithName(result.language)}: ${result.probability.toFixed(5)}`).join('\n');
|
|
958
|
+
const callbacks = {
|
|
959
|
+
logLevel: logger.logLevel
|
|
960
|
+
};
|
|
927
961
|
for (const outputFilename of outputFilenames) {
|
|
928
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite);
|
|
962
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks);
|
|
929
963
|
await fileSaver(getEmptyRawAudio(0, 0), results, resultsAsText);
|
|
930
964
|
}
|
|
931
965
|
}
|
|
@@ -937,7 +971,7 @@ export async function detectLanguage(operationData, mode) {
|
|
|
937
971
|
logger.end();
|
|
938
972
|
}
|
|
939
973
|
export async function detectVoiceActivity(operationData) {
|
|
940
|
-
const logger = new Logger();
|
|
974
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
941
975
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData;
|
|
942
976
|
const audioFilename = operationArgs[0];
|
|
943
977
|
const outputFilenames = operationArgs.slice(1);
|
|
@@ -950,10 +984,13 @@ export async function detectVoiceActivity(operationData) {
|
|
|
950
984
|
if (cliOptions.play == null) {
|
|
951
985
|
cliOptions.play = outputFilenames.length === 0;
|
|
952
986
|
}
|
|
953
|
-
const options = await optionsLookupToTypedObject(operationOptionsLookup, '
|
|
987
|
+
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'VoiceActivityDetectionOptions');
|
|
954
988
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault);
|
|
955
989
|
await checkOutputFilenames(outputFilenames, true, true, true);
|
|
956
|
-
|
|
990
|
+
const callbacks = {
|
|
991
|
+
logLevel: logger.logLevel
|
|
992
|
+
};
|
|
993
|
+
let { timeline, verboseTimeline, inputRawAudio, croppedRawAudio } = await API.detectVoiceActivity(audioFilename, options, callbacks);
|
|
957
994
|
if (outputFilenames.length > 0) {
|
|
958
995
|
logger.start('\nWrite output files');
|
|
959
996
|
}
|
|
@@ -961,13 +998,13 @@ export async function detectVoiceActivity(operationData) {
|
|
|
961
998
|
if (isPlaceholderFilePath(outputFilename)) {
|
|
962
999
|
continue;
|
|
963
1000
|
}
|
|
964
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite);
|
|
1001
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks);
|
|
965
1002
|
await fileSaver(inputRawAudio, timeline, '', { maxAddedDuration: 0 });
|
|
966
1003
|
const fileExtension = getLowercaseFileExtension(outputFilename);
|
|
967
1004
|
if (supportedOutputMediaFileExtensions.includes(fileExtension)) {
|
|
968
1005
|
const pathWithoutExtension = outputFilename.substring(0, outputFilename.lastIndexOf('.'));
|
|
969
1006
|
const isolatedOutputFilePath = `${pathWithoutExtension}.cropped.${fileExtension}`;
|
|
970
|
-
const fileSaver = getFileSaver(isolatedOutputFilePath, allowOverwrite);
|
|
1007
|
+
const fileSaver = getFileSaver(isolatedOutputFilePath, allowOverwrite, callbacks);
|
|
971
1008
|
await fileSaver(croppedRawAudio, [], '');
|
|
972
1009
|
}
|
|
973
1010
|
}
|
|
@@ -981,7 +1018,7 @@ export async function detectVoiceActivity(operationData) {
|
|
|
981
1018
|
}
|
|
982
1019
|
}
|
|
983
1020
|
export async function denoise(operationData) {
|
|
984
|
-
const logger = new Logger();
|
|
1021
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
985
1022
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData;
|
|
986
1023
|
const audioFilename = operationArgs[0];
|
|
987
1024
|
const outputFilenames = operationArgs.slice(1);
|
|
@@ -997,12 +1034,15 @@ export async function denoise(operationData) {
|
|
|
997
1034
|
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'DenoisingOptions');
|
|
998
1035
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault);
|
|
999
1036
|
await checkOutputFilenames(outputFilenames, true, false, false);
|
|
1000
|
-
const
|
|
1037
|
+
const callbacks = {
|
|
1038
|
+
logLevel: logger.logLevel
|
|
1039
|
+
};
|
|
1040
|
+
const { denoisedAudio } = await API.denoise(audioFilename, options, callbacks);
|
|
1001
1041
|
if (outputFilenames.length > 0) {
|
|
1002
1042
|
logger.start('\nWrite output files');
|
|
1003
1043
|
}
|
|
1004
1044
|
for (const outputFilename of outputFilenames) {
|
|
1005
|
-
const fileSaver = getFileSaver(outputFilename, allowOverwrite);
|
|
1045
|
+
const fileSaver = getFileSaver(outputFilename, allowOverwrite, callbacks);
|
|
1006
1046
|
await fileSaver(denoisedAudio, [], '');
|
|
1007
1047
|
}
|
|
1008
1048
|
logger.end();
|
|
@@ -1011,7 +1051,7 @@ export async function denoise(operationData) {
|
|
|
1011
1051
|
}
|
|
1012
1052
|
}
|
|
1013
1053
|
export async function isolate(operationData) {
|
|
1014
|
-
const logger = new Logger();
|
|
1054
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
1015
1055
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData;
|
|
1016
1056
|
const audioFilename = operationArgs[0];
|
|
1017
1057
|
const outputFilenames = operationArgs.slice(1);
|
|
@@ -1027,12 +1067,15 @@ export async function isolate(operationData) {
|
|
|
1027
1067
|
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'SourceSeparationOptions');
|
|
1028
1068
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault);
|
|
1029
1069
|
await checkOutputFilenames(outputFilenames, true, false, false);
|
|
1030
|
-
const
|
|
1070
|
+
const callbacks = {
|
|
1071
|
+
logLevel: logger.logLevel
|
|
1072
|
+
};
|
|
1073
|
+
const { inputRawAudio, isolatedRawAudio, backgroundRawAudio } = await API.isolate(audioFilename, options, callbacks);
|
|
1031
1074
|
if (outputFilenames.length > 0) {
|
|
1032
1075
|
logger.start('\nWrite output files');
|
|
1033
1076
|
}
|
|
1034
1077
|
for (let outputFilename of outputFilenames) {
|
|
1035
|
-
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, false);
|
|
1078
|
+
await writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, false, callbacks);
|
|
1036
1079
|
}
|
|
1037
1080
|
logger.end();
|
|
1038
1081
|
if (cliOptions.play) {
|
|
@@ -1040,7 +1083,7 @@ export async function isolate(operationData) {
|
|
|
1040
1083
|
}
|
|
1041
1084
|
}
|
|
1042
1085
|
export async function listEngines(operationData) {
|
|
1043
|
-
const logger = new Logger();
|
|
1086
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
1044
1087
|
const { operationArgs } = operationData;
|
|
1045
1088
|
const targetOperation = operationArgs[0];
|
|
1046
1089
|
if (!targetOperation) {
|
|
@@ -1114,17 +1157,17 @@ export async function listEngines(operationData) {
|
|
|
1114
1157
|
}
|
|
1115
1158
|
}
|
|
1116
1159
|
for (const [index, engine] of engines.entries()) {
|
|
1117
|
-
logger.logTitledMessage('Identifier', chalk.magentaBright(engine.id),
|
|
1118
|
-
logger.logTitledMessage('Name', engine.name,
|
|
1119
|
-
logger.logTitledMessage('Description', engine.description,
|
|
1120
|
-
logger.logTitledMessage('Type', engine.type,
|
|
1160
|
+
logger.logTitledMessage('Identifier', chalk.magentaBright(engine.id), 'output');
|
|
1161
|
+
logger.logTitledMessage('Name', engine.name, 'output');
|
|
1162
|
+
logger.logTitledMessage('Description', engine.description, 'output');
|
|
1163
|
+
logger.logTitledMessage('Type', engine.type, 'output');
|
|
1121
1164
|
if (index < engines.length - 1) {
|
|
1122
1165
|
logger.log('', 'output');
|
|
1123
1166
|
}
|
|
1124
1167
|
}
|
|
1125
1168
|
}
|
|
1126
1169
|
export async function listTTSVoices(operationData) {
|
|
1127
|
-
const logger = new Logger();
|
|
1170
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
1128
1171
|
const { operationArgs, operationOptionsLookup, cliOptions } = operationData;
|
|
1129
1172
|
const targetEngine = operationArgs[0];
|
|
1130
1173
|
const outputFilenames = operationArgs.slice(1);
|
|
@@ -1139,7 +1182,10 @@ export async function listTTSVoices(operationData) {
|
|
|
1139
1182
|
const options = await optionsLookupToTypedObject(operationOptionsLookup, 'VoiceListRequestOptions');
|
|
1140
1183
|
const allowOverwrite = getWithDefault(cliOptions.overwrite, overwriteByDefault);
|
|
1141
1184
|
await checkOutputFilenames(outputFilenames, false, true, false);
|
|
1142
|
-
const
|
|
1185
|
+
const callbacks = {
|
|
1186
|
+
logLevel: logger.logLevel
|
|
1187
|
+
};
|
|
1188
|
+
const { voiceList } = await API.requestVoiceList(options, callbacks);
|
|
1143
1189
|
const voiceListText = voiceList.map(entry => {
|
|
1144
1190
|
const nameText = entry.name;
|
|
1145
1191
|
const languagesNamesText = entry.languages.map(language => formatLanguageCodeWithName(language)).join(', ');
|
|
@@ -1154,7 +1200,7 @@ export async function listTTSVoices(operationData) {
|
|
|
1154
1200
|
if (outputFilenames.length > 0) {
|
|
1155
1201
|
logger.start('\nWrite output files');
|
|
1156
1202
|
for (const filename of outputFilenames) {
|
|
1157
|
-
const fileSaver = getFileSaver(filename, allowOverwrite);
|
|
1203
|
+
const fileSaver = getFileSaver(filename, allowOverwrite, callbacks);
|
|
1158
1204
|
const { default: stripAnsi } = await import('strip-ansi');
|
|
1159
1205
|
const voiceListTextWithoutColors = stripAnsi(voiceListText);
|
|
1160
1206
|
await fileSaver(getEmptyRawAudio(0, 0), voiceList, voiceListTextWithoutColors);
|
|
@@ -1166,7 +1212,10 @@ export async function listTTSVoices(operationData) {
|
|
|
1166
1212
|
logger.end();
|
|
1167
1213
|
}
|
|
1168
1214
|
export async function installPackages(operationData) {
|
|
1169
|
-
const
|
|
1215
|
+
const callbacks = {
|
|
1216
|
+
logLevel: API.getGlobalLogLevel()
|
|
1217
|
+
};
|
|
1218
|
+
const logger = new Logger(callbacks.logLevel);
|
|
1170
1219
|
const { operationArgs } = operationData;
|
|
1171
1220
|
if (operationArgs.length == 0) {
|
|
1172
1221
|
throw new Error('No package names specified');
|
|
@@ -1174,11 +1223,10 @@ export async function installPackages(operationData) {
|
|
|
1174
1223
|
const failedPackageNames = [];
|
|
1175
1224
|
for (const packageName of operationArgs) {
|
|
1176
1225
|
try {
|
|
1177
|
-
await loadPackage(packageName);
|
|
1226
|
+
await loadPackage(packageName, callbacks);
|
|
1178
1227
|
}
|
|
1179
1228
|
catch (e) {
|
|
1180
|
-
|
|
1181
|
-
logger.logTitledMessage(`Failed installing package ${packageName}`, e, chalk.redBright, 'error');
|
|
1229
|
+
logger.logTitledMessage(`Failed installing package ${packageName}`, e, 'error');
|
|
1182
1230
|
failedPackageNames.push(packageName);
|
|
1183
1231
|
}
|
|
1184
1232
|
}
|
|
@@ -1192,7 +1240,7 @@ export async function installPackages(operationData) {
|
|
|
1192
1240
|
}
|
|
1193
1241
|
}
|
|
1194
1242
|
export async function uninstallPackages(operationData) {
|
|
1195
|
-
const logger = new Logger();
|
|
1243
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
1196
1244
|
const { operationArgs } = operationData;
|
|
1197
1245
|
if (operationArgs.length == 0) {
|
|
1198
1246
|
throw new Error('No package names specified');
|
|
@@ -1203,8 +1251,7 @@ export async function uninstallPackages(operationData) {
|
|
|
1203
1251
|
await removePackage(packageName);
|
|
1204
1252
|
}
|
|
1205
1253
|
catch (e) {
|
|
1206
|
-
|
|
1207
|
-
logger.logTitledMessage(`Failed uninstalling package ${packageName}`, e, chalk.redBright, 'error');
|
|
1254
|
+
logger.logTitledMessage(`Failed uninstalling package ${packageName}`, e, 'error');
|
|
1208
1255
|
failedPackageNames.push(packageName);
|
|
1209
1256
|
}
|
|
1210
1257
|
}
|
|
@@ -1213,7 +1260,7 @@ export async function uninstallPackages(operationData) {
|
|
|
1213
1260
|
}
|
|
1214
1261
|
}
|
|
1215
1262
|
export async function listPackages(operationData) {
|
|
1216
|
-
const logger = new Logger();
|
|
1263
|
+
const logger = new Logger(API.getGlobalLogLevel());
|
|
1217
1264
|
const packagesDir = await ensureAndGetPackagesDir();
|
|
1218
1265
|
const installedPackageNames = await readdir(packagesDir);
|
|
1219
1266
|
const installedPackageNamesFormatted = installedPackageNames.map(packageName => {
|
|
@@ -1244,22 +1291,22 @@ export async function serve(operationData) {
|
|
|
1244
1291
|
}
|
|
1245
1292
|
await startServer(options, onServerStarted);
|
|
1246
1293
|
}
|
|
1247
|
-
async function writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, prefixIsolated) {
|
|
1294
|
+
async function writeSourceSeparationOutputIfNeeded(outputFilename, isolatedRawAudio, backgroundRawAudio, allowOverwrite, prefixIsolated, callbacks) {
|
|
1248
1295
|
// Write source separation output if needed
|
|
1249
1296
|
const fileExtension = getLowercaseFileExtension(outputFilename);
|
|
1250
1297
|
if (isolatedRawAudio && backgroundRawAudio && supportedOutputMediaFileExtensions.includes(fileExtension)) {
|
|
1251
1298
|
const pathWithoutExtension = outputFilename.substring(0, outputFilename.lastIndexOf('.'));
|
|
1252
1299
|
{
|
|
1253
1300
|
const isolatedOutputFilePath = prefixIsolated ? `${pathWithoutExtension}.isolated.${fileExtension}` : outputFilename;
|
|
1254
|
-
await saveAudioWithBitrate(isolatedRawAudio, isolatedOutputFilePath, fileExtension, 64);
|
|
1301
|
+
await saveAudioWithBitrate(isolatedRawAudio, isolatedOutputFilePath, fileExtension, 64, callbacks);
|
|
1255
1302
|
}
|
|
1256
1303
|
{
|
|
1257
1304
|
const backgroundOutputFilePath = `${pathWithoutExtension}.background.${fileExtension}`;
|
|
1258
|
-
await saveAudioWithBitrate(backgroundRawAudio, backgroundOutputFilePath, fileExtension, 128);
|
|
1305
|
+
await saveAudioWithBitrate(backgroundRawAudio, backgroundOutputFilePath, fileExtension, 128, callbacks);
|
|
1259
1306
|
}
|
|
1260
1307
|
}
|
|
1261
1308
|
}
|
|
1262
|
-
async function saveAudioWithBitrate(rawAudio, filepath, fileExtension, bitrate) {
|
|
1309
|
+
async function saveAudioWithBitrate(rawAudio, filepath, fileExtension, bitrate, callbacks) {
|
|
1263
1310
|
const fileDir = parsePath(filepath).dir || './';
|
|
1264
1311
|
if (fileExtension == 'wav') {
|
|
1265
1312
|
await ensureDir(fileDir);
|
|
@@ -1269,7 +1316,7 @@ async function saveAudioWithBitrate(rawAudio, filepath, fileExtension, bitrate)
|
|
|
1269
1316
|
const ffmpegOptions = getDefaultFFMpegOptionsForSpeech(fileExtension, bitrate);
|
|
1270
1317
|
ffmpegOptions.filename = filepath;
|
|
1271
1318
|
await ensureDir(fileDir);
|
|
1272
|
-
await encodeFromChannels(rawAudio, ffmpegOptions);
|
|
1319
|
+
await encodeFromChannels(rawAudio, ffmpegOptions, callbacks);
|
|
1273
1320
|
}
|
|
1274
1321
|
}
|
|
1275
1322
|
async function optionsLookupToTypedObject(cliOptionsMap, optionsRoot, additionalOptionsSchema) {
|
|
@@ -1342,14 +1389,14 @@ async function optionsLookupToTypedObject(cliOptionsMap, optionsRoot, additional
|
|
|
1342
1389
|
}
|
|
1343
1390
|
else if (optionType == 'array' || optionType == 'object') {
|
|
1344
1391
|
try {
|
|
1345
|
-
parsedValue =
|
|
1392
|
+
parsedValue = parseJson(value, true);
|
|
1346
1393
|
}
|
|
1347
1394
|
catch (e) {
|
|
1348
1395
|
parsedValue = value;
|
|
1349
1396
|
}
|
|
1350
1397
|
}
|
|
1351
1398
|
else if (optionIsUnion) {
|
|
1352
|
-
const { parsedValue: json5ParsedValue, jsonType } =
|
|
1399
|
+
const { parsedValue: json5ParsedValue, jsonType } = parseJSONAndGetType(value, true);
|
|
1353
1400
|
if (jsonType === 'number' || jsonType === 'boolean' || jsonType === 'array' || jsonType === 'object') {
|
|
1354
1401
|
parsedValue = json5ParsedValue;
|
|
1355
1402
|
}
|
|
@@ -1409,7 +1456,7 @@ async function checkOutputFilenames(outputFilenames, acceptMediaOutputs, acceptM
|
|
|
1409
1456
|
}
|
|
1410
1457
|
return { includesPlaceholderPattern };
|
|
1411
1458
|
}
|
|
1412
|
-
async function writeOutputFilesForSegment(outputFilenames, index, total, audio, timeline, text, language, allowOverwrite) {
|
|
1459
|
+
async function writeOutputFilesForSegment(outputFilenames, index, total, audio, timeline, text, language, allowOverwrite, callbacks) {
|
|
1413
1460
|
const digitCount = Math.max((total + 1).toString().length, 2);
|
|
1414
1461
|
const segmentWords = (await splitToWords(text, language)).nonPunctuationWords;
|
|
1415
1462
|
const segmentJoinedWords = segmentWords.join(' ').trim();
|
|
@@ -1428,11 +1475,11 @@ async function writeOutputFilesForSegment(outputFilenames, index, total, audio,
|
|
|
1428
1475
|
const fileDir = getDirName(outputFilename);
|
|
1429
1476
|
const fileExtension = getLowercaseFileExtension(outputFilename);
|
|
1430
1477
|
const segmentFilename = joinPath(fileDir, `${formatIntegerWithLeadingZeros(index + 1, digitCount)} - ${initialText}.${fileExtension}`);
|
|
1431
|
-
const fileSaver = getFileSaver(segmentFilename, allowOverwrite);
|
|
1478
|
+
const fileSaver = getFileSaver(segmentFilename, allowOverwrite, callbacks);
|
|
1432
1479
|
await fileSaver(audio, timeline, text);
|
|
1433
1480
|
}
|
|
1434
1481
|
}
|
|
1435
|
-
function getFileSaver(outputFilePath, allowOverwrite) {
|
|
1482
|
+
function getFileSaver(outputFilePath, allowOverwrite, callbacks) {
|
|
1436
1483
|
const parsedPath = parsePath(outputFilePath);
|
|
1437
1484
|
const fileDir = parsedPath.dir || './';
|
|
1438
1485
|
if (!allowOverwrite) {
|
|
@@ -1456,7 +1503,7 @@ function getFileSaver(outputFilePath, allowOverwrite) {
|
|
|
1456
1503
|
fileSaver = async (audio, timeline, text) => {
|
|
1457
1504
|
await ensureDir(fileDir);
|
|
1458
1505
|
const roundedTimeline = roundTimelineProperties(timeline);
|
|
1459
|
-
return writeFileSafe(outputFilePath,
|
|
1506
|
+
return writeFileSafe(outputFilePath, stringifyAndFormatJson(roundedTimeline));
|
|
1460
1507
|
};
|
|
1461
1508
|
}
|
|
1462
1509
|
else if (fileExtension == 'srt') {
|
|
@@ -1496,7 +1543,7 @@ function getFileSaver(outputFilePath, allowOverwrite) {
|
|
|
1496
1543
|
const ffmpegOptions = getDefaultFFMpegOptionsForSpeech(fileExtension);
|
|
1497
1544
|
ffmpegOptions.filename = outputFilePath;
|
|
1498
1545
|
await ensureDir(fileDir);
|
|
1499
|
-
await encodeFromChannels(audio, ffmpegOptions);
|
|
1546
|
+
await encodeFromChannels(audio, ffmpegOptions, callbacks);
|
|
1500
1547
|
return;
|
|
1501
1548
|
};
|
|
1502
1549
|
}
|