echogarden 2.10.2 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.MIT.md +7 -0
- package/README.md +9 -1
- package/data/lexicons/heteronyms.en.json +44 -10
- package/data/lexicons/words.en.json +726 -22
- package/data/schemas/options.json +91 -153
- package/dist/alignment/DTWMfccSequenceAlignment.js.map +1 -1
- package/dist/alignment/SemanticTextAlignment.d.ts +4 -2
- package/dist/alignment/SemanticTextAlignment.d.ts.map +1 -1
- package/dist/alignment/SemanticTextAlignment.js +7 -7
- package/dist/alignment/SemanticTextAlignment.js.map +1 -1
- package/dist/alignment/SpeechAlignment.d.ts +9 -10
- package/dist/alignment/SpeechAlignment.d.ts.map +1 -1
- package/dist/alignment/SpeechAlignment.js +23 -96
- package/dist/alignment/SpeechAlignment.js.map +1 -1
- package/dist/api/APIOptions.d.ts +1 -1
- package/dist/api/APIOptions.d.ts.map +1 -1
- package/dist/api/Alignment.d.ts +8 -6
- package/dist/api/Alignment.d.ts.map +1 -1
- package/dist/api/Alignment.js +31 -40
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/Common.d.ts +7 -0
- package/dist/api/Common.d.ts.map +1 -1
- package/dist/api/Common.js.map +1 -1
- package/dist/api/Denoising.d.ts +5 -2
- package/dist/api/Denoising.d.ts.map +1 -1
- package/dist/api/Denoising.js +15 -15
- package/dist/api/Denoising.js.map +1 -1
- package/dist/api/GlobalOptions.d.ts +2 -8
- package/dist/api/GlobalOptions.d.ts.map +1 -1
- package/dist/api/GlobalOptions.js +2 -13
- package/dist/api/GlobalOptions.js.map +1 -1
- package/dist/api/Recognition.d.ts +11 -12
- package/dist/api/Recognition.d.ts.map +1 -1
- package/dist/api/Recognition.js +32 -82
- package/dist/api/Recognition.js.map +1 -1
- package/dist/api/SourceSeparation.d.ts +7 -2
- package/dist/api/SourceSeparation.d.ts.map +1 -1
- package/dist/api/SourceSeparation.js +12 -10
- package/dist/api/SourceSeparation.js.map +1 -1
- package/dist/api/SpeechLanguageDetection.d.ts +11 -7
- package/dist/api/SpeechLanguageDetection.d.ts.map +1 -1
- package/dist/api/SpeechLanguageDetection.js +37 -30
- package/dist/api/SpeechLanguageDetection.js.map +1 -1
- package/dist/api/SpeechSearch.d.ts +4 -1
- package/dist/api/SpeechSearch.d.ts.map +1 -1
- package/dist/api/SpeechSearch.js.map +1 -1
- package/dist/api/SpeechTranslation.d.ts +10 -6
- package/dist/api/SpeechTranslation.d.ts.map +1 -1
- package/dist/api/SpeechTranslation.js +28 -26
- package/dist/api/SpeechTranslation.js.map +1 -1
- package/dist/api/Synthesis.d.ts +13 -8
- package/dist/api/Synthesis.d.ts.map +1 -1
- package/dist/api/Synthesis.js +67 -89
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/api/TextLanguageDetection.d.ts +4 -2
- package/dist/api/TextLanguageDetection.d.ts.map +1 -1
- package/dist/api/TextLanguageDetection.js +4 -7
- package/dist/api/TextLanguageDetection.js.map +1 -1
- package/dist/api/TextTranslation.d.ts +4 -2
- package/dist/api/TextTranslation.d.ts.map +1 -1
- package/dist/api/TextTranslation.js +13 -24
- package/dist/api/TextTranslation.js.map +1 -1
- package/dist/api/TimelineTranslationAlignment.d.ts +6 -3
- package/dist/api/TimelineTranslationAlignment.d.ts.map +1 -1
- package/dist/api/TimelineTranslationAlignment.js +20 -11
- package/dist/api/TimelineTranslationAlignment.js.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.d.ts +6 -4
- package/dist/api/TranscriptAndTranslationAlignment.d.ts.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.js +11 -12
- package/dist/api/TranscriptAndTranslationAlignment.js.map +1 -1
- package/dist/api/TranslationAlignment.d.ts +6 -4
- package/dist/api/TranslationAlignment.d.ts.map +1 -1
- package/dist/api/TranslationAlignment.js +20 -21
- package/dist/api/TranslationAlignment.js.map +1 -1
- package/dist/api/VoiceActivityDetection.d.ts +9 -8
- package/dist/api/VoiceActivityDetection.d.ts.map +1 -1
- package/dist/api/VoiceActivityDetection.js +20 -43
- package/dist/api/VoiceActivityDetection.js.map +1 -1
- package/dist/audio/AudioBufferConversion.js.map +1 -1
- package/dist/audio/AudioPlayer.d.ts +1 -3
- package/dist/audio/AudioPlayer.d.ts.map +1 -1
- package/dist/audio/AudioPlayer.js +3 -188
- package/dist/audio/AudioPlayer.js.map +1 -1
- package/dist/audio/AudioUtilities.d.ts +2 -1
- package/dist/audio/AudioUtilities.d.ts.map +1 -1
- package/dist/audio/AudioUtilities.js +2 -2
- package/dist/audio/AudioUtilities.js.map +1 -1
- package/dist/build-tools/MakeTarballsForInstalledPackages.js +3 -3
- package/dist/build-tools/MakeTarballsForInstalledPackages.js.map +1 -1
- package/dist/cli/CLI.d.ts.map +1 -1
- package/dist/cli/CLI.js +139 -92
- package/dist/cli/CLI.js.map +1 -1
- package/dist/codecs/FFMpegTranscoder.d.ts +4 -3
- package/dist/codecs/FFMpegTranscoder.d.ts.map +1 -1
- package/dist/codecs/FFMpegTranscoder.js +16 -14
- package/dist/codecs/FFMpegTranscoder.js.map +1 -1
- package/dist/codecs/TIMITCodec.d.ts.map +1 -1
- package/dist/data-structures/DynamicTypedArray.d.ts.map +1 -1
- package/dist/data-structures/DynamicTypedArray.js.map +1 -1
- package/dist/data-structures/Queue.d.ts.map +1 -1
- package/dist/data-structures/WindowedList.d.ts.map +1 -1
- package/dist/data-structures/WindowedList.js.map +1 -1
- package/dist/denoising/NSNet2.d.ts +3 -2
- package/dist/denoising/NSNet2.d.ts.map +1 -1
- package/dist/denoising/NSNet2.js +4 -4
- package/dist/denoising/NSNet2.js.map +1 -1
- package/dist/denoising/RNNoise.d.ts +2 -1
- package/dist/denoising/RNNoise.d.ts.map +1 -1
- package/dist/denoising/RNNoise.js +10 -6
- package/dist/denoising/RNNoise.js.map +1 -1
- package/dist/dsp/BiquadFilter.d.ts.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.d.ts.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.js.map +1 -1
- package/dist/dsp/FFT.d.ts.map +1 -1
- package/dist/dsp/FFT.js +2 -1
- package/dist/dsp/FFT.js.map +1 -1
- package/dist/dsp/KWeightingFilter.d.ts.map +1 -1
- package/dist/dsp/KWeightingFilter.js.map +1 -1
- package/dist/dsp/LoudnessEstimator.d.ts.map +1 -1
- package/dist/dsp/LoudnessEstimator.js.map +1 -1
- package/dist/dsp/MFCC.d.ts +3 -2
- package/dist/dsp/MFCC.d.ts.map +1 -1
- package/dist/dsp/MFCC.js +4 -4
- package/dist/dsp/MFCC.js.map +1 -1
- package/dist/dsp/MelSpectrogram.d.ts +10 -8
- package/dist/dsp/MelSpectrogram.d.ts.map +1 -1
- package/dist/dsp/MelSpectrogram.js +31 -34
- package/dist/dsp/MelSpectrogram.js.map +1 -1
- package/dist/dsp/Rubberband.d.ts.map +1 -1
- package/dist/dsp/Rubberband.js +8 -3
- package/dist/dsp/Rubberband.js.map +1 -1
- package/dist/dsp/Sonic.d.ts.map +1 -1
- package/dist/dsp/Sonic.js +1 -1
- package/dist/dsp/Sonic.js.map +1 -1
- package/dist/dsp/SpeexResampler.d.ts.map +1 -1
- package/dist/dsp/SpeexResampler.js +1 -1
- package/dist/dsp/SpeexResampler.js.map +1 -1
- package/dist/encodings/Ascii.d.ts +1 -1
- package/dist/encodings/Ascii.d.ts.map +1 -1
- package/dist/encodings/Base64.js.map +1 -1
- package/dist/encodings/Utf16.d.ts.map +1 -1
- package/dist/encodings/Utf8.d.ts.map +1 -1
- package/dist/math/VectorMath.d.ts +1 -0
- package/dist/math/VectorMath.d.ts.map +1 -1
- package/dist/math/VectorMath.js +9 -5
- package/dist/math/VectorMath.js.map +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts.map +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts.map +1 -1
- package/dist/nlp/EspeakPhonemizer.js +2 -2
- package/dist/nlp/EspeakPhonemizer.js.map +1 -1
- package/dist/nlp/IPA.d.ts +2 -2
- package/dist/nlp/Segmentation.d.ts +1 -1
- package/dist/nlp/Segmentation.d.ts.map +1 -1
- package/dist/nlp/Segmentation.js +8 -4
- package/dist/nlp/Segmentation.js.map +1 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts +2 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts.map +1 -1
- package/dist/recognition/AmazonTranscribeSTT.js +3 -3
- package/dist/recognition/AmazonTranscribeSTT.js.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts +2 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.js +4 -4
- package/dist/recognition/AzureCognitiveServicesSTT.js.map +1 -1
- package/dist/recognition/DeepgramSTT.d.ts +2 -1
- package/dist/recognition/DeepgramSTT.d.ts.map +1 -1
- package/dist/recognition/DeepgramSTT.js +12 -13
- package/dist/recognition/DeepgramSTT.js.map +1 -1
- package/dist/recognition/GoogleCloudSTT.d.ts +2 -1
- package/dist/recognition/GoogleCloudSTT.d.ts.map +1 -1
- package/dist/recognition/GoogleCloudSTT.js +11 -10
- package/dist/recognition/GoogleCloudSTT.js.map +1 -1
- package/dist/recognition/OpenAICloudSTT.d.ts +2 -1
- package/dist/recognition/OpenAICloudSTT.d.ts.map +1 -1
- package/dist/recognition/OpenAICloudSTT.js +6 -6
- package/dist/recognition/OpenAICloudSTT.js.map +1 -1
- package/dist/recognition/WhisperCommon.d.ts +9 -0
- package/dist/recognition/WhisperCommon.d.ts.map +1 -0
- package/dist/recognition/WhisperCommon.js +52 -0
- package/dist/recognition/WhisperCommon.js.map +1 -0
- package/dist/recognition/{WhisperCppSTT.d.ts → WhisperCppCliSTT.d.ts} +14 -16
- package/dist/recognition/WhisperCppCliSTT.d.ts.map +1 -0
- package/dist/recognition/{WhisperCppSTT.js → WhisperCppCliSTT.js} +55 -84
- package/dist/recognition/WhisperCppCliSTT.js.map +1 -0
- package/dist/recognition/WhisperSTT.d.ts +72 -85
- package/dist/recognition/WhisperSTT.d.ts.map +1 -1
- package/dist/recognition/WhisperSTT.js +384 -519
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/server/Client.d.ts +2 -2
- package/dist/server/Client.d.ts.map +1 -1
- package/dist/server/Client.js.map +1 -1
- package/dist/server/Worker.d.ts +6 -7
- package/dist/server/Worker.d.ts.map +1 -1
- package/dist/server/Worker.js +42 -44
- package/dist/server/Worker.js.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.d.ts +3 -2
- package/dist/source-separation/MDXNetSourceSeparation.d.ts.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.js +10 -8
- package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts +3 -2
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js +5 -5
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts +5 -3
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.js +8 -8
- package/dist/speech-language-detection/SileroLanguageDetection.js.map +1 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts +2 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts.map +1 -1
- package/dist/speech-search/DTWSpeechSearch.js +4 -4
- package/dist/speech-search/DTWSpeechSearch.js.map +1 -1
- package/dist/subtitles/Subtitles.d.ts +13 -1
- package/dist/subtitles/Subtitles.d.ts.map +1 -1
- package/dist/subtitles/Subtitles.js +22 -22
- package/dist/subtitles/Subtitles.js.map +1 -1
- package/dist/synthesis/AwsPollyTTS.d.ts +3 -2
- package/dist/synthesis/AwsPollyTTS.d.ts.map +1 -1
- package/dist/synthesis/AwsPollyTTS.js +5 -5
- package/dist/synthesis/AwsPollyTTS.js.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts +2 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.js +3 -3
- package/dist/synthesis/AzureCognitiveServicesTTS.js.map +1 -1
- package/dist/synthesis/CoquiServerTTS.d.ts +2 -1
- package/dist/synthesis/CoquiServerTTS.d.ts.map +1 -1
- package/dist/synthesis/CoquiServerTTS.js +7 -8
- package/dist/synthesis/CoquiServerTTS.js.map +1 -1
- package/dist/synthesis/DeepgramTTS.d.ts +2 -2
- package/dist/synthesis/DeepgramTTS.d.ts.map +1 -1
- package/dist/synthesis/DeepgramTTS.js +13 -13
- package/dist/synthesis/DeepgramTTS.js.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.d.ts +3 -3
- package/dist/synthesis/ElevenLabsTTS.d.ts.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.js +22 -21
- package/dist/synthesis/ElevenLabsTTS.js.map +1 -1
- package/dist/synthesis/EspeakTTS.d.ts +11 -9
- package/dist/synthesis/EspeakTTS.d.ts.map +1 -1
- package/dist/synthesis/EspeakTTS.js +129 -71
- package/dist/synthesis/EspeakTTS.js.map +1 -1
- package/dist/synthesis/FliteTTS.d.ts +2 -2
- package/dist/synthesis/FliteTTS.d.ts.map +1 -1
- package/dist/synthesis/FliteTTS.js +2 -2
- package/dist/synthesis/FliteTTS.js.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.d.ts +2 -2
- package/dist/synthesis/GnuSpeechTTS.d.ts.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.js +1 -1
- package/dist/synthesis/GnuSpeechTTS.js.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.d.ts +3 -2
- package/dist/synthesis/GoogleCloudTTS.d.ts.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.js +15 -14
- package/dist/synthesis/GoogleCloudTTS.js.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.d.ts +3 -2
- package/dist/synthesis/GoogleTranslateTTS.d.ts.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.js +11 -11
- package/dist/synthesis/GoogleTranslateTTS.js.map +1 -1
- package/dist/synthesis/KokoroTTS.d.ts +4 -4
- package/dist/synthesis/KokoroTTS.d.ts.map +1 -1
- package/dist/synthesis/KokoroTTS.js +11 -10
- package/dist/synthesis/KokoroTTS.js.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts +4 -3
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.js +41 -20
- package/dist/synthesis/MicrosoftEdgeTTS.js.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.d.ts +2 -2
- package/dist/synthesis/OpenAICloudTTS.d.ts.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.js +6 -5
- package/dist/synthesis/OpenAICloudTTS.js.map +1 -1
- package/dist/synthesis/SamTTS.d.ts +2 -1
- package/dist/synthesis/SamTTS.d.ts.map +1 -1
- package/dist/synthesis/SamTTS.js +2 -2
- package/dist/synthesis/SamTTS.js.map +1 -1
- package/dist/synthesis/SapiTTS.d.ts +2 -2
- package/dist/synthesis/SapiTTS.d.ts.map +1 -1
- package/dist/synthesis/SapiTTS.js +2 -2
- package/dist/synthesis/SapiTTS.js.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.d.ts +2 -2
- package/dist/synthesis/SvoxPicoTTS.d.ts.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.js +3 -3
- package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
- package/dist/synthesis/VitsTTS.d.ts +3 -3
- package/dist/synthesis/VitsTTS.d.ts.map +1 -1
- package/dist/synthesis/VitsTTS.js +14 -11
- package/dist/synthesis/VitsTTS.js.map +1 -1
- package/dist/text-translation/DeepLTextTranslation.d.ts +2 -2
- package/dist/text-translation/DeepLTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/DeepLTextTranslation.js +10 -9
- package/dist/text-translation/DeepLTextTranslation.js.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts +4 -4
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.js +20 -18
- package/dist/text-translation/GoogleTranslateTextTranslation.js.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.d.ts +2 -2
- package/dist/text-translation/NLLBTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.js +4 -6
- package/dist/text-translation/NLLBTextTranslation.js.map +1 -1
- package/dist/typings/TypedArray.d.ts.map +1 -1
- package/dist/utilities/Compression.d.ts +4 -3
- package/dist/utilities/Compression.d.ts.map +1 -1
- package/dist/utilities/Compression.js +9 -9
- package/dist/utilities/Compression.js.map +1 -1
- package/dist/utilities/FileDownloader.d.ts +6 -3
- package/dist/utilities/FileDownloader.d.ts.map +1 -1
- package/dist/utilities/FileDownloader.js +25 -21
- package/dist/utilities/FileDownloader.js.map +1 -1
- package/dist/utilities/FileReader.d.ts.map +1 -1
- package/dist/utilities/FileReader.js.map +1 -1
- package/dist/utilities/FileSystem.js +1 -1
- package/dist/utilities/FileSystem.js.map +1 -1
- package/dist/utilities/FileWriter.d.ts.map +1 -1
- package/dist/utilities/FileWriter.js.map +1 -1
- package/dist/utilities/Hashing.d.ts.map +1 -1
- package/dist/utilities/Hashing.js.map +1 -1
- package/dist/utilities/Locale.js.map +1 -1
- package/dist/utilities/Logger.d.ts +17 -9
- package/dist/utilities/Logger.d.ts.map +1 -1
- package/dist/utilities/Logger.js +50 -35
- package/dist/utilities/Logger.js.map +1 -1
- package/dist/utilities/NpmUtilities.d.ts.map +1 -1
- package/dist/utilities/NpmUtilities.js +4 -5
- package/dist/utilities/NpmUtilities.js.map +1 -1
- package/dist/utilities/ObjectUtilities.js.map +1 -1
- package/dist/utilities/OpenPromise.d.ts.map +1 -1
- package/dist/utilities/OpenPromise.js.map +1 -1
- package/dist/utilities/PackageManager.d.ts +4 -1
- package/dist/utilities/PackageManager.d.ts.map +1 -1
- package/dist/utilities/PackageManager.js +37 -22
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/PathUtilities.d.ts +2 -0
- package/dist/utilities/PathUtilities.d.ts.map +1 -1
- package/dist/utilities/PathUtilities.js +5 -2
- package/dist/utilities/PathUtilities.js.map +1 -1
- package/dist/utilities/RandomGenerator.d.ts.map +1 -1
- package/dist/utilities/SignalChannel.d.ts.map +1 -1
- package/dist/utilities/SmoothEstimator.d.ts.map +1 -1
- package/dist/utilities/SmoothEstimator.js.map +1 -1
- package/dist/utilities/StringBuilder.d.ts.map +1 -1
- package/dist/utilities/TarballMaker.d.ts +4 -3
- package/dist/utilities/TarballMaker.d.ts.map +1 -1
- package/dist/utilities/TarballMaker.js +6 -6
- package/dist/utilities/TarballMaker.js.map +1 -1
- package/dist/utilities/Timeline.js.map +1 -1
- package/dist/utilities/Timer.d.ts.map +1 -1
- package/dist/utilities/Utilities.d.ts +9 -7
- package/dist/utilities/Utilities.d.ts.map +1 -1
- package/dist/utilities/Utilities.js +49 -33
- package/dist/utilities/Utilities.js.map +1 -1
- package/dist/utilities/VirtualFileReadStream.d.ts.map +1 -1
- package/dist/utilities/WebReader.d.ts +2 -1
- package/dist/utilities/WebReader.d.ts.map +1 -1
- package/dist/utilities/WebReader.js +7 -6
- package/dist/utilities/WebReader.js.map +1 -1
- package/dist/utilities/WikipediaReader.d.ts +2 -1
- package/dist/utilities/WikipediaReader.d.ts.map +1 -1
- package/dist/utilities/WikipediaReader.js +1 -5
- package/dist/utilities/WikipediaReader.js.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts +2 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.js +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.js.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js.map +1 -1
- package/docs/API.md +62 -17
- package/docs/CUDA.md +4 -3
- package/docs/Engines.md +8 -7
- package/docs/Licenses.md +0 -3
- package/docs/Options.md +27 -31
- package/docs/Server.md +1 -0
- package/docs/Tasklist.md +2 -1
- package/docs/Technical.md +2 -2
- package/package.json +45 -35
- package/src/alignment/SemanticTextAlignment.ts +14 -7
- package/src/alignment/SpeechAlignment.ts +47 -150
- package/src/api/APIOptions.ts +1 -1
- package/src/api/Alignment.ts +95 -61
- package/src/api/Common.ts +11 -0
- package/src/api/Denoising.ts +22 -17
- package/src/api/GlobalOptions.ts +4 -20
- package/src/api/Recognition.ts +106 -123
- package/src/api/SourceSeparation.ts +39 -21
- package/src/api/SpeechLanguageDetection.ts +77 -37
- package/src/api/SpeechSearch.ts +6 -1
- package/src/api/SpeechTranslation.ts +75 -38
- package/src/api/Synthesis.ts +220 -116
- package/src/api/TextLanguageDetection.ts +10 -12
- package/src/api/TextTranslation.ts +43 -26
- package/src/api/TimelineTranslationAlignment.ts +41 -13
- package/src/api/TranscriptAndTranslationAlignment.ts +28 -15
- package/src/api/TranslationAlignment.ts +53 -24
- package/src/api/VoiceActivityDetection.ts +33 -68
- package/src/audio/AudioPlayer.ts +4 -232
- package/src/audio/AudioUtilities.ts +9 -2
- package/src/build-tools/MakeTarballsForInstalledPackages.ts +4 -3
- package/src/cli/CLI.ts +209 -101
- package/src/codecs/FFMpegTranscoder.ts +18 -16
- package/src/denoising/NSNet2.ts +5 -4
- package/src/denoising/RNNoise.ts +14 -6
- package/src/dsp/FFT.ts +2 -1
- package/src/dsp/MFCC.ts +7 -5
- package/src/dsp/MelSpectrogram.ts +56 -36
- package/src/dsp/Rubberband.ts +10 -3
- package/src/dsp/Sonic.ts +2 -1
- package/src/dsp/SpeexResampler.ts +2 -1
- package/src/encodings/Ascii.ts +1 -1
- package/src/encodings/Base64.ts +1 -1
- package/src/math/VectorMath.ts +10 -6
- package/src/nlp/EspeakPhonemizer.ts +2 -2
- package/src/nlp/Segmentation.ts +9 -4
- package/src/recognition/AmazonTranscribeSTT.ts +4 -3
- package/src/recognition/AzureCognitiveServicesSTT.ts +5 -4
- package/src/recognition/DeepgramSTT.ts +16 -16
- package/src/recognition/GoogleCloudSTT.ts +14 -12
- package/src/recognition/OpenAICloudSTT.ts +12 -6
- package/src/recognition/WhisperCommon.ts +130 -0
- package/src/recognition/{WhisperCppSTT.ts → WhisperCppCliSTT.ts} +73 -133
- package/src/recognition/WhisperSTT.ts +569 -718
- package/src/server/Client.ts +4 -4
- package/src/server/Worker.ts +59 -59
- package/src/source-separation/MDXNetSourceSeparation.ts +15 -10
- package/src/speech-embeddings/WavToVec2BertFeatureEmbeddings.ts +7 -5
- package/src/speech-language-detection/SileroLanguageDetection.ts +18 -9
- package/src/speech-search/DTWSpeechSearch.ts +6 -5
- package/src/subtitles/Subtitles.ts +22 -22
- package/src/synthesis/AwsPollyTTS.ts +12 -5
- package/src/synthesis/AzureCognitiveServicesTTS.ts +11 -3
- package/src/synthesis/CoquiServerTTS.ts +8 -7
- package/src/synthesis/DeepgramTTS.ts +21 -15
- package/src/synthesis/ElevenLabsTTS.ts +33 -23
- package/src/synthesis/EspeakTTS.ts +158 -71
- package/src/synthesis/FliteTTS.ts +3 -3
- package/src/synthesis/GnuSpeechTTS.ts +2 -2
- package/src/synthesis/GoogleCloudTTS.ts +23 -14
- package/src/synthesis/GoogleTranslateTTS.ts +19 -11
- package/src/synthesis/KokoroTTS.ts +37 -14
- package/src/synthesis/MicrosoftEdgeTTS.ts +71 -23
- package/src/synthesis/OpenAICloudTTS.ts +7 -6
- package/src/synthesis/SamTTS.ts +3 -2
- package/src/synthesis/SapiTTS.ts +3 -3
- package/src/synthesis/SvoxPicoTTS.ts +4 -5
- package/src/synthesis/VitsTTS.ts +43 -15
- package/src/text-translation/DeepLTextTranslation.ts +12 -10
- package/src/text-translation/GoogleTranslateTextTranslation.ts +35 -21
- package/src/text-translation/NLLBTextTranslation.ts +5 -9
- package/src/typings/Fillers.d.ts +0 -60
- package/src/typings/TypedArray.ts +12 -1
- package/src/utilities/Compression.ts +10 -9
- package/src/utilities/FileDownloader.ts +38 -23
- package/src/utilities/FileSystem.ts +1 -1
- package/src/utilities/Logger.ts +59 -42
- package/src/utilities/NpmUtilities.ts +4 -6
- package/src/utilities/OpenPromise.ts +1 -2
- package/src/utilities/PackageManager.ts +53 -26
- package/src/utilities/PathUtilities.ts +6 -2
- package/src/utilities/TarballMaker.ts +7 -7
- package/src/utilities/Utilities.ts +58 -41
- package/src/utilities/WebReader.ts +11 -6
- package/src/utilities/WikipediaReader.ts +2 -8
- package/src/voice-activity-detection/AdaptiveGateVAD.ts +13 -8
- package/src/voice-activity-detection/WebRtcVAD.ts +1 -2
- package/tsconfig.json +53 -54
- package/dist/audio/AudioRecorder.d.ts +0 -4
- package/dist/audio/AudioRecorder.d.ts.map +0 -1
- package/dist/audio/AudioRecorder.js +0 -68
- package/dist/audio/AudioRecorder.js.map +0 -1
- package/dist/audio/SoxPath.d.ts +0 -2
- package/dist/audio/SoxPath.d.ts.map +0 -1
- package/dist/audio/SoxPath.js +0 -24
- package/dist/audio/SoxPath.js.map +0 -1
- package/dist/recognition/SileroSTT.d.ts +0 -30
- package/dist/recognition/SileroSTT.d.ts.map +0 -1
- package/dist/recognition/SileroSTT.js +0 -152
- package/dist/recognition/SileroSTT.js.map +0 -1
- package/dist/recognition/VoskSTT.d.ts +0 -11
- package/dist/recognition/VoskSTT.d.ts.map +0 -1
- package/dist/recognition/VoskSTT.js +0 -72
- package/dist/recognition/VoskSTT.js.map +0 -1
- package/dist/recognition/WhisperCppSTT.d.ts.map +0 -1
- package/dist/recognition/WhisperCppSTT.js.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.d.ts +0 -12
- package/dist/synthesis/StreamlabsPollyTTS.d.ts.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.js +0 -88
- package/dist/synthesis/StreamlabsPollyTTS.js.map +0 -1
- package/dist/utilities/BinaryUtilities.d.ts +0 -14
- package/dist/utilities/BinaryUtilities.d.ts.map +0 -1
- package/dist/utilities/BinaryUtilities.js +0 -113
- package/dist/utilities/BinaryUtilities.js.map +0 -1
- package/src/audio/AudioRecorder.ts +0 -91
- package/src/audio/SoxPath.ts +0 -31
- package/src/recognition/SileroSTT.ts +0 -222
- package/src/recognition/VoskSTT.ts +0 -112
- package/src/synthesis/StreamlabsPollyTTS.ts +0 -114
- package/src/utilities/BinaryUtilities.ts +0 -138
- /package/{LICENSE.md → LICENSE.GPLv3.md} +0 -0
package/src/server/Client.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WebSocket } from 'ws'
|
|
2
2
|
import { encode as encodeMsgPack, decode as decodeMsgPack } from 'msgpack-lite'
|
|
3
|
-
import { RequestVoiceListResult, SynthesisOptions,
|
|
4
|
-
import { SynthesisResponseMessage,
|
|
3
|
+
import { RequestVoiceListResult, SynthesisOptions, SynthesisSegmentCallback, SynthesisResult, VoiceListRequestOptions } from '../api/Synthesis.js'
|
|
4
|
+
import { SynthesisResponseMessage, SynthesisSegmentCallbackMessage, SynthesisSentenceCallbackMessage, VoiceListRequestMessage, WorkerRequestMessage, VoiceListResponseMessage, AlignmentRequestMessage, AlignmentResponseMessage, RecognitionRequestMessage, RecognitionResponseMessage, SpeechTranslationRequestMessage, SpeechTranslationResponseMessage, SpeechLanguageDetectionRequestMessage, SpeechLanguageDetectionResponseMessage, TextLanguageDetectionResponseMessage, TextLanguageDetectionRequestMessage, SynthesisRequestMessage } from './Worker.js'
|
|
5
5
|
import { getRandomHexString, logToStderr } from '../utilities/Utilities.js'
|
|
6
6
|
import { OpenPromise } from '../utilities/OpenPromise.js'
|
|
7
7
|
import { AudioSourceParam, RawAudio } from '../audio/AudioUtilities.js'
|
|
@@ -62,7 +62,7 @@ export class Client {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
async synthesize(input: string | string[], options: SynthesisOptions, onSegment?:
|
|
65
|
+
async synthesize(input: string | string[], options: SynthesisOptions, onSegment?: SynthesisSegmentCallback, onSentence?: SynthesisSegmentCallback): Promise<SynthesisResult> {
|
|
66
66
|
const requestOpenPromise = new OpenPromise<SynthesisResult>()
|
|
67
67
|
|
|
68
68
|
const requestMessage: SynthesisRequestMessage = {
|
|
@@ -71,7 +71,7 @@ export class Client {
|
|
|
71
71
|
options
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
function onResponse(responseMessage: SynthesisResponseMessage |
|
|
74
|
+
function onResponse(responseMessage: SynthesisResponseMessage | SynthesisSegmentCallbackMessage | SynthesisSentenceCallbackMessage) {
|
|
75
75
|
if (responseMessage.messageType == 'SynthesisResponse') {
|
|
76
76
|
requestOpenPromise.resolve(responseMessage)
|
|
77
77
|
} else if (responseMessage.messageType == 'SynthesisSegmentEvent' && onSegment) {
|
package/src/server/Worker.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { RequestVoiceListResult, SynthesisOptions,
|
|
1
|
+
import { RequestVoiceListResult, SynthesisOptions, SynthesisSegmentCallbackData, SynthesisResult, VoiceListRequestOptions, requestVoiceList, synthesize, VoiceListRequestCallbacks, SynthesisCallbacks } from '../api/Synthesis.js'
|
|
2
2
|
import { Queue } from '../data-structures/Queue.js'
|
|
3
3
|
import { logToStderr, yieldToEventLoop } from '../utilities/Utilities.js'
|
|
4
4
|
import { AudioSourceParam } from '../audio/AudioUtilities.js'
|
|
5
|
-
import { RecognitionOptions, RecognitionResult, recognize } from '../api/Recognition.js'
|
|
6
|
-
import { AlignmentOptions, AlignmentResult, align } from '../api/Alignment.js'
|
|
7
|
-
import { SpeechTranslationOptions, SpeechTranslationResult, translateSpeech } from '../api/SpeechTranslation.js'
|
|
8
|
-
import { resetActiveLogger } from '../utilities/Logger.js'
|
|
5
|
+
import { RecognitionCallbacks, RecognitionOptions, RecognitionResult, recognize } from '../api/Recognition.js'
|
|
6
|
+
import { AlignmentCallbacks, AlignmentOptions, AlignmentResult, align } from '../api/Alignment.js'
|
|
7
|
+
import { SpeechTranslationCallbacks, SpeechTranslationOptions, SpeechTranslationResult, translateSpeech } from '../api/SpeechTranslation.js'
|
|
9
8
|
import { writeToStderr } from '../utilities/Utilities.js'
|
|
10
|
-
import {
|
|
11
|
-
import { SpeechLanguageDetectionOptions, SpeechLanguageDetectionResult, detectSpeechLanguage } from '../api/SpeechLanguageDetection.js'
|
|
12
|
-
import chalk from 'chalk'
|
|
9
|
+
import { SpeechLanguageDetectionCallbacks, SpeechLanguageDetectionOptions, SpeechLanguageDetectionResult, detectSpeechLanguage } from '../api/SpeechLanguageDetection.js'
|
|
13
10
|
import { resolveToModuleRootDir } from '../utilities/PathUtilities.js'
|
|
14
|
-
import { TextLanguageDetectionOptions, TextLanguageDetectionResult, detectTextLanguage } from '../api/TextLanguageDetection.js'
|
|
11
|
+
import { TextLanguageDetectionCallbacks, TextLanguageDetectionOptions, TextLanguageDetectionResult, detectTextLanguage } from '../api/TextLanguageDetection.js'
|
|
12
|
+
import { OperationCallbacks } from '../api/Common.js'
|
|
13
|
+
import { getGlobalLogLevel } from '../api/GlobalOptions.js'
|
|
14
|
+
import { Logger } from '../utilities/Logger.js'
|
|
15
15
|
|
|
16
16
|
const log = logToStderr
|
|
17
17
|
|
|
@@ -19,8 +19,6 @@ let messageChannel: MessageChannel | undefined = undefined
|
|
|
19
19
|
|
|
20
20
|
const canceledRequests = new Set<string>()
|
|
21
21
|
|
|
22
|
-
let cancelCurrentTask = false
|
|
23
|
-
|
|
24
22
|
const messageQueue = new Queue<any>()
|
|
25
23
|
let isProcessing = false
|
|
26
24
|
|
|
@@ -44,10 +42,6 @@ export function startMessageChannel() {
|
|
|
44
42
|
})
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
export function shouldCancelCurrentTask() {
|
|
48
|
-
return cancelCurrentTask
|
|
49
|
-
}
|
|
50
|
-
|
|
51
45
|
function enqueueAndProcessIfIdle(message: any) {
|
|
52
46
|
messageQueue.enqueue(message)
|
|
53
47
|
processQueueIfIdle()
|
|
@@ -71,27 +65,34 @@ async function processQueueIfIdle() {
|
|
|
71
65
|
})
|
|
72
66
|
}
|
|
73
67
|
|
|
74
|
-
|
|
68
|
+
const abortController = new AbortController()
|
|
69
|
+
const abortSignal = abortController.signal
|
|
70
|
+
|
|
71
|
+
const callbacks: OperationCallbacks = {
|
|
72
|
+
logLevel: getGlobalLogLevel(),
|
|
73
|
+
abortSignal: abortController.signal
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function sendAbortSignalIfNeeded() {
|
|
75
77
|
if (canceledRequests.has(requestId)) {
|
|
76
|
-
|
|
78
|
+
abortController.abort()
|
|
77
79
|
canceledRequests.delete(requestId)
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
await yieldToEventLoop()
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
+
sendAbortSignalIfNeeded()
|
|
86
|
+
const abortSignalSenderInterval = setInterval(sendAbortSignalIfNeeded, 20)
|
|
85
87
|
|
|
86
88
|
try {
|
|
87
|
-
|
|
88
|
-
//log(`******* CANCELED BEFORE START: ${requestId} *******`)
|
|
89
|
-
throw new Error('Canceled')
|
|
90
|
-
}
|
|
89
|
+
abortSignal.throwIfAborted()
|
|
91
90
|
|
|
92
|
-
await processMessage(incomingMessage, sendMessage)
|
|
91
|
+
await processMessage(incomingMessage, sendMessage, callbacks)
|
|
93
92
|
} catch (e: any) {
|
|
94
|
-
|
|
93
|
+
const logger = new Logger(getGlobalLogLevel())
|
|
94
|
+
|
|
95
|
+
logger.logTitledMessage('Error', e.message, 'error')
|
|
95
96
|
|
|
96
97
|
sendMessageToClient({
|
|
97
98
|
requestId,
|
|
@@ -99,50 +100,47 @@ async function processQueueIfIdle() {
|
|
|
99
100
|
error: e
|
|
100
101
|
})
|
|
101
102
|
} finally {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
clearInterval(cancellationFlagSetterInterval)
|
|
105
|
-
cancelCurrentTask = false
|
|
103
|
+
clearInterval(abortSignalSenderInterval)
|
|
106
104
|
}
|
|
107
105
|
}
|
|
108
106
|
|
|
109
107
|
isProcessing = false
|
|
110
108
|
}
|
|
111
109
|
|
|
112
|
-
export async function processMessage(message: WorkerRequestMessage, sendMessage: MessageFunc) {
|
|
110
|
+
export async function processMessage(message: WorkerRequestMessage, sendMessage: MessageFunc, callbacks: OperationCallbacks) {
|
|
113
111
|
switch (message.messageType) {
|
|
114
112
|
case 'SynthesisRequest': {
|
|
115
|
-
await processSynthesisRequest(message, sendMessage)
|
|
113
|
+
await processSynthesisRequest(message, sendMessage, callbacks)
|
|
116
114
|
break
|
|
117
115
|
}
|
|
118
116
|
|
|
119
117
|
case 'VoiceListRequest': {
|
|
120
|
-
await processVoiceListRequest(message, sendMessage)
|
|
118
|
+
await processVoiceListRequest(message, sendMessage, callbacks)
|
|
121
119
|
break
|
|
122
120
|
}
|
|
123
121
|
|
|
124
122
|
case 'RecognitionRequest': {
|
|
125
|
-
await processRecognitionRequest(message, sendMessage)
|
|
123
|
+
await processRecognitionRequest(message, sendMessage, callbacks)
|
|
126
124
|
break
|
|
127
125
|
}
|
|
128
126
|
|
|
129
127
|
case 'AlignmentRequest': {
|
|
130
|
-
await processAlignmentRequest(message, sendMessage)
|
|
128
|
+
await processAlignmentRequest(message, sendMessage, callbacks)
|
|
131
129
|
break
|
|
132
130
|
}
|
|
133
131
|
|
|
134
132
|
case 'SpeechTranslationRequest': {
|
|
135
|
-
await processSpeechTranslationRequest(message, sendMessage)
|
|
133
|
+
await processSpeechTranslationRequest(message, sendMessage, callbacks)
|
|
136
134
|
break
|
|
137
135
|
}
|
|
138
136
|
|
|
139
137
|
case 'SpeechLanguageDetectionRequest': {
|
|
140
|
-
await processSpeechLanguageDetectionRequest(message, sendMessage)
|
|
138
|
+
await processSpeechLanguageDetectionRequest(message, sendMessage, callbacks)
|
|
141
139
|
break
|
|
142
140
|
}
|
|
143
141
|
|
|
144
142
|
case 'TextLanguageDetectionRequest': {
|
|
145
|
-
await processTextLanguageDetectionRequest(message, sendMessage)
|
|
143
|
+
await processTextLanguageDetectionRequest(message, sendMessage, callbacks)
|
|
146
144
|
break
|
|
147
145
|
}
|
|
148
146
|
|
|
@@ -155,9 +153,9 @@ export async function processMessage(message: WorkerRequestMessage, sendMessage:
|
|
|
155
153
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
156
154
|
// Synthesis operations
|
|
157
155
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
158
|
-
async function processSynthesisRequest(message: SynthesisRequestMessage, sendMessage: MessageFunc) {
|
|
159
|
-
async function onSegment(eventData:
|
|
160
|
-
const responseMessage:
|
|
156
|
+
async function processSynthesisRequest(message: SynthesisRequestMessage, sendMessage: MessageFunc, callbacks: SynthesisCallbacks) {
|
|
157
|
+
async function onSegment(eventData: SynthesisSegmentCallbackData) {
|
|
158
|
+
const responseMessage: SynthesisSegmentCallbackMessage = {
|
|
161
159
|
messageType: 'SynthesisSegmentEvent',
|
|
162
160
|
...eventData
|
|
163
161
|
}
|
|
@@ -165,8 +163,8 @@ async function processSynthesisRequest(message: SynthesisRequestMessage, sendMes
|
|
|
165
163
|
sendMessage(responseMessage)
|
|
166
164
|
}
|
|
167
165
|
|
|
168
|
-
async function onSentence(eventData:
|
|
169
|
-
const responseMessage:
|
|
166
|
+
async function onSentence(eventData: SynthesisSegmentCallbackData) {
|
|
167
|
+
const responseMessage: SynthesisSentenceCallbackMessage = {
|
|
170
168
|
messageType: 'SynthesisSentenceEvent',
|
|
171
169
|
...eventData
|
|
172
170
|
}
|
|
@@ -174,7 +172,7 @@ async function processSynthesisRequest(message: SynthesisRequestMessage, sendMes
|
|
|
174
172
|
sendMessage(responseMessage)
|
|
175
173
|
}
|
|
176
174
|
|
|
177
|
-
const result = await synthesize(message.input, message.options, onSegment, onSentence)
|
|
175
|
+
const result = await synthesize(message.input, message.options, { ...callbacks, onSegment, onSentence })
|
|
178
176
|
|
|
179
177
|
const responseMessage: SynthesisResponseMessage = {
|
|
180
178
|
messageType: 'SynthesisResponse',
|
|
@@ -195,16 +193,16 @@ export interface SynthesisResponseMessage extends WorkerMessageBase, SynthesisRe
|
|
|
195
193
|
messageType: 'SynthesisResponse'
|
|
196
194
|
}
|
|
197
195
|
|
|
198
|
-
export interface
|
|
196
|
+
export interface SynthesisSegmentCallbackMessage extends WorkerMessageBase, SynthesisSegmentCallbackData {
|
|
199
197
|
messageType: 'SynthesisSegmentEvent'
|
|
200
198
|
}
|
|
201
199
|
|
|
202
|
-
export interface
|
|
200
|
+
export interface SynthesisSentenceCallbackMessage extends WorkerMessageBase, SynthesisSegmentCallbackData {
|
|
203
201
|
messageType: 'SynthesisSentenceEvent'
|
|
204
202
|
}
|
|
205
203
|
|
|
206
|
-
async function processVoiceListRequest(message: VoiceListRequestMessage, sendMessage: MessageFunc) {
|
|
207
|
-
const result = await requestVoiceList(message.options)
|
|
204
|
+
async function processVoiceListRequest(message: VoiceListRequestMessage, sendMessage: MessageFunc, callbacks: VoiceListRequestCallbacks) {
|
|
205
|
+
const result = await requestVoiceList(message.options, callbacks)
|
|
208
206
|
|
|
209
207
|
const responseMessage: VoiceListResponseMessage = {
|
|
210
208
|
messageType: 'VoiceListResponse',
|
|
@@ -227,8 +225,8 @@ export interface VoiceListResponseMessage extends WorkerMessageBase, RequestVoic
|
|
|
227
225
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
228
226
|
// Recognition operations
|
|
229
227
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
230
|
-
async function processRecognitionRequest(message: RecognitionRequestMessage, sendMessage: MessageFunc) {
|
|
231
|
-
const result = await recognize(message.input, message.options)
|
|
228
|
+
async function processRecognitionRequest(message: RecognitionRequestMessage, sendMessage: MessageFunc, callbacks: RecognitionCallbacks) {
|
|
229
|
+
const result = await recognize(message.input, message.options, callbacks)
|
|
232
230
|
|
|
233
231
|
const responseMessage: RecognitionResponseMessage = {
|
|
234
232
|
messageType: 'RecognitionResponse',
|
|
@@ -252,8 +250,8 @@ export interface RecognitionResponseMessage extends WorkerMessageBase, Recogniti
|
|
|
252
250
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
253
251
|
// Alignment operations
|
|
254
252
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
255
|
-
async function processAlignmentRequest(message: AlignmentRequestMessage, sendMessage: MessageFunc) {
|
|
256
|
-
const result = await align(message.input, message.transcript, message.options)
|
|
253
|
+
async function processAlignmentRequest(message: AlignmentRequestMessage, sendMessage: MessageFunc, callbacks: AlignmentCallbacks) {
|
|
254
|
+
const result = await align(message.input, message.transcript, message.options, callbacks)
|
|
257
255
|
|
|
258
256
|
const responseMessage: AlignmentResponseMessage = {
|
|
259
257
|
messageType: 'AlignmentResponse',
|
|
@@ -278,8 +276,8 @@ export interface AlignmentResponseMessage extends WorkerMessageBase, AlignmentRe
|
|
|
278
276
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
279
277
|
// Speech translation operations
|
|
280
278
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
281
|
-
async function processSpeechTranslationRequest(message: SpeechTranslationRequestMessage, sendMessage: MessageFunc) {
|
|
282
|
-
const result = await translateSpeech(message.input, message.options)
|
|
279
|
+
async function processSpeechTranslationRequest(message: SpeechTranslationRequestMessage, sendMessage: MessageFunc, callbacks: SpeechTranslationCallbacks) {
|
|
280
|
+
const result = await translateSpeech(message.input, message.options, callbacks)
|
|
283
281
|
|
|
284
282
|
const responseMessage: SpeechTranslationResponseMessage = {
|
|
285
283
|
messageType: 'SpeechTranslationResponse',
|
|
@@ -303,8 +301,8 @@ export interface SpeechTranslationResponseMessage extends WorkerMessageBase, Spe
|
|
|
303
301
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
304
302
|
// Speech Language detection operations
|
|
305
303
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
306
|
-
async function processSpeechLanguageDetectionRequest(message: SpeechLanguageDetectionRequestMessage, sendMessage: MessageFunc) {
|
|
307
|
-
const result = await detectSpeechLanguage(message.input, message.options)
|
|
304
|
+
async function processSpeechLanguageDetectionRequest(message: SpeechLanguageDetectionRequestMessage, sendMessage: MessageFunc, callbacks: SpeechLanguageDetectionCallbacks) {
|
|
305
|
+
const result = await detectSpeechLanguage(message.input, message.options, callbacks)
|
|
308
306
|
|
|
309
307
|
const responseMessage: SpeechLanguageDetectionResponseMessage = {
|
|
310
308
|
messageType: 'SpeechLanguageDetectionResponse',
|
|
@@ -328,8 +326,8 @@ export interface SpeechLanguageDetectionResponseMessage extends WorkerMessageBas
|
|
|
328
326
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
329
327
|
// Text Language detection operations
|
|
330
328
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
331
|
-
async function processTextLanguageDetectionRequest(message: TextLanguageDetectionRequestMessage, sendMessage: MessageFunc) {
|
|
332
|
-
const result = await detectTextLanguage(message.input, message.options)
|
|
329
|
+
async function processTextLanguageDetectionRequest(message: TextLanguageDetectionRequestMessage, sendMessage: MessageFunc, callbacks: TextLanguageDetectionCallbacks) {
|
|
330
|
+
const result = await detectTextLanguage(message.input, message.options, callbacks)
|
|
333
331
|
|
|
334
332
|
const responseMessage: TextLanguageDetectionResponseMessage = {
|
|
335
333
|
messageType: 'TextLanguageDetectionResponse',
|
|
@@ -391,9 +389,11 @@ function ensureMessageChannelCreated() {
|
|
|
391
389
|
// Worker thread methods
|
|
392
390
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
393
391
|
export async function startNewWorkerThread() {
|
|
394
|
-
const
|
|
392
|
+
const WorkerThreads = await import('node:worker_threads')
|
|
393
|
+
|
|
394
|
+
const workerThread = new WorkerThreads.Worker(resolveToModuleRootDir('dist/server/WorkerStarter.js'), {
|
|
395
395
|
argv: process.argv.slice(2),
|
|
396
|
-
env: SHARE_ENV
|
|
396
|
+
env: WorkerThreads.SHARE_ENV
|
|
397
397
|
})
|
|
398
398
|
|
|
399
399
|
workerThread.on('message', (message) => {
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import type * as Onnx from 'onnxruntime-node'
|
|
2
2
|
import { getEmptyRawAudio, RawAudio } from '../audio/AudioUtilities.js'
|
|
3
3
|
import { getWindowWeights, createStftrGenerator, stiftr, WindowType } from '../dsp/FFT.js'
|
|
4
|
-
import { logToStderr } from '../utilities/Utilities.js'
|
|
5
4
|
import { Logger } from '../utilities/Logger.js'
|
|
6
5
|
import { OnnxExecutionProvider, dmlProviderAvailable, getOnnxSessionOptions } from '../utilities/OnnxUtilities.js'
|
|
7
6
|
import chalk from 'chalk'
|
|
8
7
|
import { WindowedList } from '../data-structures/WindowedList.js'
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
const log = logToStderr
|
|
8
|
+
import { SourceSeparationCallbacks } from '../api/API.js'
|
|
12
9
|
|
|
13
10
|
export async function isolate(
|
|
14
11
|
rawAudio: RawAudio,
|
|
15
12
|
modelFilePath: string,
|
|
16
13
|
modelProfile: MDXNetModelProfile,
|
|
17
|
-
options: MDXNetOptions
|
|
14
|
+
options: MDXNetOptions,
|
|
15
|
+
callbacks: SourceSeparationCallbacks) {
|
|
18
16
|
|
|
19
17
|
const model = new MDXNet(modelFilePath, modelProfile, options)
|
|
20
18
|
|
|
21
|
-
return model.processAudio(rawAudio)
|
|
19
|
+
return model.processAudio(rawAudio, callbacks)
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
export class MDXNet {
|
|
@@ -31,7 +29,7 @@ export class MDXNet {
|
|
|
31
29
|
public readonly options: MDXNetOptions) {
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
async processAudio(rawAudio: RawAudio) {
|
|
32
|
+
async processAudio(rawAudio: RawAudio, callbacks: SourceSeparationCallbacks) {
|
|
35
33
|
if (rawAudio.audioChannels.length !== 2) {
|
|
36
34
|
throw new Error(`Input audio must be stereo`)
|
|
37
35
|
}
|
|
@@ -44,9 +42,8 @@ export class MDXNet {
|
|
|
44
42
|
return getEmptyRawAudio(rawAudio.audioChannels.length, rawAudio.sampleRate)
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const logger = new Logger()
|
|
45
|
+
const logger = new Logger(callbacks.logLevel)
|
|
46
|
+
const enableTraceLogging = logger.logLevelGreaterOrEqualTo('trace')
|
|
50
47
|
|
|
51
48
|
await logger.startAsync(`Initialize session for MDX-NET model '${this.options.model!}'`)
|
|
52
49
|
|
|
@@ -84,6 +81,8 @@ export class MDXNet {
|
|
|
84
81
|
const audioForSegments: Float32Array[][] = []
|
|
85
82
|
|
|
86
83
|
for (let segmentStartFrameOffset = 0; ; segmentStartFrameOffset += segmentHopSize) {
|
|
84
|
+
callbacks.abortSignal?.throwIfAborted()
|
|
85
|
+
|
|
87
86
|
const segmentEndFrameOffset = segmentStartFrameOffset + segmentSize
|
|
88
87
|
|
|
89
88
|
const timePosition = segmentStartFrameOffset * (fftHopSize / sampleRate)
|
|
@@ -225,6 +224,12 @@ export class MDXNet {
|
|
|
225
224
|
|
|
226
225
|
audioForSegments.push(outputAudioChannels)
|
|
227
226
|
|
|
227
|
+
if (callbacks.onSegment) {
|
|
228
|
+
const rawAudio: RawAudio = { audioChannels: outputAudioChannels, sampleRate }
|
|
229
|
+
|
|
230
|
+
await callbacks.onSegment(timePosition, rawAudio)
|
|
231
|
+
}
|
|
232
|
+
|
|
228
233
|
if (isLastSegment) {
|
|
229
234
|
break
|
|
230
235
|
}
|
|
@@ -6,14 +6,15 @@ import { computeMelSpectrogram } from "../dsp/MelSpectrogram.js";
|
|
|
6
6
|
import { Logger } from '../utilities/Logger.js';
|
|
7
7
|
import { concatFloat32Arrays, splitFloat32Array } from '../utilities/Utilities.js';
|
|
8
8
|
import { applyEmphasis } from '../dsp/MFCC.js';
|
|
9
|
+
import { OperationCallbacks } from '../api/Common.js';
|
|
9
10
|
|
|
10
|
-
export function computeEmbeddings(audioSamples: RawAudio, modelFilePath: string, executionProviders: OnnxExecutionProvider[]) {
|
|
11
|
+
export function computeEmbeddings(audioSamples: RawAudio, modelFilePath: string, executionProviders: OnnxExecutionProvider[], callbacks: OperationCallbacks) {
|
|
11
12
|
const wav2vecBert = new Wav2Vec2BertFeatureEmbeddings(
|
|
12
13
|
modelFilePath,
|
|
13
14
|
executionProviders,
|
|
14
15
|
)
|
|
15
16
|
|
|
16
|
-
const result = wav2vecBert.computeEmbeddings(audioSamples)
|
|
17
|
+
const result = wav2vecBert.computeEmbeddings(audioSamples, callbacks)
|
|
17
18
|
|
|
18
19
|
return result
|
|
19
20
|
}
|
|
@@ -26,8 +27,8 @@ export class Wav2Vec2BertFeatureEmbeddings {
|
|
|
26
27
|
public readonly executionProviders: OnnxExecutionProvider[]) {
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
async computeEmbeddings(rawAudio: RawAudio) {
|
|
30
|
-
const logger = new Logger()
|
|
30
|
+
async computeEmbeddings(rawAudio: RawAudio, callbacks: OperationCallbacks) {
|
|
31
|
+
const logger = new Logger(callbacks.logLevel)
|
|
31
32
|
|
|
32
33
|
rawAudio.audioChannels[0] = applyEmphasis(rawAudio.audioChannels[0], 0.97)
|
|
33
34
|
|
|
@@ -39,7 +40,8 @@ export class Wav2Vec2BertFeatureEmbeddings {
|
|
|
39
40
|
80,
|
|
40
41
|
20,
|
|
41
42
|
8000,
|
|
42
|
-
'povey'
|
|
43
|
+
'povey',
|
|
44
|
+
callbacks)
|
|
43
45
|
|
|
44
46
|
// Ensure even length
|
|
45
47
|
if (melSpectrogram.length % 2 != 0) {
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import type * as Onnx from 'onnxruntime-node'
|
|
2
|
+
|
|
2
3
|
import { softmax } from '../math/VectorMath.js'
|
|
3
4
|
import { Logger } from '../utilities/Logger.js'
|
|
4
5
|
import { RawAudio } from '../audio/AudioUtilities.js'
|
|
5
6
|
import { readAndParseJsonFile } from '../utilities/FileSystem.js'
|
|
6
|
-
import { detectSpeechLanguageByParts } from '../api/SpeechLanguageDetection.js'
|
|
7
|
+
import { detectSpeechLanguageByParts, SpeechLanguageDetectionCallbacks } from '../api/SpeechLanguageDetection.js'
|
|
7
8
|
import { languageCodeToName } from '../utilities/Locale.js'
|
|
8
9
|
import { OnnxExecutionProvider, getOnnxSessionOptions } from '../utilities/OnnxUtilities.js'
|
|
9
10
|
import { LanguageDetectionResults } from '../api/LanguageDetectionCommon.js'
|
|
11
|
+
import { OperationCallbacks } from '../api/Common.js'
|
|
10
12
|
|
|
11
13
|
export async function detectLanguage(
|
|
12
14
|
rawAudio: RawAudio,
|
|
13
15
|
modelPath: string,
|
|
14
16
|
languageDictionaryPath: string,
|
|
15
17
|
languageGroupDictionaryPath: string,
|
|
16
|
-
onnxExecutionProviders: OnnxExecutionProvider[]
|
|
18
|
+
onnxExecutionProviders: OnnxExecutionProvider[],
|
|
19
|
+
callbacks: SpeechLanguageDetectionCallbacks) {
|
|
17
20
|
|
|
18
21
|
const languageDetection = new SileroLanguageDetection(
|
|
19
22
|
modelPath,
|
|
@@ -22,12 +25,18 @@ export async function detectLanguage(
|
|
|
22
25
|
onnxExecutionProviders)
|
|
23
26
|
|
|
24
27
|
async function detectLanguageForPart(partAudio: RawAudio) {
|
|
25
|
-
const { languageResults } = await languageDetection.detectLanguage(partAudio)
|
|
28
|
+
const { languageResults } = await languageDetection.detectLanguage(partAudio, callbacks)
|
|
26
29
|
|
|
27
30
|
return languageResults
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
const results = await detectSpeechLanguageByParts(
|
|
33
|
+
const results = await detectSpeechLanguageByParts(
|
|
34
|
+
rawAudio,
|
|
35
|
+
detectLanguageForPart,
|
|
36
|
+
undefined,
|
|
37
|
+
undefined,
|
|
38
|
+
callbacks,
|
|
39
|
+
)
|
|
31
40
|
|
|
32
41
|
results.sort((a, b) => b.probability - a.probability)
|
|
33
42
|
|
|
@@ -47,10 +56,10 @@ export class SileroLanguageDetection {
|
|
|
47
56
|
public readonly onnxExecutionProviders: OnnxExecutionProvider[]) {
|
|
48
57
|
}
|
|
49
58
|
|
|
50
|
-
async detectLanguage(rawAudio: RawAudio) {
|
|
51
|
-
await this.initializeIfNeeded()
|
|
59
|
+
async detectLanguage(rawAudio: RawAudio, callbacks: SpeechLanguageDetectionCallbacks) {
|
|
60
|
+
await this.initializeIfNeeded(callbacks)
|
|
52
61
|
|
|
53
|
-
const logger = new Logger()
|
|
62
|
+
const logger = new Logger(callbacks.logLevel)
|
|
54
63
|
|
|
55
64
|
logger.start('Detect language with Silero')
|
|
56
65
|
|
|
@@ -99,12 +108,12 @@ export class SileroLanguageDetection {
|
|
|
99
108
|
return { languageResults, languageGroupResults }
|
|
100
109
|
}
|
|
101
110
|
|
|
102
|
-
async initializeIfNeeded() {
|
|
111
|
+
async initializeIfNeeded(callbacks: OperationCallbacks) {
|
|
103
112
|
if (this.session) {
|
|
104
113
|
return
|
|
105
114
|
}
|
|
106
115
|
|
|
107
|
-
const logger = new Logger()
|
|
116
|
+
const logger = new Logger(callbacks.logLevel)
|
|
108
117
|
|
|
109
118
|
logger.start('Initialize ONNX inference session for Silero language detection')
|
|
110
119
|
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { DtwGranularity, getMfccOptionsForGranularity } from "../alignment/SpeechAlignment.js";
|
|
2
|
+
import { SpeechSearchCallbacks } from "../api/SpeechSearch.js";
|
|
2
3
|
import { RawAudio } from "../audio/AudioUtilities.js";
|
|
3
4
|
import { computeMFCCs, extendDefaultMfccOptions, MfccOptions } from "../dsp/MFCC.js";
|
|
4
5
|
import { euclideanDistance13Dim } from "../math/VectorMath.js";
|
|
5
6
|
import { Logger } from "../utilities/Logger.js";
|
|
6
7
|
|
|
7
|
-
export async function searchSpeech(sourceRawAudio: RawAudio, queryRawAudio: RawAudio) {
|
|
8
|
-
const logger = new Logger()
|
|
8
|
+
export async function searchSpeech(sourceRawAudio: RawAudio, queryRawAudio: RawAudio, callbacks: SpeechSearchCallbacks) {
|
|
9
|
+
const logger = new Logger(callbacks.logLevel)
|
|
9
10
|
|
|
10
11
|
const granularity: DtwGranularity = 'low'
|
|
11
12
|
|
|
12
13
|
const mfccOptions = extendDefaultMfccOptions({ ...getMfccOptionsForGranularity(granularity), zeroFirstCoefficient: true }) as MfccOptions
|
|
13
14
|
|
|
14
15
|
logger.start('Compute query MFCC features')
|
|
15
|
-
const queryMfccs = await computeMFCCs(queryRawAudio, mfccOptions)
|
|
16
|
+
const queryMfccs = await computeMFCCs(queryRawAudio, mfccOptions, callbacks)
|
|
16
17
|
|
|
17
18
|
logger.start('Compute source MFCC features')
|
|
18
|
-
const sourceMfccs = await computeMFCCs(sourceRawAudio, mfccOptions)
|
|
19
|
+
const sourceMfccs = await computeMFCCs(sourceRawAudio, mfccOptions, callbacks)
|
|
19
20
|
|
|
20
21
|
logger.start('Compute cost matrix')
|
|
21
22
|
|
|
@@ -31,7 +32,7 @@ export async function searchSpeech(sourceRawAudio: RawAudio, queryRawAudio: RawA
|
|
|
31
32
|
for (let rowStartOffset = 0; rowStartOffset < rowCount; rowStartOffset++) {
|
|
32
33
|
const rowEndOffset = Math.min(rowStartOffset + maxSearchWindow, rowCount)
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|