echogarden 2.10.1 → 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.d.ts +1 -0
- package/dist/alignment/DTWMfccSequenceAlignment.d.ts.map +1 -0
- package/dist/alignment/DTWMfccSequenceAlignment.js.map +1 -1
- package/dist/alignment/DTWSequenceAlignment.d.ts +1 -0
- package/dist/alignment/DTWSequenceAlignment.d.ts.map +1 -0
- package/dist/alignment/DTWSequenceAlignmentWindowed.d.ts +1 -0
- package/dist/alignment/DTWSequenceAlignmentWindowed.d.ts.map +1 -0
- package/dist/alignment/LevenshteinSequenceAlignment.d.ts +1 -0
- package/dist/alignment/LevenshteinSequenceAlignment.d.ts.map +1 -0
- package/dist/alignment/SemanticTextAlignment.d.ts +5 -2
- package/dist/alignment/SemanticTextAlignment.d.ts.map +1 -0
- package/dist/alignment/SemanticTextAlignment.js +7 -7
- package/dist/alignment/SemanticTextAlignment.js.map +1 -1
- package/dist/alignment/SpeechAlignment.d.ts +10 -10
- package/dist/alignment/SpeechAlignment.d.ts.map +1 -0
- package/dist/alignment/SpeechAlignment.js +23 -96
- package/dist/alignment/SpeechAlignment.js.map +1 -1
- package/dist/api/API.d.ts +1 -0
- package/dist/api/API.d.ts.map +1 -0
- package/dist/api/APIOptions.d.ts +2 -1
- package/dist/api/APIOptions.d.ts.map +1 -0
- package/dist/api/Alignment.d.ts +9 -6
- package/dist/api/Alignment.d.ts.map +1 -0
- package/dist/api/Alignment.js +31 -40
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/Common.d.ts +8 -0
- package/dist/api/Common.d.ts.map +1 -0
- package/dist/api/Common.js.map +1 -1
- package/dist/api/Denoising.d.ts +6 -2
- package/dist/api/Denoising.d.ts.map +1 -0
- package/dist/api/Denoising.js +15 -15
- package/dist/api/Denoising.js.map +1 -1
- package/dist/api/GlobalOptions.d.ts +3 -8
- package/dist/api/GlobalOptions.d.ts.map +1 -0
- package/dist/api/GlobalOptions.js +2 -13
- package/dist/api/GlobalOptions.js.map +1 -1
- package/dist/api/LanguageDetectionCommon.d.ts +1 -0
- package/dist/api/LanguageDetectionCommon.d.ts.map +1 -0
- package/dist/api/Recognition.d.ts +12 -12
- package/dist/api/Recognition.d.ts.map +1 -0
- package/dist/api/Recognition.js +32 -82
- package/dist/api/Recognition.js.map +1 -1
- package/dist/api/SourceSeparation.d.ts +8 -2
- package/dist/api/SourceSeparation.d.ts.map +1 -0
- package/dist/api/SourceSeparation.js +12 -10
- package/dist/api/SourceSeparation.js.map +1 -1
- package/dist/api/SpeechLanguageDetection.d.ts +12 -7
- package/dist/api/SpeechLanguageDetection.d.ts.map +1 -0
- package/dist/api/SpeechLanguageDetection.js +37 -30
- package/dist/api/SpeechLanguageDetection.js.map +1 -1
- package/dist/api/SpeechSearch.d.ts +5 -1
- package/dist/api/SpeechSearch.d.ts.map +1 -0
- package/dist/api/SpeechSearch.js.map +1 -1
- package/dist/api/SpeechTranslation.d.ts +11 -6
- package/dist/api/SpeechTranslation.d.ts.map +1 -0
- package/dist/api/SpeechTranslation.js +28 -26
- package/dist/api/SpeechTranslation.js.map +1 -1
- package/dist/api/Synthesis.d.ts +14 -8
- package/dist/api/Synthesis.d.ts.map +1 -0
- package/dist/api/Synthesis.js +67 -89
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/api/TextLanguageDetection.d.ts +5 -2
- package/dist/api/TextLanguageDetection.d.ts.map +1 -0
- package/dist/api/TextLanguageDetection.js +4 -7
- package/dist/api/TextLanguageDetection.js.map +1 -1
- package/dist/api/TextTranslation.d.ts +5 -2
- package/dist/api/TextTranslation.d.ts.map +1 -0
- package/dist/api/TextTranslation.js +13 -24
- package/dist/api/TextTranslation.js.map +1 -1
- package/dist/api/TimelineTranslationAlignment.d.ts +7 -3
- package/dist/api/TimelineTranslationAlignment.d.ts.map +1 -0
- package/dist/api/TimelineTranslationAlignment.js +20 -11
- package/dist/api/TimelineTranslationAlignment.js.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.d.ts +7 -4
- package/dist/api/TranscriptAndTranslationAlignment.d.ts.map +1 -0
- package/dist/api/TranscriptAndTranslationAlignment.js +11 -12
- package/dist/api/TranscriptAndTranslationAlignment.js.map +1 -1
- package/dist/api/TranslationAlignment.d.ts +7 -4
- package/dist/api/TranslationAlignment.d.ts.map +1 -0
- package/dist/api/TranslationAlignment.js +20 -21
- package/dist/api/TranslationAlignment.js.map +1 -1
- package/dist/api/VoiceActivityDetection.d.ts +10 -8
- package/dist/api/VoiceActivityDetection.d.ts.map +1 -0
- package/dist/api/VoiceActivityDetection.js +20 -43
- package/dist/api/VoiceActivityDetection.js.map +1 -1
- package/dist/audio/AudioBufferConversion.d.ts +1 -0
- package/dist/audio/AudioBufferConversion.d.ts.map +1 -0
- package/dist/audio/AudioBufferConversion.js.map +1 -1
- package/dist/audio/AudioPlayer.d.ts +2 -3
- package/dist/audio/AudioPlayer.d.ts.map +1 -0
- package/dist/audio/AudioPlayer.js +3 -188
- package/dist/audio/AudioPlayer.js.map +1 -1
- package/dist/audio/AudioUtilities.d.ts +3 -1
- package/dist/audio/AudioUtilities.d.ts.map +1 -0
- package/dist/audio/AudioUtilities.js +2 -2
- package/dist/audio/AudioUtilities.js.map +1 -1
- package/dist/build-tools/MakeTarballsForInstalledPackages.d.ts +1 -0
- package/dist/build-tools/MakeTarballsForInstalledPackages.d.ts.map +1 -0
- package/dist/build-tools/MakeTarballsForInstalledPackages.js +3 -3
- package/dist/build-tools/MakeTarballsForInstalledPackages.js.map +1 -1
- package/dist/cli/CLI.d.ts +1 -0
- package/dist/cli/CLI.d.ts.map +1 -0
- package/dist/cli/CLI.js +139 -92
- package/dist/cli/CLI.js.map +1 -1
- package/dist/cli/CLIConfigFile.d.ts +1 -0
- package/dist/cli/CLIConfigFile.d.ts.map +1 -0
- package/dist/cli/CLILauncher.d.ts +1 -0
- package/dist/cli/CLILauncher.d.ts.map +1 -0
- package/dist/cli/CLIOptions.d.ts +1 -0
- package/dist/cli/CLIOptions.d.ts.map +1 -0
- package/dist/cli/CLIOptionsSchema.d.ts +1 -0
- package/dist/cli/CLIOptionsSchema.d.ts.map +1 -0
- package/dist/cli/CLIParser.d.ts +1 -0
- package/dist/cli/CLIParser.d.ts.map +1 -0
- package/dist/cli/CLIStarter.d.ts +1 -0
- package/dist/cli/CLIStarter.d.ts.map +1 -0
- package/dist/codecs/FFMpegTranscoder.d.ts +5 -3
- package/dist/codecs/FFMpegTranscoder.d.ts.map +1 -0
- package/dist/codecs/FFMpegTranscoder.js +16 -14
- package/dist/codecs/FFMpegTranscoder.js.map +1 -1
- package/dist/codecs/TIMITCodec.d.ts +1 -0
- package/dist/codecs/TIMITCodec.d.ts.map +1 -0
- package/dist/data-structures/DynamicTypedArray.d.ts +1 -0
- package/dist/data-structures/DynamicTypedArray.d.ts.map +1 -0
- package/dist/data-structures/DynamicTypedArray.js.map +1 -1
- package/dist/data-structures/Queue.d.ts +1 -0
- package/dist/data-structures/Queue.d.ts.map +1 -0
- package/dist/data-structures/WindowedList.d.ts +1 -0
- package/dist/data-structures/WindowedList.d.ts.map +1 -0
- package/dist/data-structures/WindowedList.js.map +1 -1
- package/dist/denoising/NSNet2.d.ts +4 -2
- package/dist/denoising/NSNet2.d.ts.map +1 -0
- package/dist/denoising/NSNet2.js +4 -4
- package/dist/denoising/NSNet2.js.map +1 -1
- package/dist/denoising/RNNoise.d.ts +3 -1
- package/dist/denoising/RNNoise.d.ts.map +1 -0
- package/dist/denoising/RNNoise.js +10 -6
- package/dist/denoising/RNNoise.js.map +1 -1
- package/dist/dsp/BiquadFilter.d.ts +1 -0
- package/dist/dsp/BiquadFilter.d.ts.map +1 -0
- package/dist/dsp/DecayingPeakEstimator.d.ts +1 -0
- package/dist/dsp/DecayingPeakEstimator.d.ts.map +1 -0
- package/dist/dsp/DecayingPeakEstimator.js.map +1 -1
- package/dist/dsp/FFT.d.ts +1 -0
- package/dist/dsp/FFT.d.ts.map +1 -0
- package/dist/dsp/FFT.js +2 -1
- package/dist/dsp/FFT.js.map +1 -1
- package/dist/dsp/KWeightingFilter.d.ts +1 -0
- package/dist/dsp/KWeightingFilter.d.ts.map +1 -0
- package/dist/dsp/KWeightingFilter.js.map +1 -1
- package/dist/dsp/LoudnessEstimator.d.ts +1 -0
- package/dist/dsp/LoudnessEstimator.d.ts.map +1 -0
- package/dist/dsp/LoudnessEstimator.js.map +1 -1
- package/dist/dsp/MFCC.d.ts +4 -2
- package/dist/dsp/MFCC.d.ts.map +1 -0
- package/dist/dsp/MFCC.js +4 -4
- package/dist/dsp/MFCC.js.map +1 -1
- package/dist/dsp/MelSpectrogram.d.ts +11 -8
- package/dist/dsp/MelSpectrogram.d.ts.map +1 -0
- package/dist/dsp/MelSpectrogram.js +31 -34
- package/dist/dsp/MelSpectrogram.js.map +1 -1
- package/dist/dsp/Rubberband.d.ts +1 -0
- package/dist/dsp/Rubberband.d.ts.map +1 -0
- package/dist/dsp/Rubberband.js +8 -3
- package/dist/dsp/Rubberband.js.map +1 -1
- package/dist/dsp/Sonic.d.ts +1 -0
- package/dist/dsp/Sonic.d.ts.map +1 -0
- package/dist/dsp/Sonic.js +1 -1
- package/dist/dsp/Sonic.js.map +1 -1
- package/dist/dsp/SpeexResampler.d.ts +1 -0
- package/dist/dsp/SpeexResampler.d.ts.map +1 -0
- package/dist/dsp/SpeexResampler.js +1 -1
- package/dist/dsp/SpeexResampler.js.map +1 -1
- package/dist/encodings/Ascii.d.ts +2 -1
- package/dist/encodings/Ascii.d.ts.map +1 -0
- package/dist/encodings/Base64.d.ts +1 -0
- package/dist/encodings/Base64.d.ts.map +1 -0
- package/dist/encodings/Base64.js.map +1 -1
- package/dist/encodings/Hex.d.ts +1 -0
- package/dist/encodings/Hex.d.ts.map +1 -0
- package/dist/encodings/HtmlEscape.d.ts +1 -0
- package/dist/encodings/HtmlEscape.d.ts.map +1 -0
- package/dist/encodings/LEB128.d.ts +1 -0
- package/dist/encodings/LEB128.d.ts.map +1 -0
- package/dist/encodings/TextEncodingsCommon.d.ts +1 -0
- package/dist/encodings/TextEncodingsCommon.d.ts.map +1 -0
- package/dist/encodings/Utf16.d.ts +1 -0
- package/dist/encodings/Utf16.d.ts.map +1 -0
- package/dist/encodings/Utf32.d.ts +1 -0
- package/dist/encodings/Utf32.d.ts.map +1 -0
- package/dist/encodings/Utf8.d.ts +1 -0
- package/dist/encodings/Utf8.d.ts.map +1 -0
- package/dist/math/MedianFilter.d.ts +1 -0
- package/dist/math/MedianFilter.d.ts.map +1 -0
- package/dist/math/VectorMath.d.ts +2 -0
- package/dist/math/VectorMath.d.ts.map +1 -0
- package/dist/math/VectorMath.js +9 -5
- package/dist/math/VectorMath.js.map +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts +2 -1
- package/dist/nlp/ChineseSegmentation.d.ts.map +1 -0
- package/dist/nlp/EspeakPhonemizer.d.ts +2 -1
- package/dist/nlp/EspeakPhonemizer.d.ts.map +1 -0
- package/dist/nlp/EspeakPhonemizer.js +2 -2
- package/dist/nlp/EspeakPhonemizer.js.map +1 -1
- package/dist/nlp/IPA.d.ts +3 -2
- package/dist/nlp/IPA.d.ts.map +1 -0
- package/dist/nlp/JapaneseSegmentation.d.ts +1 -0
- package/dist/nlp/JapaneseSegmentation.d.ts.map +1 -0
- package/dist/nlp/Lexicon.d.ts +1 -0
- package/dist/nlp/Lexicon.d.ts.map +1 -0
- package/dist/nlp/PhoneConversion.d.ts +1 -0
- package/dist/nlp/PhoneConversion.d.ts.map +1 -0
- package/dist/nlp/Segmentation.d.ts +2 -1
- package/dist/nlp/Segmentation.d.ts.map +1 -0
- package/dist/nlp/Segmentation.js +8 -4
- package/dist/nlp/Segmentation.js.map +1 -1
- package/dist/nlp/TextNormalizer.d.ts +1 -0
- package/dist/nlp/TextNormalizer.d.ts.map +1 -0
- package/dist/recognition/AmazonTranscribeSTT.d.ts +3 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts.map +1 -0
- package/dist/recognition/AmazonTranscribeSTT.js +3 -3
- package/dist/recognition/AmazonTranscribeSTT.js.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts +3 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts.map +1 -0
- package/dist/recognition/AzureCognitiveServicesSTT.js +4 -4
- package/dist/recognition/AzureCognitiveServicesSTT.js.map +1 -1
- package/dist/recognition/DeepgramSTT.d.ts +3 -1
- package/dist/recognition/DeepgramSTT.d.ts.map +1 -0
- package/dist/recognition/DeepgramSTT.js +12 -13
- package/dist/recognition/DeepgramSTT.js.map +1 -1
- package/dist/recognition/GoogleCloudSTT.d.ts +3 -1
- package/dist/recognition/GoogleCloudSTT.d.ts.map +1 -0
- package/dist/recognition/GoogleCloudSTT.js +11 -10
- package/dist/recognition/GoogleCloudSTT.js.map +1 -1
- package/dist/recognition/OpenAICloudSTT.d.ts +3 -1
- package/dist/recognition/OpenAICloudSTT.d.ts.map +1 -0
- 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 -15
- 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 +73 -85
- package/dist/recognition/WhisperSTT.d.ts.map +1 -0
- package/dist/recognition/WhisperSTT.js +384 -519
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/server/Client.d.ts +3 -2
- package/dist/server/Client.d.ts.map +1 -0
- package/dist/server/Client.js.map +1 -1
- package/dist/server/Server.d.ts +1 -0
- package/dist/server/Server.d.ts.map +1 -0
- package/dist/server/ServerStarter.d.ts +1 -0
- package/dist/server/ServerStarter.d.ts.map +1 -0
- package/dist/server/Worker.d.ts +7 -7
- package/dist/server/Worker.d.ts.map +1 -0
- package/dist/server/Worker.js +42 -44
- package/dist/server/Worker.js.map +1 -1
- package/dist/server/WorkerStarter.d.ts +1 -0
- package/dist/server/WorkerStarter.d.ts.map +1 -0
- package/dist/source-separation/MDXNetSourceSeparation.d.ts +4 -2
- package/dist/source-separation/MDXNetSourceSeparation.d.ts.map +1 -0
- package/dist/source-separation/MDXNetSourceSeparation.js +10 -8
- package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts +4 -2
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts.map +1 -0
- 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 +6 -3
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts.map +1 -0
- 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 +3 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts.map +1 -0
- package/dist/speech-search/DTWSpeechSearch.js +4 -4
- package/dist/speech-search/DTWSpeechSearch.js.map +1 -1
- package/dist/subtitles/Subtitles.d.ts +14 -1
- package/dist/subtitles/Subtitles.d.ts.map +1 -0
- package/dist/subtitles/Subtitles.js +22 -22
- package/dist/subtitles/Subtitles.js.map +1 -1
- package/dist/synthesis/AwsPollyTTS.d.ts +4 -2
- package/dist/synthesis/AwsPollyTTS.d.ts.map +1 -0
- package/dist/synthesis/AwsPollyTTS.js +5 -5
- package/dist/synthesis/AwsPollyTTS.js.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts +3 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts.map +1 -0
- package/dist/synthesis/AzureCognitiveServicesTTS.js +3 -3
- package/dist/synthesis/AzureCognitiveServicesTTS.js.map +1 -1
- package/dist/synthesis/CoquiServerTTS.d.ts +3 -1
- package/dist/synthesis/CoquiServerTTS.d.ts.map +1 -0
- package/dist/synthesis/CoquiServerTTS.js +7 -8
- package/dist/synthesis/CoquiServerTTS.js.map +1 -1
- package/dist/synthesis/DeepgramTTS.d.ts +3 -2
- package/dist/synthesis/DeepgramTTS.d.ts.map +1 -0
- package/dist/synthesis/DeepgramTTS.js +13 -13
- package/dist/synthesis/DeepgramTTS.js.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.d.ts +4 -3
- package/dist/synthesis/ElevenLabsTTS.d.ts.map +1 -0
- package/dist/synthesis/ElevenLabsTTS.js +22 -21
- package/dist/synthesis/ElevenLabsTTS.js.map +1 -1
- package/dist/synthesis/EspeakTTS.d.ts +12 -9
- package/dist/synthesis/EspeakTTS.d.ts.map +1 -0
- package/dist/synthesis/EspeakTTS.js +118 -68
- package/dist/synthesis/EspeakTTS.js.map +1 -1
- package/dist/synthesis/FliteTTS.d.ts +3 -2
- package/dist/synthesis/FliteTTS.d.ts.map +1 -0
- package/dist/synthesis/FliteTTS.js +2 -2
- package/dist/synthesis/FliteTTS.js.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.d.ts +3 -2
- package/dist/synthesis/GnuSpeechTTS.d.ts.map +1 -0
- package/dist/synthesis/GnuSpeechTTS.js +1 -1
- package/dist/synthesis/GnuSpeechTTS.js.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.d.ts +4 -2
- package/dist/synthesis/GoogleCloudTTS.d.ts.map +1 -0
- package/dist/synthesis/GoogleCloudTTS.js +15 -14
- package/dist/synthesis/GoogleCloudTTS.js.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.d.ts +4 -2
- package/dist/synthesis/GoogleTranslateTTS.d.ts.map +1 -0
- package/dist/synthesis/GoogleTranslateTTS.js +11 -11
- package/dist/synthesis/GoogleTranslateTTS.js.map +1 -1
- package/dist/synthesis/KokoroTTS.d.ts +5 -4
- package/dist/synthesis/KokoroTTS.d.ts.map +1 -0
- package/dist/synthesis/KokoroTTS.js +11 -10
- package/dist/synthesis/KokoroTTS.js.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts +5 -3
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts.map +1 -0
- package/dist/synthesis/MicrosoftEdgeTTS.js +41 -20
- package/dist/synthesis/MicrosoftEdgeTTS.js.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.d.ts +3 -2
- package/dist/synthesis/OpenAICloudTTS.d.ts.map +1 -0
- package/dist/synthesis/OpenAICloudTTS.js +6 -5
- package/dist/synthesis/OpenAICloudTTS.js.map +1 -1
- package/dist/synthesis/SamTTS.d.ts +3 -1
- package/dist/synthesis/SamTTS.d.ts.map +1 -0
- package/dist/synthesis/SamTTS.js +2 -2
- package/dist/synthesis/SamTTS.js.map +1 -1
- package/dist/synthesis/SapiTTS.d.ts +3 -2
- package/dist/synthesis/SapiTTS.d.ts.map +1 -0
- package/dist/synthesis/SapiTTS.js +2 -2
- package/dist/synthesis/SapiTTS.js.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.d.ts +3 -2
- package/dist/synthesis/SvoxPicoTTS.d.ts.map +1 -0
- package/dist/synthesis/SvoxPicoTTS.js +3 -3
- package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
- package/dist/synthesis/VitsTTS.d.ts +4 -3
- package/dist/synthesis/VitsTTS.d.ts.map +1 -0
- package/dist/synthesis/VitsTTS.js +14 -11
- package/dist/synthesis/VitsTTS.js.map +1 -1
- package/dist/tests/Test.d.ts +1 -0
- package/dist/tests/Test.d.ts.map +1 -0
- package/dist/text-language-detection/FastTextLanguageDetection.d.ts +1 -0
- package/dist/text-language-detection/FastTextLanguageDetection.d.ts.map +1 -0
- package/dist/text-language-detection/TinyLDLanguageDetection.d.ts +1 -0
- package/dist/text-language-detection/TinyLDLanguageDetection.d.ts.map +1 -0
- package/dist/text-translation/DeepLTextTranslation.d.ts +3 -2
- package/dist/text-translation/DeepLTextTranslation.d.ts.map +1 -0
- package/dist/text-translation/DeepLTextTranslation.js +10 -9
- package/dist/text-translation/DeepLTextTranslation.js.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts +5 -4
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts.map +1 -0
- package/dist/text-translation/GoogleTranslateTextTranslation.js +20 -18
- package/dist/text-translation/GoogleTranslateTextTranslation.js.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.d.ts +3 -2
- package/dist/text-translation/NLLBTextTranslation.d.ts.map +1 -0
- package/dist/text-translation/NLLBTextTranslation.js +4 -6
- package/dist/text-translation/NLLBTextTranslation.js.map +1 -1
- package/dist/typings/TypedArray.d.ts +1 -0
- package/dist/typings/TypedArray.d.ts.map +1 -0
- package/dist/utilities/BrowserRequestHeaders.d.ts +1 -0
- package/dist/utilities/BrowserRequestHeaders.d.ts.map +1 -0
- package/dist/utilities/Compression.d.ts +5 -3
- package/dist/utilities/Compression.d.ts.map +1 -0
- package/dist/utilities/Compression.js +9 -9
- package/dist/utilities/Compression.js.map +1 -1
- package/dist/utilities/FileDownloader.d.ts +7 -3
- package/dist/utilities/FileDownloader.d.ts.map +1 -0
- package/dist/utilities/FileDownloader.js +25 -21
- package/dist/utilities/FileDownloader.js.map +1 -1
- package/dist/utilities/FileReader.d.ts +1 -0
- package/dist/utilities/FileReader.d.ts.map +1 -0
- package/dist/utilities/FileReader.js.map +1 -1
- package/dist/utilities/FileSystem.d.ts +1 -0
- package/dist/utilities/FileSystem.d.ts.map +1 -0
- package/dist/utilities/FileSystem.js +1 -1
- package/dist/utilities/FileSystem.js.map +1 -1
- package/dist/utilities/FileWriter.d.ts +1 -0
- package/dist/utilities/FileWriter.d.ts.map +1 -0
- package/dist/utilities/FileWriter.js.map +1 -1
- package/dist/utilities/Hashing.d.ts +1 -0
- package/dist/utilities/Hashing.d.ts.map +1 -0
- package/dist/utilities/Hashing.js.map +1 -1
- package/dist/utilities/Locale.d.ts +1 -0
- package/dist/utilities/Locale.d.ts.map +1 -0
- package/dist/utilities/Locale.js.map +1 -1
- package/dist/utilities/Logger.d.ts +18 -9
- package/dist/utilities/Logger.d.ts.map +1 -0
- package/dist/utilities/Logger.js +50 -35
- package/dist/utilities/Logger.js.map +1 -1
- package/dist/utilities/NpmUtilities.d.ts +1 -0
- package/dist/utilities/NpmUtilities.d.ts.map +1 -0
- package/dist/utilities/NpmUtilities.js +4 -5
- package/dist/utilities/NpmUtilities.js.map +1 -1
- package/dist/utilities/ObjectUtilities.d.ts +1 -0
- package/dist/utilities/ObjectUtilities.d.ts.map +1 -0
- package/dist/utilities/ObjectUtilities.js.map +1 -1
- package/dist/utilities/OnnxUtilities.d.ts +1 -0
- package/dist/utilities/OnnxUtilities.d.ts.map +1 -0
- package/dist/utilities/OpenPromise.d.ts +1 -0
- package/dist/utilities/OpenPromise.d.ts.map +1 -0
- package/dist/utilities/OpenPromise.js.map +1 -1
- package/dist/utilities/PackageManager.d.ts +5 -1
- package/dist/utilities/PackageManager.d.ts.map +1 -0
- package/dist/utilities/PackageManager.js +37 -22
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/PathUtilities.d.ts +3 -0
- package/dist/utilities/PathUtilities.d.ts.map +1 -0
- package/dist/utilities/PathUtilities.js +5 -2
- package/dist/utilities/PathUtilities.js.map +1 -1
- package/dist/utilities/RandomGenerator.d.ts +1 -0
- package/dist/utilities/RandomGenerator.d.ts.map +1 -0
- package/dist/utilities/SignalChannel.d.ts +1 -0
- package/dist/utilities/SignalChannel.d.ts.map +1 -0
- package/dist/utilities/SmoothEstimator.d.ts +1 -0
- package/dist/utilities/SmoothEstimator.d.ts.map +1 -0
- package/dist/utilities/SmoothEstimator.js.map +1 -1
- package/dist/utilities/StringBuilder.d.ts +1 -0
- package/dist/utilities/StringBuilder.d.ts.map +1 -0
- package/dist/utilities/StringUtilities.d.ts +1 -0
- package/dist/utilities/StringUtilities.d.ts.map +1 -0
- package/dist/utilities/TarballMaker.d.ts +5 -3
- package/dist/utilities/TarballMaker.d.ts.map +1 -0
- package/dist/utilities/TarballMaker.js +6 -6
- package/dist/utilities/TarballMaker.js.map +1 -1
- package/dist/utilities/Timeline.d.ts +1 -0
- package/dist/utilities/Timeline.d.ts.map +1 -0
- package/dist/utilities/Timeline.js.map +1 -1
- package/dist/utilities/Timer.d.ts +1 -0
- package/dist/utilities/Timer.d.ts.map +1 -0
- package/dist/utilities/Utilities.d.ts +10 -7
- package/dist/utilities/Utilities.d.ts.map +1 -0
- package/dist/utilities/Utilities.js +49 -31
- package/dist/utilities/Utilities.js.map +1 -1
- package/dist/utilities/VirtualFileReadStream.d.ts +1 -0
- package/dist/utilities/VirtualFileReadStream.d.ts.map +1 -0
- package/dist/utilities/WebReader.d.ts +3 -1
- package/dist/utilities/WebReader.d.ts.map +1 -0
- package/dist/utilities/WebReader.js +7 -6
- package/dist/utilities/WebReader.js.map +1 -1
- package/dist/utilities/WikipediaReader.d.ts +3 -1
- package/dist/utilities/WikipediaReader.d.ts.map +1 -0
- package/dist/utilities/WikipediaReader.js +1 -5
- package/dist/utilities/WikipediaReader.js.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts +3 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts.map +1 -0
- 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 +1 -0
- package/dist/voice-activity-detection/SileroVAD.d.ts.map +1 -0
- package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.d.ts +1 -0
- package/dist/voice-activity-detection/WebRtcVAD.d.ts.map +1 -0
- 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 -39
- 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 -94
- package/dist/audio/AudioRecorder.d.ts +0 -3
- package/dist/audio/AudioRecorder.js +0 -68
- package/dist/audio/AudioRecorder.js.map +0 -1
- package/dist/audio/SoxPath.d.ts +0 -1
- package/dist/audio/SoxPath.js +0 -24
- package/dist/audio/SoxPath.js.map +0 -1
- package/dist/recognition/SileroSTT.d.ts +0 -29
- package/dist/recognition/SileroSTT.js +0 -152
- package/dist/recognition/SileroSTT.js.map +0 -1
- package/dist/recognition/VoskSTT.d.ts +0 -10
- package/dist/recognition/VoskSTT.js +0 -72
- package/dist/recognition/VoskSTT.js.map +0 -1
- package/dist/recognition/WhisperCppSTT.js.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.d.ts +0 -11
- package/dist/synthesis/StreamlabsPollyTTS.js +0 -88
- package/dist/synthesis/StreamlabsPollyTTS.js.map +0 -1
- package/dist/utilities/BinaryUtilities.d.ts +0 -13
- package/dist/utilities/BinaryUtilities.js +0 -113
- package/dist/utilities/BinaryUtilities.js.map +0 -1
- package/src/audio/AudioRecorder.ts +0 -91
- package/src/audio/SoxPath.ts +0 -31
- package/src/recognition/SileroSTT.ts +0 -222
- package/src/recognition/VoskSTT.ts +0 -112
- package/src/synthesis/StreamlabsPollyTTS.ts +0 -114
- package/src/utilities/BinaryUtilities.ts +0 -138
- /package/{LICENSE.md → LICENSE.GPLv3.md} +0 -0
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process'
|
|
2
2
|
import { RawAudio, encodeRawAudioToWave, getRawAudioDuration } from '../audio/AudioUtilities.js'
|
|
3
3
|
import { Logger } from '../utilities/Logger.js'
|
|
4
|
-
import { type WhisperTask, type
|
|
4
|
+
import { type WhisperTask, type WhisperModelId, type WhisperQuantizedModelId } from './WhisperCommon.js'
|
|
5
5
|
import { getRandomHexString } from '../utilities/Utilities.js'
|
|
6
6
|
import { Timeline, TimelineEntryType } from '../utilities/Timeline.js'
|
|
7
7
|
import { tryParseTimeRangePatternWithHours } from '../subtitles/Subtitles.js'
|
|
8
8
|
import { getAppTempDir, joinPath } from '../utilities/PathUtilities.js'
|
|
9
|
-
import { appName } from '../api/Common.js'
|
|
9
|
+
import { appName, OperationCallbacks } from '../api/Common.js'
|
|
10
10
|
import { readAndParseJsonFile, remove } from '../utilities/FileSystem.js'
|
|
11
11
|
import { splitToLines } from '../nlp/Segmentation.js'
|
|
12
12
|
import { extendDeep } from '../utilities/ObjectUtilities.js'
|
|
13
13
|
import { formatLanguageCodeWithName, getShortLanguageCode } from '../utilities/Locale.js'
|
|
14
|
-
import { loadPackage } from '../utilities/PackageManager.js'
|
|
15
|
-
import { detectSpeechLanguageByParts } from '../api/SpeechLanguageDetection.js'
|
|
14
|
+
import { loadPackage, LoadPackageCallbacks } from '../utilities/PackageManager.js'
|
|
15
|
+
import { detectSpeechLanguageByParts, SpeechLanguageDetectionCallbacks } from '../api/SpeechLanguageDetection.js'
|
|
16
|
+
import { RecognitionCallbacks } from '../api/Recognition.js'
|
|
16
17
|
|
|
17
18
|
export async function recognize(
|
|
18
19
|
sourceRawAudio: RawAudio,
|
|
19
20
|
task: WhisperTask,
|
|
20
21
|
sourceLanguage: string | undefined,
|
|
21
|
-
|
|
22
|
+
modelId: WhisperModelId,
|
|
22
23
|
modelPath: string,
|
|
23
|
-
options:
|
|
24
|
+
options: WhisperCppCliOptions,
|
|
25
|
+
callbacks: RecognitionCallbacks) {
|
|
24
26
|
|
|
25
27
|
return new Promise<RecognitionResult>(async (resolve, reject) => {
|
|
26
|
-
const logger = new Logger()
|
|
28
|
+
const logger = new Logger(callbacks.logLevel)
|
|
27
29
|
|
|
28
30
|
if (sourceRawAudio.sampleRate != 16000) {
|
|
29
31
|
throw new Error('Source audio must have a sample rate of 16000 Hz')
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
options = extendDeep(
|
|
34
|
+
options = extendDeep(defaultWhisperCppCliOptions, options)
|
|
33
35
|
|
|
34
|
-
let buildKind:
|
|
36
|
+
let buildKind: WhisperCppCliBuild
|
|
35
37
|
let executablePath: string
|
|
36
38
|
|
|
37
39
|
if (options.executablePath) {
|
|
@@ -48,11 +50,11 @@ export async function recognize(
|
|
|
48
50
|
|
|
49
51
|
if (options.enableGPU == null) {
|
|
50
52
|
options.enableGPU = buildKind.startsWith('cublas-')
|
|
51
|
-
} else if (options.enableGPU === true && !buildKind.startsWith('cublas-')) {
|
|
53
|
+
} else if (process.platform !== 'darwin' && options.enableGPU === true && !buildKind.startsWith('cublas-')) {
|
|
52
54
|
throw new Error('GPU support is only available for CUDA builds')
|
|
53
55
|
}
|
|
54
56
|
} else {
|
|
55
|
-
if (options.enableGPU) {
|
|
57
|
+
if (process.platform !== 'darwin' && options.enableGPU) {
|
|
56
58
|
buildKind = 'cublas-12.4.0'
|
|
57
59
|
} else {
|
|
58
60
|
buildKind = 'cpu'
|
|
@@ -61,7 +63,7 @@ export async function recognize(
|
|
|
61
63
|
|
|
62
64
|
logger.end()
|
|
63
65
|
|
|
64
|
-
executablePath = await
|
|
66
|
+
executablePath = await loadBinariesPackage(buildKind, callbacks)
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
if (options.enableFlashAttention && options.enableDTW) {
|
|
@@ -72,7 +74,7 @@ export async function recognize(
|
|
|
72
74
|
throw new Error(`The 'large-v3-turbo' model doesn't support translation tasks.`)
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
logger.start(`Recognize with command-line whisper.cpp (model: ${options.model ||
|
|
77
|
+
logger.start(`Recognize with command-line whisper.cpp (model: ${options.model || modelId}, build: ${buildKind})`)
|
|
76
78
|
logger.log('')
|
|
77
79
|
logger.log('')
|
|
78
80
|
|
|
@@ -135,7 +137,7 @@ export async function recognize(
|
|
|
135
137
|
'0',
|
|
136
138
|
|
|
137
139
|
'--dtw',
|
|
138
|
-
|
|
140
|
+
modelId.replaceAll('-', '.'),
|
|
139
141
|
)
|
|
140
142
|
} else {
|
|
141
143
|
args.push(
|
|
@@ -148,6 +150,10 @@ export async function recognize(
|
|
|
148
150
|
args.push(
|
|
149
151
|
'--flash-attn'
|
|
150
152
|
)
|
|
153
|
+
} else {
|
|
154
|
+
args.push(
|
|
155
|
+
'--no-flash-attn'
|
|
156
|
+
)
|
|
151
157
|
}
|
|
152
158
|
|
|
153
159
|
if (task === 'translate') {
|
|
@@ -158,13 +164,18 @@ export async function recognize(
|
|
|
158
164
|
|
|
159
165
|
const argsString = args.join(' ')
|
|
160
166
|
|
|
161
|
-
const
|
|
167
|
+
const cliProcess = spawn(executablePath, [...args, '-'])
|
|
168
|
+
|
|
169
|
+
callbacks.abortSignal?.addEventListener('abort', () => {
|
|
170
|
+
reject(new DOMException('whisper.cpp CLI process aborted by user.', 'AbortError'))
|
|
171
|
+
cliProcess.kill()
|
|
172
|
+
})
|
|
162
173
|
|
|
163
174
|
const stdoutLines: string[] = []
|
|
164
175
|
let stderrOutput = ''
|
|
165
176
|
|
|
166
|
-
|
|
167
|
-
|
|
177
|
+
cliProcess.stdout.setEncoding('utf8')
|
|
178
|
+
cliProcess.stdout.on('data', (str: string) => {
|
|
168
179
|
if (task === 'detect-language') {
|
|
169
180
|
return
|
|
170
181
|
}
|
|
@@ -178,8 +189,8 @@ export async function recognize(
|
|
|
178
189
|
stdoutLines.push(...parts)
|
|
179
190
|
})
|
|
180
191
|
|
|
181
|
-
|
|
182
|
-
|
|
192
|
+
cliProcess.stderr.setEncoding('utf8')
|
|
193
|
+
cliProcess.stderr.on('data', (str: string) => {
|
|
183
194
|
if (options.verbose) {
|
|
184
195
|
logger.log(str)
|
|
185
196
|
}
|
|
@@ -187,23 +198,23 @@ export async function recognize(
|
|
|
187
198
|
stderrOutput += str
|
|
188
199
|
})
|
|
189
200
|
|
|
190
|
-
|
|
201
|
+
cliProcess.on('error', (e) => {
|
|
191
202
|
reject(e)
|
|
192
203
|
})
|
|
193
204
|
|
|
194
|
-
|
|
205
|
+
cliProcess.on('close', async (exitCode) => {
|
|
195
206
|
logger.end()
|
|
196
207
|
|
|
197
208
|
if (exitCode === 0) {
|
|
198
209
|
const parsedStdOut = parseStdOutLinesToTimeline(stdoutLines, 'word')
|
|
199
210
|
|
|
200
|
-
const resultObject:
|
|
211
|
+
const resultObject: WhisperCppCliVerboseResult = await readAndParseJsonFile(outJsonFilePath)
|
|
201
212
|
await remove(outJsonFilePath)
|
|
202
213
|
|
|
203
214
|
if (task === 'detect-language') {
|
|
204
215
|
resolve({ timeline: [], transcript: '', language: resultObject.result.language })
|
|
205
216
|
} else {
|
|
206
|
-
const parsedResultObject = await parseResultObject(resultObject,
|
|
217
|
+
const parsedResultObject = await parseResultObject(resultObject, modelId, getRawAudioDuration(sourceRawAudio), options.enableDTW!, callbacks)
|
|
207
218
|
|
|
208
219
|
resolve(parsedResultObject)
|
|
209
220
|
}
|
|
@@ -214,12 +225,12 @@ export async function recognize(
|
|
|
214
225
|
}
|
|
215
226
|
})
|
|
216
227
|
|
|
217
|
-
//writeToStdinInChunks(
|
|
218
|
-
|
|
228
|
+
//writeToStdinInChunks(cliProcess, sourceAsWave, 2 ** 10)
|
|
229
|
+
cliProcess.stdin.end(sourceAsWave)
|
|
219
230
|
})
|
|
220
231
|
}
|
|
221
232
|
|
|
222
|
-
export async function detectLanguage(sourceRawAudio: RawAudio,
|
|
233
|
+
export async function detectLanguage(sourceRawAudio: RawAudio, modelId: WhisperModelId, modelPath: string, callbacks: SpeechLanguageDetectionCallbacks) {
|
|
223
234
|
if (sourceRawAudio.sampleRate != 16000) {
|
|
224
235
|
throw new Error('Source audio must have a sample rate of 16000')
|
|
225
236
|
}
|
|
@@ -229,9 +240,10 @@ export async function detectLanguage(sourceRawAudio: RawAudio, modelName: Whispe
|
|
|
229
240
|
partAudio,
|
|
230
241
|
'detect-language',
|
|
231
242
|
undefined,
|
|
232
|
-
|
|
243
|
+
modelId,
|
|
233
244
|
modelPath,
|
|
234
245
|
{},
|
|
246
|
+
{ abortSignal: callbacks.abortSignal, logLevel: callbacks.logLevel }
|
|
235
247
|
)
|
|
236
248
|
|
|
237
249
|
const partResults = [{
|
|
@@ -243,18 +255,24 @@ export async function detectLanguage(sourceRawAudio: RawAudio, modelName: Whispe
|
|
|
243
255
|
return partResults
|
|
244
256
|
}
|
|
245
257
|
|
|
246
|
-
const results = await detectSpeechLanguageByParts(
|
|
258
|
+
const results = await detectSpeechLanguageByParts(
|
|
259
|
+
sourceRawAudio,
|
|
260
|
+
detectLanguageForPart,
|
|
261
|
+
undefined,
|
|
262
|
+
undefined,
|
|
263
|
+
callbacks,
|
|
264
|
+
)
|
|
247
265
|
|
|
248
266
|
results.sort((entry1, entry2) => entry2.probability - entry1.probability)
|
|
249
267
|
|
|
250
268
|
return results
|
|
251
269
|
}
|
|
252
270
|
|
|
253
|
-
async function parseResultObject(resultObject:
|
|
254
|
-
const { Whisper } = await import('
|
|
271
|
+
async function parseResultObject(resultObject: WhisperCppCliVerboseResult, modelId: WhisperModelId, totalDuration: number, enableDTW: boolean, callbacks: OperationCallbacks): Promise<RecognitionResult> {
|
|
272
|
+
const { Whisper } = await import('./WhisperSTT.js')
|
|
255
273
|
|
|
256
|
-
const whisper = new Whisper(
|
|
257
|
-
await whisper.initializeTokenizerIfNeeded()
|
|
274
|
+
const whisper = new Whisper(modelId, '', '')
|
|
275
|
+
await whisper.initializeTokenizerIfNeeded(callbacks)
|
|
258
276
|
|
|
259
277
|
const tokenTimeline: Timeline = []
|
|
260
278
|
|
|
@@ -374,38 +392,9 @@ function parseStdOutLinesToTimeline(lines: string[], entryType: TimelineEntryTyp
|
|
|
374
392
|
return { transcript, timeline }
|
|
375
393
|
}
|
|
376
394
|
|
|
377
|
-
export
|
|
378
|
-
if (modelId === 'large') {
|
|
379
|
-
modelId = 'large-v2'
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
if (modelId) {
|
|
383
|
-
const modelName = getModelNameFromModelId(modelId)
|
|
384
|
-
|
|
385
|
-
if (languageCode != 'en' && modelName.endsWith('.en')) {
|
|
386
|
-
throw new Error(`The English-only model '${modelName}' cannot be used with a non-English language '${languageCode}'.`)
|
|
387
|
-
}
|
|
388
|
-
} else {
|
|
389
|
-
if (languageCode) {
|
|
390
|
-
const shortLanguageCode = getShortLanguageCode(languageCode)
|
|
395
|
+
export type WhisperCppCliBuild = 'cpu' | 'cublas-12.4.0' | 'custom'
|
|
391
396
|
|
|
392
|
-
|
|
393
|
-
} else {
|
|
394
|
-
modelId = 'base'
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
const packageName = `whisper.cpp-${modelId}`
|
|
399
|
-
const modelDir = await loadPackage(packageName)
|
|
400
|
-
const modelPath = joinPath(modelDir, `ggml-${modelId}.bin`)
|
|
401
|
-
const modelName = getModelNameFromModelId(modelId)
|
|
402
|
-
|
|
403
|
-
return { modelName, modelPath }
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
export type WhisperCppBuild = 'cpu' | 'cublas-12.4.0' | 'custom'
|
|
407
|
-
|
|
408
|
-
export async function loadExecutablePackage(buildKind: WhisperCppBuild) {
|
|
397
|
+
export async function loadBinariesPackage(buildKind: WhisperCppCliBuild, callbacks: LoadPackageCallbacks) {
|
|
409
398
|
if (buildKind === 'custom') {
|
|
410
399
|
throw new Error(`A 'custom' build kind requires providing a custom path to the 'whisper-cli' executable in the 'executablePath' option.`)
|
|
411
400
|
}
|
|
@@ -417,17 +406,25 @@ export async function loadExecutablePackage(buildKind: WhisperCppBuild) {
|
|
|
417
406
|
|
|
418
407
|
if (buildKind.startsWith('cublas-')) {
|
|
419
408
|
if (platform === 'win32' && arch === 'x64') {
|
|
420
|
-
packageName = `whisper.cpp-binaries-windows-x64-${buildKind}
|
|
409
|
+
packageName = `whisper.cpp-binaries-windows-x64-${buildKind}`
|
|
421
410
|
} else if (platform === 'linux' && arch === 'x64') {
|
|
422
|
-
packageName = `whisper.cpp-binaries-linux-x64-${buildKind}
|
|
411
|
+
packageName = `whisper.cpp-binaries-linux-x64-${buildKind}`
|
|
423
412
|
} else {
|
|
424
413
|
throw new Error(`whisper.cpp GPU builds (NVIDIA CUDA only) are currently only available as packages for Windows x64 and Linux x64. Please specify a custom path to a whisper.cpp 'main' binary in the 'executablePath' option.`)
|
|
425
414
|
}
|
|
426
415
|
} else if (buildKind === 'cpu') {
|
|
427
416
|
if (platform === 'win32' && arch === 'x64') {
|
|
428
|
-
packageName = `whisper.cpp-binaries-windows-x64-cpu
|
|
417
|
+
packageName = `whisper.cpp-binaries-windows-x64-cpu`
|
|
418
|
+
} else if (platform === 'win32' && arch === 'arm64') {
|
|
419
|
+
packageName = `whisper.cpp-binaries-windows-arm64-cpu`
|
|
420
|
+
} else if (platform === 'darwin' && arch === 'x64') {
|
|
421
|
+
packageName = `whisper.cpp-binaries-macos-universal`
|
|
422
|
+
} else if (platform === 'darwin' && arch === 'arm64') {
|
|
423
|
+
packageName = `whisper.cpp-binaries-macos-universal`
|
|
429
424
|
} else if (platform === 'linux' && arch === 'x64') {
|
|
430
|
-
packageName = `whisper.cpp-binaries-linux-x64-cpu
|
|
425
|
+
packageName = `whisper.cpp-binaries-linux-x64-cpu`
|
|
426
|
+
} else if (platform === 'linux' && arch === 'arm64') {
|
|
427
|
+
packageName = `whisper.cpp-binaries-linux-arm64-cpu`
|
|
431
428
|
} else {
|
|
432
429
|
throw new Error(`Couldn't find a matching whisper.cpp binary package. Please specify a custom path to a whisper.cpp 'main' binary in the 'executablePath' option.`)
|
|
433
430
|
}
|
|
@@ -435,9 +432,9 @@ export async function loadExecutablePackage(buildKind: WhisperCppBuild) {
|
|
|
435
432
|
throw new Error(`Unsupported build kind '${buildKind}'`)
|
|
436
433
|
}
|
|
437
434
|
|
|
438
|
-
const packagePath = await loadPackage(packageName)
|
|
435
|
+
const packagePath = await loadPackage(packageName, callbacks)
|
|
439
436
|
|
|
440
|
-
let filename = 'whisper-cli'
|
|
437
|
+
let filename = 'whisper-cli'
|
|
441
438
|
|
|
442
439
|
if (platform === 'win32') {
|
|
443
440
|
filename += '.exe'
|
|
@@ -446,37 +443,7 @@ export async function loadExecutablePackage(buildKind: WhisperCppBuild) {
|
|
|
446
443
|
return joinPath(packagePath, filename)
|
|
447
444
|
}
|
|
448
445
|
|
|
449
|
-
|
|
450
|
-
if (modelId.startsWith('large-v1')) {
|
|
451
|
-
return 'large-v1'
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
if (modelId.startsWith('large-v2')) {
|
|
455
|
-
return 'large-v2'
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
if (modelId.startsWith('large-v3-turbo')) {
|
|
459
|
-
return 'large-v3-turbo'
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
if (modelId.startsWith('large-v3')) {
|
|
463
|
-
return 'large-v3'
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
const lastDashIndex = modelId.lastIndexOf('-')
|
|
467
|
-
|
|
468
|
-
let modelName: string
|
|
469
|
-
|
|
470
|
-
if (lastDashIndex >= 0) {
|
|
471
|
-
modelName = modelId.substring(0, lastDashIndex) as WhisperModelName
|
|
472
|
-
} else {
|
|
473
|
-
modelName = modelId
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
return modelName as WhisperModelName
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
export interface WhisperCppVerboseResult {
|
|
446
|
+
export interface WhisperCppCliVerboseResult {
|
|
480
447
|
model: {
|
|
481
448
|
type: string
|
|
482
449
|
multilingual: boolean
|
|
@@ -535,13 +502,13 @@ interface RecognitionResult {
|
|
|
535
502
|
language?: string
|
|
536
503
|
}
|
|
537
504
|
|
|
538
|
-
export interface
|
|
539
|
-
build?:
|
|
505
|
+
export interface WhisperCppCliOptions {
|
|
506
|
+
build?: WhisperCppCliBuild
|
|
540
507
|
executablePath?: string
|
|
541
|
-
enableGPU?: boolean
|
|
542
508
|
|
|
543
|
-
model?:
|
|
509
|
+
model?: WhisperQuantizedModelId
|
|
544
510
|
|
|
511
|
+
enableGPU?: boolean
|
|
545
512
|
threadCount?: number,
|
|
546
513
|
splitCount?: number,
|
|
547
514
|
|
|
@@ -559,15 +526,15 @@ export interface WhisperCppOptions {
|
|
|
559
526
|
verbose?: boolean
|
|
560
527
|
}
|
|
561
528
|
|
|
562
|
-
export const
|
|
529
|
+
export const defaultWhisperCppCliOptions: WhisperCppCliOptions = {
|
|
563
530
|
build: undefined,
|
|
564
531
|
executablePath: undefined,
|
|
565
532
|
|
|
566
533
|
model: undefined,
|
|
567
534
|
|
|
535
|
+
enableGPU: undefined,
|
|
568
536
|
threadCount: 4,
|
|
569
537
|
splitCount: 1,
|
|
570
|
-
enableGPU: undefined,
|
|
571
538
|
|
|
572
539
|
topCandidateCount: 5,
|
|
573
540
|
beamCount: 5,
|
|
@@ -583,30 +550,3 @@ export const defaultWhisperCppOptions: WhisperCppOptions = {
|
|
|
583
550
|
|
|
584
551
|
verbose: false,
|
|
585
552
|
}
|
|
586
|
-
|
|
587
|
-
export type WhisperCppModelId =
|
|
588
|
-
'tiny' |
|
|
589
|
-
'tiny-q5_1' |
|
|
590
|
-
'tiny.en' |
|
|
591
|
-
'tiny.en-q5_1' |
|
|
592
|
-
'tiny.en-q8_0' |
|
|
593
|
-
'base' |
|
|
594
|
-
'base-q5_1' |
|
|
595
|
-
'base.en' |
|
|
596
|
-
'base.en-q5_1' |
|
|
597
|
-
'small' |
|
|
598
|
-
'small-q5_1' |
|
|
599
|
-
'small.en' |
|
|
600
|
-
'small.en-q5_1' |
|
|
601
|
-
'medium' |
|
|
602
|
-
'medium-q5_0' |
|
|
603
|
-
'medium.en' |
|
|
604
|
-
'medium.en-q5_0' |
|
|
605
|
-
'large' |
|
|
606
|
-
'large-v1' |
|
|
607
|
-
'large-v2' |
|
|
608
|
-
'large-v2-q5_0' |
|
|
609
|
-
'large-v3' |
|
|
610
|
-
'large-v3-q5_0' |
|
|
611
|
-
`large-v3-turbo` |
|
|
612
|
-
`large-v3-turbo-q5_0`
|