echogarden 2.10.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.MIT.md +7 -0
- package/README.md +9 -1
- package/data/lexicons/heteronyms.en.json +44 -10
- package/data/lexicons/words.en.json +726 -22
- package/data/schemas/options.json +91 -153
- package/dist/alignment/DTWMfccSequenceAlignment.js.map +1 -1
- package/dist/alignment/SemanticTextAlignment.d.ts +4 -2
- package/dist/alignment/SemanticTextAlignment.d.ts.map +1 -1
- package/dist/alignment/SemanticTextAlignment.js +7 -7
- package/dist/alignment/SemanticTextAlignment.js.map +1 -1
- package/dist/alignment/SpeechAlignment.d.ts +9 -10
- package/dist/alignment/SpeechAlignment.d.ts.map +1 -1
- package/dist/alignment/SpeechAlignment.js +23 -96
- package/dist/alignment/SpeechAlignment.js.map +1 -1
- package/dist/api/APIOptions.d.ts +1 -1
- package/dist/api/APIOptions.d.ts.map +1 -1
- package/dist/api/Alignment.d.ts +8 -6
- package/dist/api/Alignment.d.ts.map +1 -1
- package/dist/api/Alignment.js +31 -40
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/Common.d.ts +7 -0
- package/dist/api/Common.d.ts.map +1 -1
- package/dist/api/Common.js.map +1 -1
- package/dist/api/Denoising.d.ts +5 -2
- package/dist/api/Denoising.d.ts.map +1 -1
- package/dist/api/Denoising.js +15 -15
- package/dist/api/Denoising.js.map +1 -1
- package/dist/api/GlobalOptions.d.ts +2 -8
- package/dist/api/GlobalOptions.d.ts.map +1 -1
- package/dist/api/GlobalOptions.js +2 -13
- package/dist/api/GlobalOptions.js.map +1 -1
- package/dist/api/Recognition.d.ts +11 -12
- package/dist/api/Recognition.d.ts.map +1 -1
- package/dist/api/Recognition.js +32 -82
- package/dist/api/Recognition.js.map +1 -1
- package/dist/api/SourceSeparation.d.ts +7 -2
- package/dist/api/SourceSeparation.d.ts.map +1 -1
- package/dist/api/SourceSeparation.js +12 -10
- package/dist/api/SourceSeparation.js.map +1 -1
- package/dist/api/SpeechLanguageDetection.d.ts +11 -7
- package/dist/api/SpeechLanguageDetection.d.ts.map +1 -1
- package/dist/api/SpeechLanguageDetection.js +37 -30
- package/dist/api/SpeechLanguageDetection.js.map +1 -1
- package/dist/api/SpeechSearch.d.ts +4 -1
- package/dist/api/SpeechSearch.d.ts.map +1 -1
- package/dist/api/SpeechSearch.js.map +1 -1
- package/dist/api/SpeechTranslation.d.ts +10 -6
- package/dist/api/SpeechTranslation.d.ts.map +1 -1
- package/dist/api/SpeechTranslation.js +28 -26
- package/dist/api/SpeechTranslation.js.map +1 -1
- package/dist/api/Synthesis.d.ts +13 -8
- package/dist/api/Synthesis.d.ts.map +1 -1
- package/dist/api/Synthesis.js +67 -89
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/api/TextLanguageDetection.d.ts +4 -2
- package/dist/api/TextLanguageDetection.d.ts.map +1 -1
- package/dist/api/TextLanguageDetection.js +4 -7
- package/dist/api/TextLanguageDetection.js.map +1 -1
- package/dist/api/TextTranslation.d.ts +4 -2
- package/dist/api/TextTranslation.d.ts.map +1 -1
- package/dist/api/TextTranslation.js +13 -24
- package/dist/api/TextTranslation.js.map +1 -1
- package/dist/api/TimelineTranslationAlignment.d.ts +6 -3
- package/dist/api/TimelineTranslationAlignment.d.ts.map +1 -1
- package/dist/api/TimelineTranslationAlignment.js +20 -11
- package/dist/api/TimelineTranslationAlignment.js.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.d.ts +6 -4
- package/dist/api/TranscriptAndTranslationAlignment.d.ts.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.js +11 -12
- package/dist/api/TranscriptAndTranslationAlignment.js.map +1 -1
- package/dist/api/TranslationAlignment.d.ts +6 -4
- package/dist/api/TranslationAlignment.d.ts.map +1 -1
- package/dist/api/TranslationAlignment.js +20 -21
- package/dist/api/TranslationAlignment.js.map +1 -1
- package/dist/api/VoiceActivityDetection.d.ts +9 -8
- package/dist/api/VoiceActivityDetection.d.ts.map +1 -1
- package/dist/api/VoiceActivityDetection.js +20 -43
- package/dist/api/VoiceActivityDetection.js.map +1 -1
- package/dist/audio/AudioBufferConversion.js.map +1 -1
- package/dist/audio/AudioPlayer.d.ts +1 -3
- package/dist/audio/AudioPlayer.d.ts.map +1 -1
- package/dist/audio/AudioPlayer.js +3 -188
- package/dist/audio/AudioPlayer.js.map +1 -1
- package/dist/audio/AudioUtilities.d.ts +2 -1
- package/dist/audio/AudioUtilities.d.ts.map +1 -1
- package/dist/audio/AudioUtilities.js +2 -2
- package/dist/audio/AudioUtilities.js.map +1 -1
- package/dist/build-tools/MakeTarballsForInstalledPackages.js +3 -3
- package/dist/build-tools/MakeTarballsForInstalledPackages.js.map +1 -1
- package/dist/cli/CLI.d.ts.map +1 -1
- package/dist/cli/CLI.js +139 -92
- package/dist/cli/CLI.js.map +1 -1
- package/dist/codecs/FFMpegTranscoder.d.ts +4 -3
- package/dist/codecs/FFMpegTranscoder.d.ts.map +1 -1
- package/dist/codecs/FFMpegTranscoder.js +16 -14
- package/dist/codecs/FFMpegTranscoder.js.map +1 -1
- package/dist/codecs/TIMITCodec.d.ts.map +1 -1
- package/dist/data-structures/DynamicTypedArray.d.ts.map +1 -1
- package/dist/data-structures/DynamicTypedArray.js.map +1 -1
- package/dist/data-structures/Queue.d.ts.map +1 -1
- package/dist/data-structures/WindowedList.d.ts.map +1 -1
- package/dist/data-structures/WindowedList.js.map +1 -1
- package/dist/denoising/NSNet2.d.ts +3 -2
- package/dist/denoising/NSNet2.d.ts.map +1 -1
- package/dist/denoising/NSNet2.js +4 -4
- package/dist/denoising/NSNet2.js.map +1 -1
- package/dist/denoising/RNNoise.d.ts +2 -1
- package/dist/denoising/RNNoise.d.ts.map +1 -1
- package/dist/denoising/RNNoise.js +10 -6
- package/dist/denoising/RNNoise.js.map +1 -1
- package/dist/dsp/BiquadFilter.d.ts.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.d.ts.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.js.map +1 -1
- package/dist/dsp/FFT.d.ts.map +1 -1
- package/dist/dsp/FFT.js +2 -1
- package/dist/dsp/FFT.js.map +1 -1
- package/dist/dsp/KWeightingFilter.d.ts.map +1 -1
- package/dist/dsp/KWeightingFilter.js.map +1 -1
- package/dist/dsp/LoudnessEstimator.d.ts.map +1 -1
- package/dist/dsp/LoudnessEstimator.js.map +1 -1
- package/dist/dsp/MFCC.d.ts +3 -2
- package/dist/dsp/MFCC.d.ts.map +1 -1
- package/dist/dsp/MFCC.js +4 -4
- package/dist/dsp/MFCC.js.map +1 -1
- package/dist/dsp/MelSpectrogram.d.ts +10 -8
- package/dist/dsp/MelSpectrogram.d.ts.map +1 -1
- package/dist/dsp/MelSpectrogram.js +31 -34
- package/dist/dsp/MelSpectrogram.js.map +1 -1
- package/dist/dsp/Rubberband.d.ts.map +1 -1
- package/dist/dsp/Rubberband.js +8 -3
- package/dist/dsp/Rubberband.js.map +1 -1
- package/dist/dsp/Sonic.d.ts.map +1 -1
- package/dist/dsp/Sonic.js +1 -1
- package/dist/dsp/Sonic.js.map +1 -1
- package/dist/dsp/SpeexResampler.d.ts.map +1 -1
- package/dist/dsp/SpeexResampler.js +1 -1
- package/dist/dsp/SpeexResampler.js.map +1 -1
- package/dist/encodings/Ascii.d.ts +1 -1
- package/dist/encodings/Ascii.d.ts.map +1 -1
- package/dist/encodings/Base64.js.map +1 -1
- package/dist/encodings/Utf16.d.ts.map +1 -1
- package/dist/encodings/Utf8.d.ts.map +1 -1
- package/dist/math/VectorMath.d.ts +1 -0
- package/dist/math/VectorMath.d.ts.map +1 -1
- package/dist/math/VectorMath.js +9 -5
- package/dist/math/VectorMath.js.map +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts.map +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts.map +1 -1
- package/dist/nlp/EspeakPhonemizer.js +2 -2
- package/dist/nlp/EspeakPhonemizer.js.map +1 -1
- package/dist/nlp/IPA.d.ts +2 -2
- package/dist/nlp/Segmentation.d.ts +1 -1
- package/dist/nlp/Segmentation.d.ts.map +1 -1
- package/dist/nlp/Segmentation.js +8 -4
- package/dist/nlp/Segmentation.js.map +1 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts +2 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts.map +1 -1
- package/dist/recognition/AmazonTranscribeSTT.js +3 -3
- package/dist/recognition/AmazonTranscribeSTT.js.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts +2 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.js +4 -4
- package/dist/recognition/AzureCognitiveServicesSTT.js.map +1 -1
- package/dist/recognition/DeepgramSTT.d.ts +2 -1
- package/dist/recognition/DeepgramSTT.d.ts.map +1 -1
- package/dist/recognition/DeepgramSTT.js +12 -13
- package/dist/recognition/DeepgramSTT.js.map +1 -1
- package/dist/recognition/GoogleCloudSTT.d.ts +2 -1
- package/dist/recognition/GoogleCloudSTT.d.ts.map +1 -1
- package/dist/recognition/GoogleCloudSTT.js +11 -10
- package/dist/recognition/GoogleCloudSTT.js.map +1 -1
- package/dist/recognition/OpenAICloudSTT.d.ts +2 -1
- package/dist/recognition/OpenAICloudSTT.d.ts.map +1 -1
- package/dist/recognition/OpenAICloudSTT.js +6 -6
- package/dist/recognition/OpenAICloudSTT.js.map +1 -1
- package/dist/recognition/WhisperCommon.d.ts +9 -0
- package/dist/recognition/WhisperCommon.d.ts.map +1 -0
- package/dist/recognition/WhisperCommon.js +52 -0
- package/dist/recognition/WhisperCommon.js.map +1 -0
- package/dist/recognition/{WhisperCppSTT.d.ts → WhisperCppCliSTT.d.ts} +14 -16
- package/dist/recognition/WhisperCppCliSTT.d.ts.map +1 -0
- package/dist/recognition/{WhisperCppSTT.js → WhisperCppCliSTT.js} +55 -84
- package/dist/recognition/WhisperCppCliSTT.js.map +1 -0
- package/dist/recognition/WhisperSTT.d.ts +72 -85
- package/dist/recognition/WhisperSTT.d.ts.map +1 -1
- package/dist/recognition/WhisperSTT.js +384 -519
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/server/Client.d.ts +2 -2
- package/dist/server/Client.d.ts.map +1 -1
- package/dist/server/Client.js.map +1 -1
- package/dist/server/Worker.d.ts +6 -7
- package/dist/server/Worker.d.ts.map +1 -1
- package/dist/server/Worker.js +42 -44
- package/dist/server/Worker.js.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.d.ts +3 -2
- package/dist/source-separation/MDXNetSourceSeparation.d.ts.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.js +10 -8
- package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts +3 -2
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js +5 -5
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts +5 -3
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.js +8 -8
- package/dist/speech-language-detection/SileroLanguageDetection.js.map +1 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts +2 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts.map +1 -1
- package/dist/speech-search/DTWSpeechSearch.js +4 -4
- package/dist/speech-search/DTWSpeechSearch.js.map +1 -1
- package/dist/subtitles/Subtitles.d.ts +13 -1
- package/dist/subtitles/Subtitles.d.ts.map +1 -1
- package/dist/subtitles/Subtitles.js +22 -22
- package/dist/subtitles/Subtitles.js.map +1 -1
- package/dist/synthesis/AwsPollyTTS.d.ts +3 -2
- package/dist/synthesis/AwsPollyTTS.d.ts.map +1 -1
- package/dist/synthesis/AwsPollyTTS.js +5 -5
- package/dist/synthesis/AwsPollyTTS.js.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts +2 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.js +3 -3
- package/dist/synthesis/AzureCognitiveServicesTTS.js.map +1 -1
- package/dist/synthesis/CoquiServerTTS.d.ts +2 -1
- package/dist/synthesis/CoquiServerTTS.d.ts.map +1 -1
- package/dist/synthesis/CoquiServerTTS.js +7 -8
- package/dist/synthesis/CoquiServerTTS.js.map +1 -1
- package/dist/synthesis/DeepgramTTS.d.ts +2 -2
- package/dist/synthesis/DeepgramTTS.d.ts.map +1 -1
- package/dist/synthesis/DeepgramTTS.js +13 -13
- package/dist/synthesis/DeepgramTTS.js.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.d.ts +3 -3
- package/dist/synthesis/ElevenLabsTTS.d.ts.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.js +22 -21
- package/dist/synthesis/ElevenLabsTTS.js.map +1 -1
- package/dist/synthesis/EspeakTTS.d.ts +11 -9
- package/dist/synthesis/EspeakTTS.d.ts.map +1 -1
- package/dist/synthesis/EspeakTTS.js +118 -68
- package/dist/synthesis/EspeakTTS.js.map +1 -1
- package/dist/synthesis/FliteTTS.d.ts +2 -2
- package/dist/synthesis/FliteTTS.d.ts.map +1 -1
- package/dist/synthesis/FliteTTS.js +2 -2
- package/dist/synthesis/FliteTTS.js.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.d.ts +2 -2
- package/dist/synthesis/GnuSpeechTTS.d.ts.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.js +1 -1
- package/dist/synthesis/GnuSpeechTTS.js.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.d.ts +3 -2
- package/dist/synthesis/GoogleCloudTTS.d.ts.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.js +15 -14
- package/dist/synthesis/GoogleCloudTTS.js.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.d.ts +3 -2
- package/dist/synthesis/GoogleTranslateTTS.d.ts.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.js +11 -11
- package/dist/synthesis/GoogleTranslateTTS.js.map +1 -1
- package/dist/synthesis/KokoroTTS.d.ts +4 -4
- package/dist/synthesis/KokoroTTS.d.ts.map +1 -1
- package/dist/synthesis/KokoroTTS.js +11 -10
- package/dist/synthesis/KokoroTTS.js.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts +4 -3
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.js +41 -20
- package/dist/synthesis/MicrosoftEdgeTTS.js.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.d.ts +2 -2
- package/dist/synthesis/OpenAICloudTTS.d.ts.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.js +6 -5
- package/dist/synthesis/OpenAICloudTTS.js.map +1 -1
- package/dist/synthesis/SamTTS.d.ts +2 -1
- package/dist/synthesis/SamTTS.d.ts.map +1 -1
- package/dist/synthesis/SamTTS.js +2 -2
- package/dist/synthesis/SamTTS.js.map +1 -1
- package/dist/synthesis/SapiTTS.d.ts +2 -2
- package/dist/synthesis/SapiTTS.d.ts.map +1 -1
- package/dist/synthesis/SapiTTS.js +2 -2
- package/dist/synthesis/SapiTTS.js.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.d.ts +2 -2
- package/dist/synthesis/SvoxPicoTTS.d.ts.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.js +3 -3
- package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
- package/dist/synthesis/VitsTTS.d.ts +3 -3
- package/dist/synthesis/VitsTTS.d.ts.map +1 -1
- package/dist/synthesis/VitsTTS.js +14 -11
- package/dist/synthesis/VitsTTS.js.map +1 -1
- package/dist/text-translation/DeepLTextTranslation.d.ts +2 -2
- package/dist/text-translation/DeepLTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/DeepLTextTranslation.js +10 -9
- package/dist/text-translation/DeepLTextTranslation.js.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts +4 -4
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.js +20 -18
- package/dist/text-translation/GoogleTranslateTextTranslation.js.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.d.ts +2 -2
- package/dist/text-translation/NLLBTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.js +4 -6
- package/dist/text-translation/NLLBTextTranslation.js.map +1 -1
- package/dist/typings/TypedArray.d.ts.map +1 -1
- package/dist/utilities/Compression.d.ts +4 -3
- package/dist/utilities/Compression.d.ts.map +1 -1
- package/dist/utilities/Compression.js +9 -9
- package/dist/utilities/Compression.js.map +1 -1
- package/dist/utilities/FileDownloader.d.ts +6 -3
- package/dist/utilities/FileDownloader.d.ts.map +1 -1
- package/dist/utilities/FileDownloader.js +25 -21
- package/dist/utilities/FileDownloader.js.map +1 -1
- package/dist/utilities/FileReader.d.ts.map +1 -1
- package/dist/utilities/FileReader.js.map +1 -1
- package/dist/utilities/FileSystem.js +1 -1
- package/dist/utilities/FileSystem.js.map +1 -1
- package/dist/utilities/FileWriter.d.ts.map +1 -1
- package/dist/utilities/FileWriter.js.map +1 -1
- package/dist/utilities/Hashing.d.ts.map +1 -1
- package/dist/utilities/Hashing.js.map +1 -1
- package/dist/utilities/Locale.js.map +1 -1
- package/dist/utilities/Logger.d.ts +17 -9
- package/dist/utilities/Logger.d.ts.map +1 -1
- package/dist/utilities/Logger.js +50 -35
- package/dist/utilities/Logger.js.map +1 -1
- package/dist/utilities/NpmUtilities.d.ts.map +1 -1
- package/dist/utilities/NpmUtilities.js +4 -5
- package/dist/utilities/NpmUtilities.js.map +1 -1
- package/dist/utilities/ObjectUtilities.js.map +1 -1
- package/dist/utilities/OpenPromise.d.ts.map +1 -1
- package/dist/utilities/OpenPromise.js.map +1 -1
- package/dist/utilities/PackageManager.d.ts +4 -1
- package/dist/utilities/PackageManager.d.ts.map +1 -1
- package/dist/utilities/PackageManager.js +37 -22
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/PathUtilities.d.ts +2 -0
- package/dist/utilities/PathUtilities.d.ts.map +1 -1
- package/dist/utilities/PathUtilities.js +5 -2
- package/dist/utilities/PathUtilities.js.map +1 -1
- package/dist/utilities/RandomGenerator.d.ts.map +1 -1
- package/dist/utilities/SignalChannel.d.ts.map +1 -1
- package/dist/utilities/SmoothEstimator.d.ts.map +1 -1
- package/dist/utilities/SmoothEstimator.js.map +1 -1
- package/dist/utilities/StringBuilder.d.ts.map +1 -1
- package/dist/utilities/TarballMaker.d.ts +4 -3
- package/dist/utilities/TarballMaker.d.ts.map +1 -1
- package/dist/utilities/TarballMaker.js +6 -6
- package/dist/utilities/TarballMaker.js.map +1 -1
- package/dist/utilities/Timeline.js.map +1 -1
- package/dist/utilities/Timer.d.ts.map +1 -1
- package/dist/utilities/Utilities.d.ts +9 -7
- package/dist/utilities/Utilities.d.ts.map +1 -1
- package/dist/utilities/Utilities.js +49 -33
- package/dist/utilities/Utilities.js.map +1 -1
- package/dist/utilities/VirtualFileReadStream.d.ts.map +1 -1
- package/dist/utilities/WebReader.d.ts +2 -1
- package/dist/utilities/WebReader.d.ts.map +1 -1
- package/dist/utilities/WebReader.js +7 -6
- package/dist/utilities/WebReader.js.map +1 -1
- package/dist/utilities/WikipediaReader.d.ts +2 -1
- package/dist/utilities/WikipediaReader.d.ts.map +1 -1
- package/dist/utilities/WikipediaReader.js +1 -5
- package/dist/utilities/WikipediaReader.js.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts +2 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.js +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.js.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js.map +1 -1
- package/docs/API.md +62 -17
- package/docs/CUDA.md +4 -3
- package/docs/Engines.md +8 -7
- package/docs/Licenses.md +0 -3
- package/docs/Options.md +27 -31
- package/docs/Server.md +1 -0
- package/docs/Tasklist.md +2 -1
- package/docs/Technical.md +2 -2
- package/package.json +45 -35
- package/src/alignment/SemanticTextAlignment.ts +14 -7
- package/src/alignment/SpeechAlignment.ts +47 -150
- package/src/api/APIOptions.ts +1 -1
- package/src/api/Alignment.ts +95 -61
- package/src/api/Common.ts +11 -0
- package/src/api/Denoising.ts +22 -17
- package/src/api/GlobalOptions.ts +4 -20
- package/src/api/Recognition.ts +106 -123
- package/src/api/SourceSeparation.ts +39 -21
- package/src/api/SpeechLanguageDetection.ts +77 -37
- package/src/api/SpeechSearch.ts +6 -1
- package/src/api/SpeechTranslation.ts +75 -38
- package/src/api/Synthesis.ts +220 -116
- package/src/api/TextLanguageDetection.ts +10 -12
- package/src/api/TextTranslation.ts +43 -26
- package/src/api/TimelineTranslationAlignment.ts +41 -13
- package/src/api/TranscriptAndTranslationAlignment.ts +28 -15
- package/src/api/TranslationAlignment.ts +53 -24
- package/src/api/VoiceActivityDetection.ts +33 -68
- package/src/audio/AudioPlayer.ts +4 -232
- package/src/audio/AudioUtilities.ts +9 -2
- package/src/build-tools/MakeTarballsForInstalledPackages.ts +4 -3
- package/src/cli/CLI.ts +209 -101
- package/src/codecs/FFMpegTranscoder.ts +18 -16
- package/src/denoising/NSNet2.ts +5 -4
- package/src/denoising/RNNoise.ts +14 -6
- package/src/dsp/FFT.ts +2 -1
- package/src/dsp/MFCC.ts +7 -5
- package/src/dsp/MelSpectrogram.ts +56 -36
- package/src/dsp/Rubberband.ts +10 -3
- package/src/dsp/Sonic.ts +2 -1
- package/src/dsp/SpeexResampler.ts +2 -1
- package/src/encodings/Ascii.ts +1 -1
- package/src/encodings/Base64.ts +1 -1
- package/src/math/VectorMath.ts +10 -6
- package/src/nlp/EspeakPhonemizer.ts +2 -2
- package/src/nlp/Segmentation.ts +9 -4
- package/src/recognition/AmazonTranscribeSTT.ts +4 -3
- package/src/recognition/AzureCognitiveServicesSTT.ts +5 -4
- package/src/recognition/DeepgramSTT.ts +16 -16
- package/src/recognition/GoogleCloudSTT.ts +14 -12
- package/src/recognition/OpenAICloudSTT.ts +12 -6
- package/src/recognition/WhisperCommon.ts +130 -0
- package/src/recognition/{WhisperCppSTT.ts → WhisperCppCliSTT.ts} +73 -133
- package/src/recognition/WhisperSTT.ts +569 -718
- package/src/server/Client.ts +4 -4
- package/src/server/Worker.ts +59 -59
- package/src/source-separation/MDXNetSourceSeparation.ts +15 -10
- package/src/speech-embeddings/WavToVec2BertFeatureEmbeddings.ts +7 -5
- package/src/speech-language-detection/SileroLanguageDetection.ts +18 -9
- package/src/speech-search/DTWSpeechSearch.ts +6 -5
- package/src/subtitles/Subtitles.ts +22 -22
- package/src/synthesis/AwsPollyTTS.ts +12 -5
- package/src/synthesis/AzureCognitiveServicesTTS.ts +11 -3
- package/src/synthesis/CoquiServerTTS.ts +8 -7
- package/src/synthesis/DeepgramTTS.ts +21 -15
- package/src/synthesis/ElevenLabsTTS.ts +33 -23
- package/src/synthesis/EspeakTTS.ts +145 -69
- package/src/synthesis/FliteTTS.ts +3 -3
- package/src/synthesis/GnuSpeechTTS.ts +2 -2
- package/src/synthesis/GoogleCloudTTS.ts +23 -14
- package/src/synthesis/GoogleTranslateTTS.ts +19 -11
- package/src/synthesis/KokoroTTS.ts +37 -14
- package/src/synthesis/MicrosoftEdgeTTS.ts +71 -23
- package/src/synthesis/OpenAICloudTTS.ts +7 -6
- package/src/synthesis/SamTTS.ts +3 -2
- package/src/synthesis/SapiTTS.ts +3 -3
- package/src/synthesis/SvoxPicoTTS.ts +4 -5
- package/src/synthesis/VitsTTS.ts +43 -15
- package/src/text-translation/DeepLTextTranslation.ts +12 -10
- package/src/text-translation/GoogleTranslateTextTranslation.ts +35 -21
- package/src/text-translation/NLLBTextTranslation.ts +5 -9
- package/src/typings/Fillers.d.ts +0 -60
- package/src/typings/TypedArray.ts +12 -1
- package/src/utilities/Compression.ts +10 -9
- package/src/utilities/FileDownloader.ts +38 -23
- package/src/utilities/FileSystem.ts +1 -1
- package/src/utilities/Logger.ts +59 -42
- package/src/utilities/NpmUtilities.ts +4 -6
- package/src/utilities/OpenPromise.ts +1 -2
- package/src/utilities/PackageManager.ts +53 -26
- package/src/utilities/PathUtilities.ts +6 -2
- package/src/utilities/TarballMaker.ts +7 -7
- package/src/utilities/Utilities.ts +58 -41
- package/src/utilities/WebReader.ts +11 -6
- package/src/utilities/WikipediaReader.ts +2 -8
- package/src/voice-activity-detection/AdaptiveGateVAD.ts +13 -8
- package/src/voice-activity-detection/WebRtcVAD.ts +1 -2
- package/tsconfig.json +53 -54
- package/dist/audio/AudioRecorder.d.ts +0 -4
- package/dist/audio/AudioRecorder.d.ts.map +0 -1
- package/dist/audio/AudioRecorder.js +0 -68
- package/dist/audio/AudioRecorder.js.map +0 -1
- package/dist/audio/SoxPath.d.ts +0 -2
- package/dist/audio/SoxPath.d.ts.map +0 -1
- package/dist/audio/SoxPath.js +0 -24
- package/dist/audio/SoxPath.js.map +0 -1
- package/dist/recognition/SileroSTT.d.ts +0 -30
- package/dist/recognition/SileroSTT.d.ts.map +0 -1
- package/dist/recognition/SileroSTT.js +0 -152
- package/dist/recognition/SileroSTT.js.map +0 -1
- package/dist/recognition/VoskSTT.d.ts +0 -11
- package/dist/recognition/VoskSTT.d.ts.map +0 -1
- package/dist/recognition/VoskSTT.js +0 -72
- package/dist/recognition/VoskSTT.js.map +0 -1
- package/dist/recognition/WhisperCppSTT.d.ts.map +0 -1
- package/dist/recognition/WhisperCppSTT.js.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.d.ts +0 -12
- package/dist/synthesis/StreamlabsPollyTTS.d.ts.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.js +0 -88
- package/dist/synthesis/StreamlabsPollyTTS.js.map +0 -1
- package/dist/utilities/BinaryUtilities.d.ts +0 -14
- package/dist/utilities/BinaryUtilities.d.ts.map +0 -1
- package/dist/utilities/BinaryUtilities.js +0 -113
- package/dist/utilities/BinaryUtilities.js.map +0 -1
- package/src/audio/AudioRecorder.ts +0 -91
- package/src/audio/SoxPath.ts +0 -31
- package/src/recognition/SileroSTT.ts +0 -222
- package/src/recognition/VoskSTT.ts +0 -112
- package/src/synthesis/StreamlabsPollyTTS.ts +0 -114
- package/src/utilities/BinaryUtilities.ts +0 -138
- /package/{LICENSE.md → LICENSE.GPLv3.md} +0 -0
|
@@ -4,10 +4,11 @@ import { encodeRawAudioToWave, decodeWaveToRawAudio, RawAudio } from '../audio/A
|
|
|
4
4
|
|
|
5
5
|
import { Logger } from '../utilities/Logger.js'
|
|
6
6
|
import { commandExists, concatUint8Arrays, isUint8Array, logToStderr } from '../utilities/Utilities.js'
|
|
7
|
-
import { loadPackage } from '../utilities/PackageManager.js'
|
|
7
|
+
import { loadPackage, LoadPackageCallbacks } from '../utilities/PackageManager.js'
|
|
8
8
|
import { getGlobalOption } from '../api/GlobalOptions.js'
|
|
9
9
|
import { existsSync } from '../utilities/FileSystem.js'
|
|
10
10
|
import { joinPath } from '../utilities/PathUtilities.js'
|
|
11
|
+
import { OperationCallbacks } from '../api/Common.js'
|
|
11
12
|
|
|
12
13
|
const log = logToStderr
|
|
13
14
|
|
|
@@ -23,11 +24,11 @@ export type FFMpegOutputOptions = {
|
|
|
23
24
|
customOptions?: string[]
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
export async function encodeFromChannels(rawAudio: RawAudio, outputOptions: FFMpegOutputOptions) {
|
|
27
|
-
return transcode(encodeRawAudioToWave(rawAudio), outputOptions)
|
|
27
|
+
export async function encodeFromChannels(rawAudio: RawAudio, outputOptions: FFMpegOutputOptions, callbacks: OperationCallbacks) {
|
|
28
|
+
return transcode(encodeRawAudioToWave(rawAudio), outputOptions, callbacks)
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
export async function decodeToChannels(input: string | Uint8Array, outSampleRate
|
|
31
|
+
export async function decodeToChannels(input: string | Uint8Array, outSampleRate: number | undefined, outChannelCount: number | undefined, callbacks: OperationCallbacks) {
|
|
31
32
|
const outputOptions: FFMpegOutputOptions = {
|
|
32
33
|
codec: 'pcm_f32le',
|
|
33
34
|
format: 'wav',
|
|
@@ -36,9 +37,10 @@ export async function decodeToChannels(input: string | Uint8Array, outSampleRate
|
|
|
36
37
|
audioOnly: true
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
const
|
|
40
|
+
const logger = new Logger(callbacks.logLevel)
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
logger.start('Transcode with command-line ffmpeg')
|
|
43
|
+
const waveAudio = await transcode(input, outputOptions, callbacks)
|
|
42
44
|
|
|
43
45
|
logger.start(`Convert wave buffer to raw audio`)
|
|
44
46
|
const { rawAudio } = decodeWaveToRawAudio(waveAudio)
|
|
@@ -47,21 +49,18 @@ export async function decodeToChannels(input: string | Uint8Array, outSampleRate
|
|
|
47
49
|
return rawAudio
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
export async function transcode(input: string | Uint8Array, outputOptions: FFMpegOutputOptions) {
|
|
51
|
-
const executablePath = await
|
|
52
|
+
export async function transcode(input: string | Uint8Array, outputOptions: FFMpegOutputOptions, callbacks: OperationCallbacks) {
|
|
53
|
+
const executablePath = await resolveFFMpegExecutable(callbacks)
|
|
52
54
|
|
|
53
55
|
if (!executablePath) {
|
|
54
56
|
throw new Error(`The ffmpeg utility wasn't found. Please ensure it is available on the system path.`)
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
return transcode_CLI(executablePath, input, outputOptions)
|
|
59
|
+
return transcode_CLI(executablePath, input, outputOptions, callbacks)
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
async function transcode_CLI(ffmpegCommand: string, input: string | Uint8Array, outputOptions: FFMpegOutputOptions) {
|
|
62
|
+
async function transcode_CLI(ffmpegCommand: string, input: string | Uint8Array, outputOptions: FFMpegOutputOptions, callbacks: OperationCallbacks) {
|
|
61
63
|
return new Promise<Uint8Array>((resolve, reject) => {
|
|
62
|
-
const logger = new Logger()
|
|
63
|
-
logger.start('Transcode with command-line ffmpeg')
|
|
64
|
-
|
|
65
64
|
const args = buildCommandLineArguments(isUint8Array(input) ? '-' : input, outputOptions)
|
|
66
65
|
|
|
67
66
|
const process = spawn(ffmpegCommand, args)
|
|
@@ -101,8 +100,11 @@ async function transcode_CLI(ffmpegCommand: string, input: string | Uint8Array,
|
|
|
101
100
|
reject(`ffmpeg exited with code ${exitCode}`)
|
|
102
101
|
log(stderrOutput)
|
|
103
102
|
}
|
|
103
|
+
})
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
callbacks?.abortSignal?.addEventListener('abort', () => {
|
|
106
|
+
reject(new DOMException('FFMpeg CLI was aborted.', 'AbortError'))
|
|
107
|
+
process.kill()
|
|
106
108
|
})
|
|
107
109
|
})
|
|
108
110
|
}
|
|
@@ -159,7 +161,7 @@ function buildCommandLineArguments(inputFilename: string, outputOptions: FFMpegO
|
|
|
159
161
|
return args
|
|
160
162
|
}
|
|
161
163
|
|
|
162
|
-
async function
|
|
164
|
+
async function resolveFFMpegExecutable(callbacks: LoadPackageCallbacks) {
|
|
163
165
|
// If a global option set for the path, use it
|
|
164
166
|
if (getGlobalOption('ffmpegPath')) {
|
|
165
167
|
return getGlobalOption('ffmpegPath')
|
|
@@ -200,7 +202,7 @@ async function getFFMpegExecutablePath() {
|
|
|
200
202
|
return undefined
|
|
201
203
|
}
|
|
202
204
|
|
|
203
|
-
const ffmpegPackagePath = await loadPackage(packageName)
|
|
205
|
+
const ffmpegPackagePath = await loadPackage(packageName, callbacks)
|
|
204
206
|
|
|
205
207
|
let filename = packageName
|
|
206
208
|
|
package/src/denoising/NSNet2.ts
CHANGED
|
@@ -7,13 +7,14 @@ import { joinPath } from '../utilities/PathUtilities.js'
|
|
|
7
7
|
import { stftr, stiftr } from '../dsp/FFT.js'
|
|
8
8
|
import { clip, concatFloat32Arrays } from '../utilities/Utilities.js'
|
|
9
9
|
import { Logger } from '../utilities/Logger.js'
|
|
10
|
+
import { DenoisingCallbacks } from '../api/Denoising.js'
|
|
10
11
|
|
|
11
|
-
export async function denoiseAudio(rawAudio: RawAudio, options: NSNet2Options) {
|
|
12
|
+
export async function denoiseAudio(rawAudio: RawAudio, options: NSNet2Options, callbacks: DenoisingCallbacks) {
|
|
12
13
|
const onnxExecutionProviders: OnnxExecutionProvider[] = options.provider ? [options.provider] : []//['dml', 'cpu']
|
|
13
14
|
|
|
14
15
|
const denoiser = new NSNet2(options.model!, options.modelDirectoryPath!, onnxExecutionProviders, options.maxAttenuation!)
|
|
15
16
|
|
|
16
|
-
const result = await denoiser.denoiseAudio(rawAudio)
|
|
17
|
+
const result = await denoiser.denoiseAudio(rawAudio, callbacks)
|
|
17
18
|
|
|
18
19
|
return result
|
|
19
20
|
}
|
|
@@ -28,8 +29,8 @@ export class NSNet2 {
|
|
|
28
29
|
public readonly maxAttenuation: number) {
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
async denoiseAudio(rawAudio: RawAudio) {
|
|
32
|
-
const logger = new Logger()
|
|
32
|
+
async denoiseAudio(rawAudio: RawAudio, callbacks: DenoisingCallbacks) {
|
|
33
|
+
const logger = new Logger(callbacks.logLevel)
|
|
33
34
|
|
|
34
35
|
logger.start(`Initialize ONNX model ${this.modelName}`)
|
|
35
36
|
await this.initializeIfNeeded()
|
package/src/denoising/RNNoise.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { float32ToInt16Pcm } from '../audio/AudioBufferConversion.js'
|
|
2
|
-
import { concatFloat32Arrays } from '../utilities/Utilities.js'
|
|
3
|
-
import { wrapEmscriptenModuleHeap } from 'wasm-heap-manager'
|
|
2
|
+
import { concatFloat32Arrays, throwIfAborted } from '../utilities/Utilities.js'
|
|
4
3
|
import { Logger } from '../utilities/Logger.js'
|
|
5
4
|
import { RawAudio, cloneRawAudio } from '../audio/AudioUtilities.js'
|
|
5
|
+
import { DenoisingCallbacks } from '../api/Denoising.js'
|
|
6
6
|
|
|
7
7
|
let rnnoiseInstance: any
|
|
8
8
|
|
|
9
|
-
export async function denoiseAudio(rawAudio: RawAudio) {
|
|
10
|
-
const logger = new Logger()
|
|
9
|
+
export async function denoiseAudio(rawAudio: RawAudio, callbacks: DenoisingCallbacks) {
|
|
10
|
+
const logger = new Logger(callbacks.logLevel)
|
|
11
|
+
|
|
11
12
|
if (rawAudio.sampleRate != 48000) {
|
|
12
13
|
throw new Error(`RNNoise requires a 48000 Hz sample rate (${rawAudio.sampleRate} Hz given)`)
|
|
13
14
|
}
|
|
@@ -24,6 +25,7 @@ export async function denoiseAudio(rawAudio: RawAudio) {
|
|
|
24
25
|
const m = await getRnnoiseInstance()
|
|
25
26
|
|
|
26
27
|
logger.start('Process with RNNoise')
|
|
28
|
+
const { wrapEmscriptenModuleHeap } = await import('wasm-heap-manager')
|
|
27
29
|
const wasmHeap = wrapEmscriptenModuleHeap(m)
|
|
28
30
|
|
|
29
31
|
const stateSize = m._rnnoise_get_size()
|
|
@@ -46,7 +48,14 @@ export async function denoiseAudio(rawAudio: RawAudio) {
|
|
|
46
48
|
frameVadProbabilities.push(vadProbability)
|
|
47
49
|
}
|
|
48
50
|
|
|
51
|
+
function destroyState() {
|
|
52
|
+
m._rnnoise_destroy(denoiseState)
|
|
53
|
+
wasmHeap.freeAll()
|
|
54
|
+
}
|
|
55
|
+
|
|
49
56
|
for (let readOffset = 0; readOffset < int16Samples.length; readOffset += frameSize) {
|
|
57
|
+
throwIfAborted(callbacks.abortSignal, destroyState)
|
|
58
|
+
|
|
50
59
|
let frame: Float32Array<ArrayBufferLike> = int16SamplesAsFloats.subarray(readOffset, readOffset + frameSize)
|
|
51
60
|
|
|
52
61
|
if (frame.length < frameSize) {
|
|
@@ -69,8 +78,7 @@ export async function denoiseAudio(rawAudio: RawAudio) {
|
|
|
69
78
|
const lastFrameVadProbability = m._rnnoise_process_frame(denoiseState, outputRef.address, inputRef.address)
|
|
70
79
|
outputNewFrame(outputRef.view.slice(), lastFrameVadProbability)
|
|
71
80
|
|
|
72
|
-
|
|
73
|
-
wasmHeap.freeAll()
|
|
81
|
+
destroyState()
|
|
74
82
|
|
|
75
83
|
const int16DenoisedSamplesAsFloats = concatFloat32Arrays(processedFrames)
|
|
76
84
|
|
package/src/dsp/FFT.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ComplexNumber } from '../math/VectorMath.js'
|
|
2
2
|
import { concatFloat32Arrays, isWasmSimdSupported } from '../utilities/Utilities.js'
|
|
3
|
-
import { createWasmHeapManager } from 'wasm-heap-manager'
|
|
4
3
|
|
|
5
4
|
// Compute short-term Fourier transform (real-valued)
|
|
6
5
|
export async function stftr(samples: Float32Array, fftOrder: number, windowSize: number, hopSize: number, windowType: WindowType) {
|
|
@@ -38,6 +37,7 @@ export async function createStftrGenerator(samples: Float32Array, fftOrder: numb
|
|
|
38
37
|
|
|
39
38
|
const m = await getPFFFTInstance(await isPffftSimdSupportedForFFTOrder(fftOrder))
|
|
40
39
|
|
|
40
|
+
const { createWasmHeapManager } = await import('wasm-heap-manager')
|
|
41
41
|
const wasmHeap = createWasmHeapManager(
|
|
42
42
|
() => m.HEAPU8.buffer,
|
|
43
43
|
m._pffft_aligned_malloc,
|
|
@@ -109,6 +109,7 @@ export async function stiftr(binsForFrames: Float32Array[], fftOrder: number, wi
|
|
|
109
109
|
|
|
110
110
|
const m = await getPFFFTInstance(await isPffftSimdSupportedForFFTOrder(fftOrder))
|
|
111
111
|
|
|
112
|
+
const { createWasmHeapManager } = await import('wasm-heap-manager')
|
|
112
113
|
const wasmHeap = createWasmHeapManager(
|
|
113
114
|
() => m.HEAPU8.buffer,
|
|
114
115
|
m._pffft_aligned_malloc,
|
package/src/dsp/MFCC.ts
CHANGED
|
@@ -4,16 +4,18 @@ import { resampleAudioSpeex } from './SpeexResampler.js'
|
|
|
4
4
|
import { computeMelSpectrogram } from './MelSpectrogram.js'
|
|
5
5
|
import { RawAudio, powerToDecibels } from '../audio/AudioUtilities.js'
|
|
6
6
|
import { normalizeVectors } from '../math/VectorMath.js'
|
|
7
|
+
import { OperationCallbacks } from '../api/Common.js'
|
|
8
|
+
|
|
9
|
+
export async function computeMFCCs(monoAudio: RawAudio, options: MfccOptions, callbacks: OperationCallbacks) {
|
|
10
|
+
const logger = new Logger(callbacks.logLevel)
|
|
7
11
|
|
|
8
|
-
export async function computeMFCCs(monoAudio: RawAudio, options: MfccOptions = {}) {
|
|
9
|
-
const logger = new Logger()
|
|
10
12
|
logger.start('Initialize options')
|
|
11
13
|
|
|
12
14
|
if (monoAudio.audioChannels.length != 1) {
|
|
13
15
|
throw new Error('Audio must be mono')
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
options = extendDefaultMfccOptions(options)
|
|
18
|
+
options = extendDefaultMfccOptions(options ?? {})
|
|
17
19
|
|
|
18
20
|
const analysisSampleRate = options.analysisSampleRate!
|
|
19
21
|
const featureCount = options.featureCount!
|
|
@@ -42,7 +44,7 @@ export async function computeMFCCs(monoAudio: RawAudio, options: MfccOptions = {
|
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
logger.start('Compute Mel spectrogram')
|
|
45
|
-
const { melSpectrogram } = await computeMelSpectrogram(resampledAudio, fftOrder, windowSize, hopLength, filterbankCount, lowerFrequencyHz, upperFrequencyHz)
|
|
47
|
+
const { melSpectrogram } = await computeMelSpectrogram(resampledAudio, fftOrder, windowSize, hopLength, filterbankCount, lowerFrequencyHz, upperFrequencyHz, undefined, callbacks)
|
|
46
48
|
|
|
47
49
|
logger.start('Extract MFCCs from Mel spectrogram')
|
|
48
50
|
let mfccs: Float32Array<ArrayBufferLike>[] = melSpectrogramToMFCCs(melSpectrogram, featureCount)
|
|
@@ -202,6 +204,6 @@ export const defaultMfccOptions: MfccOptions = {
|
|
|
202
204
|
zeroFirstCoefficient: false,
|
|
203
205
|
}
|
|
204
206
|
|
|
205
|
-
export function extendDefaultMfccOptions(options: MfccOptions) {
|
|
207
|
+
export function extendDefaultMfccOptions(options: MfccOptions): MfccOptions {
|
|
206
208
|
return extendDeep(defaultMfccOptions, options)
|
|
207
209
|
}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import { OperationCallbacks } from '../api/Common.js'
|
|
1
2
|
import { RawAudio } from '../audio/AudioUtilities.js'
|
|
2
3
|
import { Logger } from '../utilities/Logger.js'
|
|
3
4
|
import * as FFT from './FFT.js'
|
|
4
5
|
|
|
5
|
-
export async function computeMelSpectrogram(
|
|
6
|
-
|
|
6
|
+
export async function computeMelSpectrogram(
|
|
7
|
+
rawAudio: RawAudio,
|
|
8
|
+
fftOrder: number,
|
|
9
|
+
windowSize: number,
|
|
10
|
+
hopLength: number,
|
|
11
|
+
melBandCount: number,
|
|
12
|
+
lowerFrequencyHz: number,
|
|
13
|
+
upperFrequencyHz: number,
|
|
14
|
+
windowType: FFT.WindowType = 'hann',
|
|
15
|
+
callbacks: OperationCallbacks) {
|
|
7
16
|
|
|
8
|
-
logger.start('Compute Mel filterbank')
|
|
9
17
|
const binCount = (fftOrder / 2) + 2
|
|
10
18
|
const nyquistFrequency = rawAudio.sampleRate / 2
|
|
11
19
|
const binFrequencies = FFT.getBinFrequencies(binCount, nyquistFrequency)
|
|
@@ -13,60 +21,66 @@ export async function computeMelSpectrogram(rawAudio: RawAudio, fftOrder: number
|
|
|
13
21
|
const lowerFrequencyMel = hertzToMel(lowerFrequencyHz)
|
|
14
22
|
const upperFrequencyMel = hertzToMel(upperFrequencyHz)
|
|
15
23
|
|
|
16
|
-
const
|
|
17
|
-
const
|
|
24
|
+
const filterbankCenterFrequencies = getMelFilterbankCenterFrequencies(melBandCount, lowerFrequencyMel, upperFrequencyMel)
|
|
25
|
+
const melFilterbank = getMelFilterbank(binFrequencies, filterbankCenterFrequencies, lowerFrequencyMel, upperFrequencyMel)
|
|
18
26
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return computeMelSpectrogramUsingFilterbanks(rawAudio, fftOrder, windowSize, hopLength, melFilterbanks, windowType)
|
|
27
|
+
return computeMelSpectrogramUsingFilterbank(rawAudio, fftOrder, windowSize, hopLength, melFilterbank, windowType, callbacks)
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
export async function
|
|
25
|
-
|
|
30
|
+
export async function computeMelSpectrogramUsingFilterbank(
|
|
31
|
+
rawAudio: RawAudio,
|
|
32
|
+
fftOrder: number,
|
|
33
|
+
windowSize: number,
|
|
34
|
+
hopLength: number,
|
|
35
|
+
filterbank: Filterbank,
|
|
36
|
+
windowType: FFT.WindowType = 'hann',
|
|
37
|
+
callbacks: OperationCallbacks) {
|
|
38
|
+
|
|
39
|
+
const logger = new Logger(callbacks.logLevel)
|
|
26
40
|
|
|
27
41
|
logger.start('Compute short-time FFTs')
|
|
28
42
|
const audioSamples = rawAudio.audioChannels[0]
|
|
29
43
|
const fftFrames = await FFT.stftr(audioSamples, fftOrder, windowSize, hopLength, windowType)
|
|
30
44
|
|
|
31
45
|
logger.start('Convert FFT frames to Mel spectrogram')
|
|
32
|
-
const melSpectrogram = fftFramesToMelSpectrogram(fftFrames,
|
|
46
|
+
const melSpectrogram = fftFramesToMelSpectrogram(fftFrames, filterbank)
|
|
33
47
|
|
|
34
48
|
logger.end()
|
|
35
49
|
|
|
36
50
|
return { melSpectrogram, fftFrames }
|
|
37
51
|
}
|
|
38
52
|
|
|
39
|
-
export function fftFramesToMelSpectrogram(fftFrames: Float32Array[],
|
|
53
|
+
export function fftFramesToMelSpectrogram(fftFrames: Float32Array[], melFilterbank: Filterbank) {
|
|
40
54
|
return fftFrames.map(fftFrame => {
|
|
41
55
|
const powerSpectrum = FFT.fftFrameToPowerSpectrum(fftFrame)
|
|
42
56
|
|
|
43
|
-
return powerSpectrumToMelSpectrum(powerSpectrum,
|
|
57
|
+
return powerSpectrumToMelSpectrum(powerSpectrum, melFilterbank)
|
|
44
58
|
})
|
|
45
59
|
}
|
|
46
60
|
|
|
47
|
-
export function powerSpectrumToMelSpectrum(powerSpectrum: Float32Array,
|
|
48
|
-
const
|
|
49
|
-
const melSpectrum = new Float32Array(
|
|
61
|
+
export function powerSpectrumToMelSpectrum(powerSpectrum: Float32Array, filterbank: Filterbank) {
|
|
62
|
+
const melBandCount = filterbank.length
|
|
63
|
+
const melSpectrum = new Float32Array(melBandCount)
|
|
50
64
|
|
|
51
|
-
for (let melBandIndex = 0; melBandIndex <
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
65
|
+
for (let melBandIndex = 0; melBandIndex < melBandCount; melBandIndex++) {
|
|
66
|
+
const melFilter = filterbank[melBandIndex]
|
|
67
|
+
const melFilterStartIndex = melFilter.startIndex
|
|
68
|
+
const melFilterWeights = melFilter.weights
|
|
55
69
|
|
|
56
|
-
if (
|
|
70
|
+
if (melFilterStartIndex === -1) {
|
|
57
71
|
continue
|
|
58
72
|
}
|
|
59
73
|
|
|
60
74
|
let melBandValue = 0
|
|
61
75
|
|
|
62
|
-
for (let i = 0; i <
|
|
63
|
-
const powerSpectrumIndex =
|
|
76
|
+
for (let i = 0; i < melFilterWeights.length; i++) {
|
|
77
|
+
const powerSpectrumIndex = melFilterStartIndex + i
|
|
64
78
|
|
|
65
79
|
if (powerSpectrumIndex >= powerSpectrum.length) {
|
|
66
80
|
break
|
|
67
81
|
}
|
|
68
82
|
|
|
69
|
-
const weight =
|
|
83
|
+
const weight = melFilterWeights[i]
|
|
70
84
|
const powerSpectrumValue = powerSpectrum[powerSpectrumIndex]
|
|
71
85
|
|
|
72
86
|
melBandValue += weight * powerSpectrumValue
|
|
@@ -78,17 +92,20 @@ export function powerSpectrumToMelSpectrum(powerSpectrum: Float32Array, filterba
|
|
|
78
92
|
return melSpectrum
|
|
79
93
|
}
|
|
80
94
|
|
|
81
|
-
export function
|
|
82
|
-
|
|
83
|
-
|
|
95
|
+
export function getMelFilterbank(
|
|
96
|
+
powerSpectrumFrequenciesHz: Float32Array,
|
|
97
|
+
centerFrequenciesMel: Float32Array,
|
|
98
|
+
lowerFrequencyMel: number,
|
|
99
|
+
upperFrequencyMel: number) {
|
|
84
100
|
|
|
85
|
-
const
|
|
101
|
+
const melBandCount = centerFrequenciesMel.length
|
|
102
|
+
const filterbank: Filterbank = []
|
|
86
103
|
|
|
87
|
-
for (let filterbankIndex = 0; filterbankIndex <
|
|
104
|
+
for (let filterbankIndex = 0; filterbankIndex < melBandCount; filterbankIndex++) {
|
|
88
105
|
const centerFrequency = centerFrequenciesMel[filterbankIndex]
|
|
89
106
|
|
|
90
107
|
const leftFrequency = filterbankIndex > 0 ? centerFrequenciesMel[filterbankIndex - 1] : lowerFrequencyMel
|
|
91
|
-
const rightFrequency = filterbankIndex <
|
|
108
|
+
const rightFrequency = filterbankIndex < melBandCount - 1 ? centerFrequenciesMel[filterbankIndex + 1] : upperFrequencyMel
|
|
92
109
|
|
|
93
110
|
const width = rightFrequency - leftFrequency
|
|
94
111
|
const halfWidth = width / 2
|
|
@@ -98,8 +115,9 @@ export function getMelFilterbanks(powerSpectrumFrequenciesHz: Float32Array, cent
|
|
|
98
115
|
|
|
99
116
|
let weightSum = 0
|
|
100
117
|
|
|
101
|
-
for (let powerSpectrumBandIndex = 0; powerSpectrumBandIndex <
|
|
102
|
-
const
|
|
118
|
+
for (let powerSpectrumBandIndex = 0; powerSpectrumBandIndex < powerSpectrumFrequenciesHz.length; powerSpectrumBandIndex++) {
|
|
119
|
+
const powerSpectrumBandFrequencyHz = powerSpectrumFrequenciesHz[powerSpectrumBandIndex]
|
|
120
|
+
const powerSpectrumBandFrequencyMel = hertzToMel(powerSpectrumBandFrequencyHz)
|
|
103
121
|
|
|
104
122
|
let weight = 0
|
|
105
123
|
|
|
@@ -123,13 +141,13 @@ export function getMelFilterbanks(powerSpectrumFrequenciesHz: Float32Array, cent
|
|
|
123
141
|
|
|
124
142
|
weights = weights.map(weight => weight / weightSum)
|
|
125
143
|
|
|
126
|
-
|
|
144
|
+
filterbank.push({ startIndex, weights })
|
|
127
145
|
}
|
|
128
146
|
|
|
129
|
-
return
|
|
147
|
+
return filterbank
|
|
130
148
|
}
|
|
131
149
|
|
|
132
|
-
export function
|
|
150
|
+
export function getMelFilterbankCenterFrequencies(melBandCount: number, lowerFrequencyMel: number, upperFrequencyMel: number) {
|
|
133
151
|
const stepSizeMel = (upperFrequencyMel - lowerFrequencyMel) / (melBandCount + 1)
|
|
134
152
|
|
|
135
153
|
const centerFrequencies = new Float32Array(melBandCount)
|
|
@@ -149,7 +167,9 @@ export function melToHertz(mel: number) {
|
|
|
149
167
|
return 700.0 * (Math.pow(10.0, mel / 2595.0) - 1.0)
|
|
150
168
|
}
|
|
151
169
|
|
|
152
|
-
export type Filterbank =
|
|
170
|
+
export type Filterbank = FilterbankElement[]
|
|
171
|
+
|
|
172
|
+
export interface FilterbankElement {
|
|
153
173
|
startIndex: number
|
|
154
174
|
weights: number[]
|
|
155
175
|
}
|
package/src/dsp/Rubberband.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { getGlobalOption } from '../api/GlobalOptions.js'
|
|
1
2
|
import { RawAudio } from '../audio/AudioUtilities.js'
|
|
2
3
|
import { extendDeep } from '../utilities/ObjectUtilities.js'
|
|
3
4
|
import { concatFloat32Arrays } from '../utilities/Utilities.js'
|
|
4
|
-
import { Float32ArrayRef
|
|
5
|
+
import type { Float32ArrayRef } from 'wasm-heap-manager'
|
|
5
6
|
|
|
6
7
|
let rubberbandInstance: any
|
|
7
8
|
|
|
@@ -14,6 +15,8 @@ export async function stretchTimePitch(rawAudio: RawAudio, speed: number, pitchS
|
|
|
14
15
|
const sampleRate = rawAudio.sampleRate
|
|
15
16
|
|
|
16
17
|
const m = await getRubberbandInstance()
|
|
18
|
+
|
|
19
|
+
const { wrapEmscriptenModuleHeap } = await import('wasm-heap-manager')
|
|
17
20
|
const wasmHeap = wrapEmscriptenModuleHeap(m)
|
|
18
21
|
|
|
19
22
|
const optionFlags = rubberBandOptionsToFlags(options)
|
|
@@ -112,9 +115,13 @@ export async function stretchTimePitch(rawAudio: RawAudio, speed: number, pitchS
|
|
|
112
115
|
|
|
113
116
|
export async function getRubberbandInstance() {
|
|
114
117
|
if (!rubberbandInstance) {
|
|
115
|
-
|
|
118
|
+
try {
|
|
119
|
+
const { default: RubberbandInitializer } = await import('@echogarden/rubberband-wasm')
|
|
116
120
|
|
|
117
|
-
|
|
121
|
+
rubberbandInstance = await RubberbandInitializer()
|
|
122
|
+
} catch {
|
|
123
|
+
throw new Error(`Couldn't load the '@echogarden/rubberband-wasm' module. Since Echogarden v3.0.0 it is an optional dependency, due to its GPL-2 license. To enable it, you'll need to install it manually via 'npm install [-g] @echogarden/rubberband-wasm'.`)
|
|
124
|
+
}
|
|
118
125
|
}
|
|
119
126
|
|
|
120
127
|
return rubberbandInstance
|
package/src/dsp/Sonic.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RawAudio } from '../audio/AudioUtilities.js'
|
|
2
|
-
import { wrapEmscriptenModuleHeap } from 'wasm-heap-manager'
|
|
3
2
|
|
|
4
3
|
let sonicInstance: any
|
|
5
4
|
|
|
@@ -10,6 +9,8 @@ export async function stretchTimePitch(rawAudio: RawAudio, speed: number, pitchS
|
|
|
10
9
|
const inputSampleCount = rawAudio.audioChannels[0].length
|
|
11
10
|
|
|
12
11
|
const m = await getSonicInstance()
|
|
12
|
+
|
|
13
|
+
const { wrapEmscriptenModuleHeap } = await import('wasm-heap-manager')
|
|
13
14
|
const wasmHeap = wrapEmscriptenModuleHeap(m)
|
|
14
15
|
|
|
15
16
|
const streamPtr = m._sonicCreateStream(sampleRate, channelCount)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { RawAudio, cloneRawAudio } from '../audio/AudioUtilities.js'
|
|
2
2
|
import { concatFloat32Arrays, isWasmSimdSupported } from '../utilities/Utilities.js'
|
|
3
|
-
import { wrapEmscriptenModuleHeap } from 'wasm-heap-manager'
|
|
4
3
|
|
|
5
4
|
let speexResamplerInstance: any
|
|
6
5
|
|
|
@@ -23,6 +22,8 @@ export async function resampleAudioSpeex(rawAudio: RawAudio, outSampleRate: numb
|
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
const m = await getSpeexResamplerInstance()
|
|
25
|
+
|
|
26
|
+
const { wrapEmscriptenModuleHeap } = await import('wasm-heap-manager')
|
|
26
27
|
const wasmHeap = wrapEmscriptenModuleHeap(m)
|
|
27
28
|
|
|
28
29
|
function speexResultCodeToString(resultCode: number) {
|
package/src/encodings/Ascii.ts
CHANGED
package/src/encodings/Base64.ts
CHANGED
package/src/math/VectorMath.ts
CHANGED
|
@@ -747,24 +747,23 @@ export function sigmoid(x: number) {
|
|
|
747
747
|
}
|
|
748
748
|
|
|
749
749
|
export function softmax(logits: ArrayLike<number>, temperature = 1.0) {
|
|
750
|
-
temperature = Math.max(temperature, 0.00001)
|
|
751
|
-
|
|
752
750
|
const logitCount = logits.length
|
|
753
751
|
|
|
754
752
|
if (logitCount === 0) {
|
|
755
753
|
return new Float32Array(0)
|
|
756
754
|
}
|
|
757
755
|
|
|
758
|
-
let
|
|
756
|
+
let maxLogit = -Infinity
|
|
759
757
|
|
|
760
758
|
for (let i = 0; i < logitCount; i++) {
|
|
761
759
|
const value = logits[i]
|
|
762
760
|
|
|
763
|
-
if (value >
|
|
764
|
-
|
|
761
|
+
if (value > maxLogit) {
|
|
762
|
+
maxLogit = value
|
|
765
763
|
}
|
|
766
764
|
}
|
|
767
765
|
|
|
766
|
+
temperature = Math.max(temperature, 1e-5)
|
|
768
767
|
const temperatureReciprocal = 1 / temperature
|
|
769
768
|
|
|
770
769
|
const results = new Float32Array(logitCount)
|
|
@@ -774,7 +773,8 @@ export function softmax(logits: ArrayLike<number>, temperature = 1.0) {
|
|
|
774
773
|
for (let i = 0; i < logitCount; i++) {
|
|
775
774
|
const logit = logits[i]
|
|
776
775
|
|
|
777
|
-
const
|
|
776
|
+
const normalizedLogit = (logit - maxLogit) * temperatureReciprocal
|
|
777
|
+
const eToLogit = Math.exp(normalizedLogit)
|
|
778
778
|
|
|
779
779
|
sumOfExponentiatedLogits += eToLogit
|
|
780
780
|
|
|
@@ -831,6 +831,10 @@ export function zeroIfNaN(val: number) {
|
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
833
|
|
|
834
|
+
export function logSum(values: ArrayLike<number>, minVal = 1e-40) {
|
|
835
|
+
return Math.log(minVal + sumVector(values))
|
|
836
|
+
}
|
|
837
|
+
|
|
834
838
|
export function logSumExp(values: ArrayLike<number>, minVal = 1e-40) {
|
|
835
839
|
return Math.log(minVal + sumExp(values))
|
|
836
840
|
}
|
|
@@ -4,8 +4,8 @@ import * as Segmentation from './Segmentation.js'
|
|
|
4
4
|
|
|
5
5
|
const log = logToStderr
|
|
6
6
|
|
|
7
|
-
export
|
|
8
|
-
const ipaString =
|
|
7
|
+
export function phonemizeSentence(sentence: string, espeakVoice: string, substitutionMap?: Map<string, string[]>, useIpa = true) {
|
|
8
|
+
const ipaString = EspeakTTS.textToPhonemes(sentence, espeakVoice, useIpa)
|
|
9
9
|
|
|
10
10
|
const phraseStrings = ipaString.split(' | ')
|
|
11
11
|
|
package/src/nlp/Segmentation.ts
CHANGED
|
@@ -17,7 +17,7 @@ export const emojiSequenceRegExp = /\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\
|
|
|
17
17
|
export const punctuationRegExp = /[\p{Punctuation}]/u
|
|
18
18
|
|
|
19
19
|
export const phraseSeparators = [',', '、', ',', '،', ';', ';', ':', ':', '—']
|
|
20
|
-
export const symbolWords = ['$', '€', '¢', '£', '¥', '©', '®', '™', '%', '&', '#', '~', '@', '+', '±', '÷', '/', '\\', '^', '*', '×', '=', '¼', '½', '¾']
|
|
20
|
+
export const symbolWords = ['$', '€', '¢', '£', '¥', '©', '®', '™', '%', '&', '#', '~', '@', '+', '±', '÷', '/', '\\', '^', '*', '×', '=', '≈', '¼', '½', '¾']
|
|
21
21
|
|
|
22
22
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
23
23
|
// Predicates
|
|
@@ -42,8 +42,8 @@ export function includesEmoji(str: string) {
|
|
|
42
42
|
return emojiSequenceRegExp.test(str?.trim())
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export function
|
|
46
|
-
return str
|
|
45
|
+
export function isAllWhitespace(str: string) {
|
|
46
|
+
return str && /^\s+$/.test(str)
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -60,6 +60,11 @@ export function splitToParagraphs(text: string, paragraphBreakType: ParagraphBre
|
|
|
60
60
|
throw new Error(`Invalid paragraph break type: '${paragraphBreakType}'`)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
if (paragraphs.length >= 2 && isAllWhitespace(paragraphs[0])) {
|
|
64
|
+
paragraphs[1] = paragraphs[0] + paragraphs[1]
|
|
65
|
+
paragraphs.shift()
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
paragraphs = paragraphs.map(p => applyWhitespaceProcessing(p, whitespaceProcessingMethod))
|
|
64
69
|
paragraphs = paragraphs.filter(p => p.length > 0)
|
|
65
70
|
|
|
@@ -108,7 +113,7 @@ export async function splitToWords(text: string, langCode: string): Promise<Text
|
|
|
108
113
|
|
|
109
114
|
return wordSequence
|
|
110
115
|
} else {
|
|
111
|
-
return TextSegmentation.splitToWords(text, { language:
|
|
116
|
+
return TextSegmentation.splitToWords(text, { language: shortLangCode })
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
|
|
@@ -4,11 +4,12 @@ import * as FFMpegTranscoder from '../codecs/FFMpegTranscoder.js'
|
|
|
4
4
|
import { Logger } from '../utilities/Logger.js'
|
|
5
5
|
import { Timeline } from '../utilities/Timeline.js'
|
|
6
6
|
import { RawAudio } from '../audio/AudioUtilities.js'
|
|
7
|
+
import { RecognitionCallbacks } from '../api/Recognition.js'
|
|
7
8
|
|
|
8
|
-
export async function recgonize(rawAudio: RawAudio, languageCode: string, region: string, accessKeyId: string, secretAccessKey: string) {
|
|
9
|
-
const flac16Khz16bitMonoAudio = await FFMpegTranscoder.encodeFromChannels(rawAudio, { format: 'flac', sampleRate: 16000, sampleFormat: 's16', channelCount: 1 })
|
|
9
|
+
export async function recgonize(rawAudio: RawAudio, languageCode: string, region: string, accessKeyId: string, secretAccessKey: string, callbacks: RecognitionCallbacks) {
|
|
10
|
+
const flac16Khz16bitMonoAudio = await FFMpegTranscoder.encodeFromChannels(rawAudio, { format: 'flac', sampleRate: 16000, sampleFormat: 's16', channelCount: 1 }, callbacks)
|
|
10
11
|
|
|
11
|
-
const logger = new Logger()
|
|
12
|
+
const logger = new Logger(callbacks.logLevel)
|
|
12
13
|
|
|
13
14
|
if (!(languageCode in LanguageCode)) {
|
|
14
15
|
let matchingLanguageCode: string | undefined = undefined
|
|
@@ -3,13 +3,14 @@ import * as SpeechSDK from 'microsoft-cognitiveservices-speech-sdk'
|
|
|
3
3
|
import { RawAudio, encodeRawAudioToWave } from '../audio/AudioUtilities.js'
|
|
4
4
|
import { Logger } from '../utilities/Logger.js'
|
|
5
5
|
import { Timeline } from '../utilities/Timeline.js'
|
|
6
|
+
import { RecognitionCallbacks } from '../api/Recognition.js'
|
|
6
7
|
|
|
7
|
-
export async function recognize(rawAudio: RawAudio, subscriptionKey: string, serviceRegion: string, languageCode: string, profanity: SpeechSDK.ProfanityOption = SpeechSDK.ProfanityOption.Raw) {
|
|
8
|
-
const logger = new Logger()
|
|
8
|
+
export async function recognize(rawAudio: RawAudio, subscriptionKey: string, serviceRegion: string, languageCode: string, profanity: SpeechSDK.ProfanityOption = SpeechSDK.ProfanityOption.Raw, callbacks: RecognitionCallbacks) {
|
|
9
|
+
const logger = new Logger(callbacks.logLevel)
|
|
9
10
|
|
|
10
11
|
logger.start('Request recognition from Azure Cognitive Services')
|
|
11
12
|
|
|
12
|
-
const result = await requestRecognition(rawAudio, subscriptionKey, serviceRegion, languageCode)
|
|
13
|
+
const result = await requestRecognition(rawAudio, subscriptionKey, serviceRegion, languageCode, undefined, callbacks)
|
|
13
14
|
|
|
14
15
|
logger.start('Process result')
|
|
15
16
|
|
|
@@ -38,7 +39,7 @@ export async function recognize(rawAudio: RawAudio, subscriptionKey: string, ser
|
|
|
38
39
|
return { transcript, timeline }
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
async function requestRecognition(rawAudio: RawAudio, subscriptionKey: string, serviceRegion: string, languageCode: string, profanity: SpeechSDK.ProfanityOption = SpeechSDK.ProfanityOption.Raw) {
|
|
42
|
+
async function requestRecognition(rawAudio: RawAudio, subscriptionKey: string, serviceRegion: string, languageCode: string, profanity: SpeechSDK.ProfanityOption = SpeechSDK.ProfanityOption.Raw, callbacks: RecognitionCallbacks) {
|
|
42
43
|
const encodedAudio = encodeRawAudioToWave(rawAudio)
|
|
43
44
|
|
|
44
45
|
return new Promise<SpeechSDK.SpeechRecognitionResult>((resolve, reject) => {
|