echogarden 2.10.2 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.MIT.md +7 -0
- package/README.md +9 -1
- package/data/lexicons/heteronyms.en.json +44 -10
- package/data/lexicons/words.en.json +726 -22
- package/data/schemas/options.json +91 -153
- package/dist/alignment/DTWMfccSequenceAlignment.js.map +1 -1
- package/dist/alignment/SemanticTextAlignment.d.ts +4 -2
- package/dist/alignment/SemanticTextAlignment.d.ts.map +1 -1
- package/dist/alignment/SemanticTextAlignment.js +7 -7
- package/dist/alignment/SemanticTextAlignment.js.map +1 -1
- package/dist/alignment/SpeechAlignment.d.ts +9 -10
- package/dist/alignment/SpeechAlignment.d.ts.map +1 -1
- package/dist/alignment/SpeechAlignment.js +23 -96
- package/dist/alignment/SpeechAlignment.js.map +1 -1
- package/dist/api/APIOptions.d.ts +1 -1
- package/dist/api/APIOptions.d.ts.map +1 -1
- package/dist/api/Alignment.d.ts +8 -6
- package/dist/api/Alignment.d.ts.map +1 -1
- package/dist/api/Alignment.js +31 -40
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/Common.d.ts +7 -0
- package/dist/api/Common.d.ts.map +1 -1
- package/dist/api/Common.js.map +1 -1
- package/dist/api/Denoising.d.ts +5 -2
- package/dist/api/Denoising.d.ts.map +1 -1
- package/dist/api/Denoising.js +15 -15
- package/dist/api/Denoising.js.map +1 -1
- package/dist/api/GlobalOptions.d.ts +2 -8
- package/dist/api/GlobalOptions.d.ts.map +1 -1
- package/dist/api/GlobalOptions.js +2 -13
- package/dist/api/GlobalOptions.js.map +1 -1
- package/dist/api/Recognition.d.ts +11 -12
- package/dist/api/Recognition.d.ts.map +1 -1
- package/dist/api/Recognition.js +32 -82
- package/dist/api/Recognition.js.map +1 -1
- package/dist/api/SourceSeparation.d.ts +7 -2
- package/dist/api/SourceSeparation.d.ts.map +1 -1
- package/dist/api/SourceSeparation.js +12 -10
- package/dist/api/SourceSeparation.js.map +1 -1
- package/dist/api/SpeechLanguageDetection.d.ts +11 -7
- package/dist/api/SpeechLanguageDetection.d.ts.map +1 -1
- package/dist/api/SpeechLanguageDetection.js +37 -30
- package/dist/api/SpeechLanguageDetection.js.map +1 -1
- package/dist/api/SpeechSearch.d.ts +4 -1
- package/dist/api/SpeechSearch.d.ts.map +1 -1
- package/dist/api/SpeechSearch.js.map +1 -1
- package/dist/api/SpeechTranslation.d.ts +10 -6
- package/dist/api/SpeechTranslation.d.ts.map +1 -1
- package/dist/api/SpeechTranslation.js +28 -26
- package/dist/api/SpeechTranslation.js.map +1 -1
- package/dist/api/Synthesis.d.ts +13 -8
- package/dist/api/Synthesis.d.ts.map +1 -1
- package/dist/api/Synthesis.js +67 -89
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/api/TextLanguageDetection.d.ts +4 -2
- package/dist/api/TextLanguageDetection.d.ts.map +1 -1
- package/dist/api/TextLanguageDetection.js +4 -7
- package/dist/api/TextLanguageDetection.js.map +1 -1
- package/dist/api/TextTranslation.d.ts +4 -2
- package/dist/api/TextTranslation.d.ts.map +1 -1
- package/dist/api/TextTranslation.js +13 -24
- package/dist/api/TextTranslation.js.map +1 -1
- package/dist/api/TimelineTranslationAlignment.d.ts +6 -3
- package/dist/api/TimelineTranslationAlignment.d.ts.map +1 -1
- package/dist/api/TimelineTranslationAlignment.js +20 -11
- package/dist/api/TimelineTranslationAlignment.js.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.d.ts +6 -4
- package/dist/api/TranscriptAndTranslationAlignment.d.ts.map +1 -1
- package/dist/api/TranscriptAndTranslationAlignment.js +11 -12
- package/dist/api/TranscriptAndTranslationAlignment.js.map +1 -1
- package/dist/api/TranslationAlignment.d.ts +6 -4
- package/dist/api/TranslationAlignment.d.ts.map +1 -1
- package/dist/api/TranslationAlignment.js +20 -21
- package/dist/api/TranslationAlignment.js.map +1 -1
- package/dist/api/VoiceActivityDetection.d.ts +9 -8
- package/dist/api/VoiceActivityDetection.d.ts.map +1 -1
- package/dist/api/VoiceActivityDetection.js +20 -43
- package/dist/api/VoiceActivityDetection.js.map +1 -1
- package/dist/audio/AudioBufferConversion.js.map +1 -1
- package/dist/audio/AudioPlayer.d.ts +1 -3
- package/dist/audio/AudioPlayer.d.ts.map +1 -1
- package/dist/audio/AudioPlayer.js +3 -188
- package/dist/audio/AudioPlayer.js.map +1 -1
- package/dist/audio/AudioUtilities.d.ts +2 -1
- package/dist/audio/AudioUtilities.d.ts.map +1 -1
- package/dist/audio/AudioUtilities.js +2 -2
- package/dist/audio/AudioUtilities.js.map +1 -1
- package/dist/build-tools/MakeTarballsForInstalledPackages.js +3 -3
- package/dist/build-tools/MakeTarballsForInstalledPackages.js.map +1 -1
- package/dist/cli/CLI.d.ts.map +1 -1
- package/dist/cli/CLI.js +139 -92
- package/dist/cli/CLI.js.map +1 -1
- package/dist/codecs/FFMpegTranscoder.d.ts +4 -3
- package/dist/codecs/FFMpegTranscoder.d.ts.map +1 -1
- package/dist/codecs/FFMpegTranscoder.js +16 -14
- package/dist/codecs/FFMpegTranscoder.js.map +1 -1
- package/dist/codecs/TIMITCodec.d.ts.map +1 -1
- package/dist/data-structures/DynamicTypedArray.d.ts.map +1 -1
- package/dist/data-structures/DynamicTypedArray.js.map +1 -1
- package/dist/data-structures/Queue.d.ts.map +1 -1
- package/dist/data-structures/WindowedList.d.ts.map +1 -1
- package/dist/data-structures/WindowedList.js.map +1 -1
- package/dist/denoising/NSNet2.d.ts +3 -2
- package/dist/denoising/NSNet2.d.ts.map +1 -1
- package/dist/denoising/NSNet2.js +4 -4
- package/dist/denoising/NSNet2.js.map +1 -1
- package/dist/denoising/RNNoise.d.ts +2 -1
- package/dist/denoising/RNNoise.d.ts.map +1 -1
- package/dist/denoising/RNNoise.js +10 -6
- package/dist/denoising/RNNoise.js.map +1 -1
- package/dist/dsp/BiquadFilter.d.ts.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.d.ts.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.js.map +1 -1
- package/dist/dsp/FFT.d.ts.map +1 -1
- package/dist/dsp/FFT.js +2 -1
- package/dist/dsp/FFT.js.map +1 -1
- package/dist/dsp/KWeightingFilter.d.ts.map +1 -1
- package/dist/dsp/KWeightingFilter.js.map +1 -1
- package/dist/dsp/LoudnessEstimator.d.ts.map +1 -1
- package/dist/dsp/LoudnessEstimator.js.map +1 -1
- package/dist/dsp/MFCC.d.ts +3 -2
- package/dist/dsp/MFCC.d.ts.map +1 -1
- package/dist/dsp/MFCC.js +4 -4
- package/dist/dsp/MFCC.js.map +1 -1
- package/dist/dsp/MelSpectrogram.d.ts +10 -8
- package/dist/dsp/MelSpectrogram.d.ts.map +1 -1
- package/dist/dsp/MelSpectrogram.js +31 -34
- package/dist/dsp/MelSpectrogram.js.map +1 -1
- package/dist/dsp/Rubberband.d.ts.map +1 -1
- package/dist/dsp/Rubberband.js +8 -3
- package/dist/dsp/Rubberband.js.map +1 -1
- package/dist/dsp/Sonic.d.ts.map +1 -1
- package/dist/dsp/Sonic.js +1 -1
- package/dist/dsp/Sonic.js.map +1 -1
- package/dist/dsp/SpeexResampler.d.ts.map +1 -1
- package/dist/dsp/SpeexResampler.js +1 -1
- package/dist/dsp/SpeexResampler.js.map +1 -1
- package/dist/encodings/Ascii.d.ts +1 -1
- package/dist/encodings/Ascii.d.ts.map +1 -1
- package/dist/encodings/Base64.js.map +1 -1
- package/dist/encodings/Utf16.d.ts.map +1 -1
- package/dist/encodings/Utf8.d.ts.map +1 -1
- package/dist/math/VectorMath.d.ts +1 -0
- package/dist/math/VectorMath.d.ts.map +1 -1
- package/dist/math/VectorMath.js +9 -5
- package/dist/math/VectorMath.js.map +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts +1 -1
- package/dist/nlp/ChineseSegmentation.d.ts.map +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts +1 -1
- package/dist/nlp/EspeakPhonemizer.d.ts.map +1 -1
- package/dist/nlp/EspeakPhonemizer.js +2 -2
- package/dist/nlp/EspeakPhonemizer.js.map +1 -1
- package/dist/nlp/IPA.d.ts +2 -2
- package/dist/nlp/Segmentation.d.ts +1 -1
- package/dist/nlp/Segmentation.d.ts.map +1 -1
- package/dist/nlp/Segmentation.js +8 -4
- package/dist/nlp/Segmentation.js.map +1 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts +2 -1
- package/dist/recognition/AmazonTranscribeSTT.d.ts.map +1 -1
- package/dist/recognition/AmazonTranscribeSTT.js +3 -3
- package/dist/recognition/AmazonTranscribeSTT.js.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts +2 -1
- package/dist/recognition/AzureCognitiveServicesSTT.d.ts.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.js +4 -4
- package/dist/recognition/AzureCognitiveServicesSTT.js.map +1 -1
- package/dist/recognition/DeepgramSTT.d.ts +2 -1
- package/dist/recognition/DeepgramSTT.d.ts.map +1 -1
- package/dist/recognition/DeepgramSTT.js +12 -13
- package/dist/recognition/DeepgramSTT.js.map +1 -1
- package/dist/recognition/GoogleCloudSTT.d.ts +2 -1
- package/dist/recognition/GoogleCloudSTT.d.ts.map +1 -1
- package/dist/recognition/GoogleCloudSTT.js +11 -10
- package/dist/recognition/GoogleCloudSTT.js.map +1 -1
- package/dist/recognition/OpenAICloudSTT.d.ts +2 -1
- package/dist/recognition/OpenAICloudSTT.d.ts.map +1 -1
- package/dist/recognition/OpenAICloudSTT.js +6 -6
- package/dist/recognition/OpenAICloudSTT.js.map +1 -1
- package/dist/recognition/WhisperCommon.d.ts +9 -0
- package/dist/recognition/WhisperCommon.d.ts.map +1 -0
- package/dist/recognition/WhisperCommon.js +52 -0
- package/dist/recognition/WhisperCommon.js.map +1 -0
- package/dist/recognition/{WhisperCppSTT.d.ts → WhisperCppCliSTT.d.ts} +14 -16
- package/dist/recognition/WhisperCppCliSTT.d.ts.map +1 -0
- package/dist/recognition/{WhisperCppSTT.js → WhisperCppCliSTT.js} +55 -84
- package/dist/recognition/WhisperCppCliSTT.js.map +1 -0
- package/dist/recognition/WhisperSTT.d.ts +72 -85
- package/dist/recognition/WhisperSTT.d.ts.map +1 -1
- package/dist/recognition/WhisperSTT.js +384 -519
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/server/Client.d.ts +2 -2
- package/dist/server/Client.d.ts.map +1 -1
- package/dist/server/Client.js.map +1 -1
- package/dist/server/Worker.d.ts +6 -7
- package/dist/server/Worker.d.ts.map +1 -1
- package/dist/server/Worker.js +42 -44
- package/dist/server/Worker.js.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.d.ts +3 -2
- package/dist/source-separation/MDXNetSourceSeparation.d.ts.map +1 -1
- package/dist/source-separation/MDXNetSourceSeparation.js +10 -8
- package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts +3 -2
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.d.ts.map +1 -1
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js +5 -5
- package/dist/speech-embeddings/WavToVec2BertFeatureEmbeddings.js.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts +5 -3
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts.map +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.js +8 -8
- package/dist/speech-language-detection/SileroLanguageDetection.js.map +1 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts +2 -1
- package/dist/speech-search/DTWSpeechSearch.d.ts.map +1 -1
- package/dist/speech-search/DTWSpeechSearch.js +4 -4
- package/dist/speech-search/DTWSpeechSearch.js.map +1 -1
- package/dist/subtitles/Subtitles.d.ts +13 -1
- package/dist/subtitles/Subtitles.d.ts.map +1 -1
- package/dist/subtitles/Subtitles.js +22 -22
- package/dist/subtitles/Subtitles.js.map +1 -1
- package/dist/synthesis/AwsPollyTTS.d.ts +3 -2
- package/dist/synthesis/AwsPollyTTS.d.ts.map +1 -1
- package/dist/synthesis/AwsPollyTTS.js +5 -5
- package/dist/synthesis/AwsPollyTTS.js.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts +2 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.d.ts.map +1 -1
- package/dist/synthesis/AzureCognitiveServicesTTS.js +3 -3
- package/dist/synthesis/AzureCognitiveServicesTTS.js.map +1 -1
- package/dist/synthesis/CoquiServerTTS.d.ts +2 -1
- package/dist/synthesis/CoquiServerTTS.d.ts.map +1 -1
- package/dist/synthesis/CoquiServerTTS.js +7 -8
- package/dist/synthesis/CoquiServerTTS.js.map +1 -1
- package/dist/synthesis/DeepgramTTS.d.ts +2 -2
- package/dist/synthesis/DeepgramTTS.d.ts.map +1 -1
- package/dist/synthesis/DeepgramTTS.js +13 -13
- package/dist/synthesis/DeepgramTTS.js.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.d.ts +3 -3
- package/dist/synthesis/ElevenLabsTTS.d.ts.map +1 -1
- package/dist/synthesis/ElevenLabsTTS.js +22 -21
- package/dist/synthesis/ElevenLabsTTS.js.map +1 -1
- package/dist/synthesis/EspeakTTS.d.ts +11 -9
- package/dist/synthesis/EspeakTTS.d.ts.map +1 -1
- package/dist/synthesis/EspeakTTS.js +129 -71
- package/dist/synthesis/EspeakTTS.js.map +1 -1
- package/dist/synthesis/FliteTTS.d.ts +2 -2
- package/dist/synthesis/FliteTTS.d.ts.map +1 -1
- package/dist/synthesis/FliteTTS.js +2 -2
- package/dist/synthesis/FliteTTS.js.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.d.ts +2 -2
- package/dist/synthesis/GnuSpeechTTS.d.ts.map +1 -1
- package/dist/synthesis/GnuSpeechTTS.js +1 -1
- package/dist/synthesis/GnuSpeechTTS.js.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.d.ts +3 -2
- package/dist/synthesis/GoogleCloudTTS.d.ts.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.js +15 -14
- package/dist/synthesis/GoogleCloudTTS.js.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.d.ts +3 -2
- package/dist/synthesis/GoogleTranslateTTS.d.ts.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.js +11 -11
- package/dist/synthesis/GoogleTranslateTTS.js.map +1 -1
- package/dist/synthesis/KokoroTTS.d.ts +4 -4
- package/dist/synthesis/KokoroTTS.d.ts.map +1 -1
- package/dist/synthesis/KokoroTTS.js +11 -10
- package/dist/synthesis/KokoroTTS.js.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts +4 -3
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts.map +1 -1
- package/dist/synthesis/MicrosoftEdgeTTS.js +41 -20
- package/dist/synthesis/MicrosoftEdgeTTS.js.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.d.ts +2 -2
- package/dist/synthesis/OpenAICloudTTS.d.ts.map +1 -1
- package/dist/synthesis/OpenAICloudTTS.js +6 -5
- package/dist/synthesis/OpenAICloudTTS.js.map +1 -1
- package/dist/synthesis/SamTTS.d.ts +2 -1
- package/dist/synthesis/SamTTS.d.ts.map +1 -1
- package/dist/synthesis/SamTTS.js +2 -2
- package/dist/synthesis/SamTTS.js.map +1 -1
- package/dist/synthesis/SapiTTS.d.ts +2 -2
- package/dist/synthesis/SapiTTS.d.ts.map +1 -1
- package/dist/synthesis/SapiTTS.js +2 -2
- package/dist/synthesis/SapiTTS.js.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.d.ts +2 -2
- package/dist/synthesis/SvoxPicoTTS.d.ts.map +1 -1
- package/dist/synthesis/SvoxPicoTTS.js +3 -3
- package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
- package/dist/synthesis/VitsTTS.d.ts +3 -3
- package/dist/synthesis/VitsTTS.d.ts.map +1 -1
- package/dist/synthesis/VitsTTS.js +14 -11
- package/dist/synthesis/VitsTTS.js.map +1 -1
- package/dist/text-translation/DeepLTextTranslation.d.ts +2 -2
- package/dist/text-translation/DeepLTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/DeepLTextTranslation.js +10 -9
- package/dist/text-translation/DeepLTextTranslation.js.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts +4 -4
- package/dist/text-translation/GoogleTranslateTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/GoogleTranslateTextTranslation.js +20 -18
- package/dist/text-translation/GoogleTranslateTextTranslation.js.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.d.ts +2 -2
- package/dist/text-translation/NLLBTextTranslation.d.ts.map +1 -1
- package/dist/text-translation/NLLBTextTranslation.js +4 -6
- package/dist/text-translation/NLLBTextTranslation.js.map +1 -1
- package/dist/typings/TypedArray.d.ts.map +1 -1
- package/dist/utilities/Compression.d.ts +4 -3
- package/dist/utilities/Compression.d.ts.map +1 -1
- package/dist/utilities/Compression.js +9 -9
- package/dist/utilities/Compression.js.map +1 -1
- package/dist/utilities/FileDownloader.d.ts +6 -3
- package/dist/utilities/FileDownloader.d.ts.map +1 -1
- package/dist/utilities/FileDownloader.js +25 -21
- package/dist/utilities/FileDownloader.js.map +1 -1
- package/dist/utilities/FileReader.d.ts.map +1 -1
- package/dist/utilities/FileReader.js.map +1 -1
- package/dist/utilities/FileSystem.js +1 -1
- package/dist/utilities/FileSystem.js.map +1 -1
- package/dist/utilities/FileWriter.d.ts.map +1 -1
- package/dist/utilities/FileWriter.js.map +1 -1
- package/dist/utilities/Hashing.d.ts.map +1 -1
- package/dist/utilities/Hashing.js.map +1 -1
- package/dist/utilities/Locale.js.map +1 -1
- package/dist/utilities/Logger.d.ts +17 -9
- package/dist/utilities/Logger.d.ts.map +1 -1
- package/dist/utilities/Logger.js +50 -35
- package/dist/utilities/Logger.js.map +1 -1
- package/dist/utilities/NpmUtilities.d.ts.map +1 -1
- package/dist/utilities/NpmUtilities.js +4 -5
- package/dist/utilities/NpmUtilities.js.map +1 -1
- package/dist/utilities/ObjectUtilities.js.map +1 -1
- package/dist/utilities/OpenPromise.d.ts.map +1 -1
- package/dist/utilities/OpenPromise.js.map +1 -1
- package/dist/utilities/PackageManager.d.ts +4 -1
- package/dist/utilities/PackageManager.d.ts.map +1 -1
- package/dist/utilities/PackageManager.js +37 -22
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/PathUtilities.d.ts +2 -0
- package/dist/utilities/PathUtilities.d.ts.map +1 -1
- package/dist/utilities/PathUtilities.js +5 -2
- package/dist/utilities/PathUtilities.js.map +1 -1
- package/dist/utilities/RandomGenerator.d.ts.map +1 -1
- package/dist/utilities/SignalChannel.d.ts.map +1 -1
- package/dist/utilities/SmoothEstimator.d.ts.map +1 -1
- package/dist/utilities/SmoothEstimator.js.map +1 -1
- package/dist/utilities/StringBuilder.d.ts.map +1 -1
- package/dist/utilities/TarballMaker.d.ts +4 -3
- package/dist/utilities/TarballMaker.d.ts.map +1 -1
- package/dist/utilities/TarballMaker.js +6 -6
- package/dist/utilities/TarballMaker.js.map +1 -1
- package/dist/utilities/Timeline.js.map +1 -1
- package/dist/utilities/Timer.d.ts.map +1 -1
- package/dist/utilities/Utilities.d.ts +9 -7
- package/dist/utilities/Utilities.d.ts.map +1 -1
- package/dist/utilities/Utilities.js +49 -33
- package/dist/utilities/Utilities.js.map +1 -1
- package/dist/utilities/VirtualFileReadStream.d.ts.map +1 -1
- package/dist/utilities/WebReader.d.ts +2 -1
- package/dist/utilities/WebReader.d.ts.map +1 -1
- package/dist/utilities/WebReader.js +7 -6
- package/dist/utilities/WebReader.js.map +1 -1
- package/dist/utilities/WikipediaReader.d.ts +2 -1
- package/dist/utilities/WikipediaReader.d.ts.map +1 -1
- package/dist/utilities/WikipediaReader.js +1 -5
- package/dist/utilities/WikipediaReader.js.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts +2 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.js +1 -1
- package/dist/voice-activity-detection/AdaptiveGateVAD.js.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.d.ts.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js.map +1 -1
- package/docs/API.md +62 -17
- package/docs/CUDA.md +4 -3
- package/docs/Engines.md +8 -7
- package/docs/Licenses.md +0 -3
- package/docs/Options.md +27 -31
- package/docs/Server.md +1 -0
- package/docs/Tasklist.md +2 -1
- package/docs/Technical.md +2 -2
- package/package.json +45 -35
- package/src/alignment/SemanticTextAlignment.ts +14 -7
- package/src/alignment/SpeechAlignment.ts +47 -150
- package/src/api/APIOptions.ts +1 -1
- package/src/api/Alignment.ts +95 -61
- package/src/api/Common.ts +11 -0
- package/src/api/Denoising.ts +22 -17
- package/src/api/GlobalOptions.ts +4 -20
- package/src/api/Recognition.ts +106 -123
- package/src/api/SourceSeparation.ts +39 -21
- package/src/api/SpeechLanguageDetection.ts +77 -37
- package/src/api/SpeechSearch.ts +6 -1
- package/src/api/SpeechTranslation.ts +75 -38
- package/src/api/Synthesis.ts +220 -116
- package/src/api/TextLanguageDetection.ts +10 -12
- package/src/api/TextTranslation.ts +43 -26
- package/src/api/TimelineTranslationAlignment.ts +41 -13
- package/src/api/TranscriptAndTranslationAlignment.ts +28 -15
- package/src/api/TranslationAlignment.ts +53 -24
- package/src/api/VoiceActivityDetection.ts +33 -68
- package/src/audio/AudioPlayer.ts +4 -232
- package/src/audio/AudioUtilities.ts +9 -2
- package/src/build-tools/MakeTarballsForInstalledPackages.ts +4 -3
- package/src/cli/CLI.ts +209 -101
- package/src/codecs/FFMpegTranscoder.ts +18 -16
- package/src/denoising/NSNet2.ts +5 -4
- package/src/denoising/RNNoise.ts +14 -6
- package/src/dsp/FFT.ts +2 -1
- package/src/dsp/MFCC.ts +7 -5
- package/src/dsp/MelSpectrogram.ts +56 -36
- package/src/dsp/Rubberband.ts +10 -3
- package/src/dsp/Sonic.ts +2 -1
- package/src/dsp/SpeexResampler.ts +2 -1
- package/src/encodings/Ascii.ts +1 -1
- package/src/encodings/Base64.ts +1 -1
- package/src/math/VectorMath.ts +10 -6
- package/src/nlp/EspeakPhonemizer.ts +2 -2
- package/src/nlp/Segmentation.ts +9 -4
- package/src/recognition/AmazonTranscribeSTT.ts +4 -3
- package/src/recognition/AzureCognitiveServicesSTT.ts +5 -4
- package/src/recognition/DeepgramSTT.ts +16 -16
- package/src/recognition/GoogleCloudSTT.ts +14 -12
- package/src/recognition/OpenAICloudSTT.ts +12 -6
- package/src/recognition/WhisperCommon.ts +130 -0
- package/src/recognition/{WhisperCppSTT.ts → WhisperCppCliSTT.ts} +73 -133
- package/src/recognition/WhisperSTT.ts +569 -718
- package/src/server/Client.ts +4 -4
- package/src/server/Worker.ts +59 -59
- package/src/source-separation/MDXNetSourceSeparation.ts +15 -10
- package/src/speech-embeddings/WavToVec2BertFeatureEmbeddings.ts +7 -5
- package/src/speech-language-detection/SileroLanguageDetection.ts +18 -9
- package/src/speech-search/DTWSpeechSearch.ts +6 -5
- package/src/subtitles/Subtitles.ts +22 -22
- package/src/synthesis/AwsPollyTTS.ts +12 -5
- package/src/synthesis/AzureCognitiveServicesTTS.ts +11 -3
- package/src/synthesis/CoquiServerTTS.ts +8 -7
- package/src/synthesis/DeepgramTTS.ts +21 -15
- package/src/synthesis/ElevenLabsTTS.ts +33 -23
- package/src/synthesis/EspeakTTS.ts +158 -71
- package/src/synthesis/FliteTTS.ts +3 -3
- package/src/synthesis/GnuSpeechTTS.ts +2 -2
- package/src/synthesis/GoogleCloudTTS.ts +23 -14
- package/src/synthesis/GoogleTranslateTTS.ts +19 -11
- package/src/synthesis/KokoroTTS.ts +37 -14
- package/src/synthesis/MicrosoftEdgeTTS.ts +71 -23
- package/src/synthesis/OpenAICloudTTS.ts +7 -6
- package/src/synthesis/SamTTS.ts +3 -2
- package/src/synthesis/SapiTTS.ts +3 -3
- package/src/synthesis/SvoxPicoTTS.ts +4 -5
- package/src/synthesis/VitsTTS.ts +43 -15
- package/src/text-translation/DeepLTextTranslation.ts +12 -10
- package/src/text-translation/GoogleTranslateTextTranslation.ts +35 -21
- package/src/text-translation/NLLBTextTranslation.ts +5 -9
- package/src/typings/Fillers.d.ts +0 -60
- package/src/typings/TypedArray.ts +12 -1
- package/src/utilities/Compression.ts +10 -9
- package/src/utilities/FileDownloader.ts +38 -23
- package/src/utilities/FileSystem.ts +1 -1
- package/src/utilities/Logger.ts +59 -42
- package/src/utilities/NpmUtilities.ts +4 -6
- package/src/utilities/OpenPromise.ts +1 -2
- package/src/utilities/PackageManager.ts +53 -26
- package/src/utilities/PathUtilities.ts +6 -2
- package/src/utilities/TarballMaker.ts +7 -7
- package/src/utilities/Utilities.ts +58 -41
- package/src/utilities/WebReader.ts +11 -6
- package/src/utilities/WikipediaReader.ts +2 -8
- package/src/voice-activity-detection/AdaptiveGateVAD.ts +13 -8
- package/src/voice-activity-detection/WebRtcVAD.ts +1 -2
- package/tsconfig.json +53 -54
- package/dist/audio/AudioRecorder.d.ts +0 -4
- package/dist/audio/AudioRecorder.d.ts.map +0 -1
- package/dist/audio/AudioRecorder.js +0 -68
- package/dist/audio/AudioRecorder.js.map +0 -1
- package/dist/audio/SoxPath.d.ts +0 -2
- package/dist/audio/SoxPath.d.ts.map +0 -1
- package/dist/audio/SoxPath.js +0 -24
- package/dist/audio/SoxPath.js.map +0 -1
- package/dist/recognition/SileroSTT.d.ts +0 -30
- package/dist/recognition/SileroSTT.d.ts.map +0 -1
- package/dist/recognition/SileroSTT.js +0 -152
- package/dist/recognition/SileroSTT.js.map +0 -1
- package/dist/recognition/VoskSTT.d.ts +0 -11
- package/dist/recognition/VoskSTT.d.ts.map +0 -1
- package/dist/recognition/VoskSTT.js +0 -72
- package/dist/recognition/VoskSTT.js.map +0 -1
- package/dist/recognition/WhisperCppSTT.d.ts.map +0 -1
- package/dist/recognition/WhisperCppSTT.js.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.d.ts +0 -12
- package/dist/synthesis/StreamlabsPollyTTS.d.ts.map +0 -1
- package/dist/synthesis/StreamlabsPollyTTS.js +0 -88
- package/dist/synthesis/StreamlabsPollyTTS.js.map +0 -1
- package/dist/utilities/BinaryUtilities.d.ts +0 -14
- package/dist/utilities/BinaryUtilities.d.ts.map +0 -1
- package/dist/utilities/BinaryUtilities.js +0 -113
- package/dist/utilities/BinaryUtilities.js.map +0 -1
- package/src/audio/AudioRecorder.ts +0 -91
- package/src/audio/SoxPath.ts +0 -31
- package/src/recognition/SileroSTT.ts +0 -222
- package/src/recognition/VoskSTT.ts +0 -112
- package/src/synthesis/StreamlabsPollyTTS.ts +0 -114
- package/src/utilities/BinaryUtilities.ts +0 -138
- /package/{LICENSE.md → LICENSE.GPLv3.md} +0 -0
|
@@ -4,25 +4,34 @@ import { Logger } from '../utilities/Logger.js'
|
|
|
4
4
|
import { RawAudio, getEmptyRawAudio } from '../audio/AudioUtilities.js'
|
|
5
5
|
import { getNormalizedFragmentsForSpeech, simplifyPunctuationCharacters } from '../nlp/TextNormalizer.js'
|
|
6
6
|
import { ipaPhoneToKirshenbaum } from '../nlp/PhoneConversion.js'
|
|
7
|
-
import { splitToWords, wordCharacterRegExp } from '../nlp/Segmentation.js'
|
|
7
|
+
import { includesPunctuation, splitToWords, wordCharacterRegExp } from '../nlp/Segmentation.js'
|
|
8
8
|
import { Lexicon, tryGetFirstLexiconSubstitution } from '../nlp/Lexicon.js'
|
|
9
9
|
import { phonemizeSentence } from '../nlp/EspeakPhonemizer.js'
|
|
10
10
|
import { Timeline, TimelineEntry } from '../utilities/Timeline.js'
|
|
11
11
|
import { extendDeep } from '../utilities/ObjectUtilities.js'
|
|
12
12
|
import { escapeHtml } from '../encodings/HtmlEscape.js'
|
|
13
|
+
import * as TextSegmentation from '@echogarden/text-segmentation'
|
|
14
|
+
|
|
15
|
+
import { getGlobalOption, OperationCallbacks, SynthesisCallbacks } from '../api/API.js'
|
|
16
|
+
import { loadPackage } from '../utilities/PackageManager.js'
|
|
13
17
|
|
|
14
18
|
import { wrapEmscriptenModuleHeap } from 'wasm-heap-manager'
|
|
19
|
+
import { pathToFileUrl, resolvePath } from '../utilities/PathUtilities.js'
|
|
15
20
|
|
|
16
21
|
const log = logToStderr
|
|
17
22
|
|
|
18
23
|
let espeakInstance: any
|
|
19
24
|
let espeakModule: any
|
|
20
25
|
|
|
21
|
-
export async function preprocessAndSynthesize(text: string, language: string, espeakOptions: EspeakOptions, lexicons: Lexicon[] = []) {
|
|
22
|
-
const logger = new Logger()
|
|
26
|
+
export async function preprocessAndSynthesize(text: string, language: string, espeakOptions: EspeakOptions, lexicons: Lexicon[] = [], callbacks: SynthesisCallbacks) {
|
|
27
|
+
const logger = new Logger(callbacks.logLevel)
|
|
23
28
|
|
|
24
29
|
espeakOptions = extendDeep(defaultEspeakOptions, espeakOptions)
|
|
25
30
|
|
|
31
|
+
await logger.startAsync('Load espeak instance')
|
|
32
|
+
|
|
33
|
+
await ensureEspeakInstanceInitialized(callbacks)
|
|
34
|
+
|
|
26
35
|
await logger.startAsync('Tokenize and analyze text')
|
|
27
36
|
|
|
28
37
|
let lowerCaseLanguageCode = language.toLowerCase()
|
|
@@ -42,7 +51,7 @@ export async function preprocessAndSynthesize(text: string, language: string, es
|
|
|
42
51
|
|
|
43
52
|
// Merge repeating non-words to a single word to work around eSpeak bug
|
|
44
53
|
{
|
|
45
|
-
const
|
|
54
|
+
const mergedWords: string[] = []
|
|
46
55
|
|
|
47
56
|
for (let i = 0; i < words.length; i++) {
|
|
48
57
|
const currentWord = words[i]
|
|
@@ -54,13 +63,22 @@ export async function preprocessAndSynthesize(text: string, language: string, es
|
|
|
54
63
|
!['[', ']'].includes(currentWord) && // Work around eSpeak-NG marker bug with repeating squared brackets
|
|
55
64
|
!wordCharacterRegExp.test(currentWord)) {
|
|
56
65
|
|
|
57
|
-
|
|
66
|
+
mergedWords[mergedWords.length - 1] += currentWord
|
|
58
67
|
} else {
|
|
59
|
-
|
|
68
|
+
mergedWords.push(currentWord)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
for (let i = 0; i < mergedWords.length; i++) {
|
|
73
|
+
const mergedWord = mergedWords[i]
|
|
74
|
+
|
|
75
|
+
// Replace vertical bar only words with empty words
|
|
76
|
+
if (/^[\|│]+$/.test(mergedWord)) {
|
|
77
|
+
mergedWords[i] = ''
|
|
60
78
|
}
|
|
61
79
|
}
|
|
62
80
|
|
|
63
|
-
words =
|
|
81
|
+
words = mergedWords
|
|
64
82
|
}
|
|
65
83
|
|
|
66
84
|
// Remove words containing only whitespace
|
|
@@ -97,8 +115,8 @@ export async function preprocessAndSynthesize(text: string, language: string, es
|
|
|
97
115
|
}
|
|
98
116
|
|
|
99
117
|
phonemizedFragmentsSubstitutions.set(fragmentIndex, substitutionPhonemes)
|
|
100
|
-
const referenceIPA =
|
|
101
|
-
const referenceKirshenbaum =
|
|
118
|
+
const referenceIPA = textToPhonemes(fragment, espeakOptions.voice, true).replaceAll('_', ' ')
|
|
119
|
+
const referenceKirshenbaum = textToPhonemes(fragment, espeakOptions.voice, false).replaceAll('_', '')
|
|
102
120
|
|
|
103
121
|
const kirshenbaumPhonemes = substitutionPhonemes.map(phone => ipaPhoneToKirshenbaum(phone)).join('')
|
|
104
122
|
|
|
@@ -114,42 +132,95 @@ export async function preprocessAndSynthesize(text: string, language: string, es
|
|
|
114
132
|
|
|
115
133
|
logger.start('Synthesize preprocessed fragments with eSpeak')
|
|
116
134
|
|
|
117
|
-
const { rawAudio: referenceSynthesizedAudio, timeline: referenceTimeline } = await synthesizeFragments(
|
|
135
|
+
const { rawAudio: referenceSynthesizedAudio, timeline: referenceTimeline } = await synthesizeFragments(
|
|
136
|
+
preprocessedFragments,
|
|
137
|
+
espeakOptions,
|
|
138
|
+
{ ...callbacks, logLevel: 'warning' }
|
|
139
|
+
)
|
|
118
140
|
|
|
119
141
|
await logger.startAsync('Build phonemized tokens')
|
|
120
142
|
|
|
143
|
+
// Build modified clause timeline using word segmentation library instead
|
|
144
|
+
// of eSpeak's native clauses
|
|
145
|
+
const clauseTimeline: Timeline = []
|
|
146
|
+
|
|
147
|
+
{
|
|
148
|
+
const fragmentWordSequence = new TextSegmentation.WordSequence()
|
|
149
|
+
|
|
150
|
+
for (let fragment of fragments) {
|
|
151
|
+
fragmentWordSequence.addWord(fragment, 0, !wordCharacterRegExp.test(fragment))
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const wordEntries = referenceTimeline.flatMap(phraseEntry => phraseEntry.timeline!)
|
|
155
|
+
const segmentedWords =
|
|
156
|
+
await TextSegmentation.segmentWordSequence(fragmentWordSequence, {
|
|
157
|
+
requireSpaceAfterColonsOrSemicolons: false
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
let phraseStartWordIndex = 0
|
|
161
|
+
|
|
162
|
+
for (const sentence of segmentedWords.sentences) {
|
|
163
|
+
for (const phrase of sentence.phrases) {
|
|
164
|
+
const phraseEndWordIndex = phraseStartWordIndex + phrase.words.length
|
|
165
|
+
|
|
166
|
+
const phraseEntryTimeline: Timeline = []
|
|
167
|
+
|
|
168
|
+
for (let wordIndex = phraseStartWordIndex; wordIndex < phraseEndWordIndex; wordIndex++) {
|
|
169
|
+
phraseEntryTimeline.push(wordEntries[wordIndex])
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const clauseEntry: TimelineEntry = {
|
|
173
|
+
type: 'clause',
|
|
174
|
+
text: phraseEntryTimeline.map(wordEntry => wordEntry.text).join(' '),
|
|
175
|
+
startTime: phraseEntryTimeline[0].startTime,
|
|
176
|
+
endTime: phraseEntryTimeline[phraseEntryTimeline.length - 1].endTime,
|
|
177
|
+
timeline: phraseEntryTimeline,
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
clauseTimeline.push(clauseEntry)
|
|
181
|
+
|
|
182
|
+
phraseStartWordIndex = phraseEndWordIndex
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
121
187
|
const phonemizedSentence: string[][][] = []
|
|
122
188
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const phrase: string[][] = []
|
|
189
|
+
{
|
|
190
|
+
let wordIndex = 0
|
|
126
191
|
|
|
127
|
-
for (const
|
|
128
|
-
|
|
192
|
+
for (const phraseEntry of clauseTimeline) {
|
|
193
|
+
const phrase: string[][] = []
|
|
129
194
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
195
|
+
for (const wordEntry of phraseEntry.timeline!) {
|
|
196
|
+
wordEntry.text = fragments[wordIndex]
|
|
197
|
+
|
|
198
|
+
if (phonemizedFragmentsSubstitutions.has(wordIndex)) {
|
|
199
|
+
phrase.push(phonemizedFragmentsSubstitutions.get(wordIndex)!)
|
|
200
|
+
} else {
|
|
201
|
+
for (const tokenEntry of wordEntry.timeline!) {
|
|
202
|
+
const tokenPhonemes: string[] = []
|
|
135
203
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
204
|
+
for (const phoneme of tokenEntry.timeline!) {
|
|
205
|
+
if (phoneme.text) {
|
|
206
|
+
tokenPhonemes.push(phoneme.text)
|
|
207
|
+
}
|
|
139
208
|
}
|
|
140
|
-
}
|
|
141
209
|
|
|
142
|
-
|
|
143
|
-
|
|
210
|
+
if (tokenPhonemes.length > 0) {
|
|
211
|
+
phrase.push(tokenPhonemes)
|
|
212
|
+
}
|
|
144
213
|
}
|
|
145
214
|
}
|
|
215
|
+
|
|
216
|
+
wordIndex += 1
|
|
146
217
|
}
|
|
147
218
|
|
|
148
|
-
|
|
149
|
-
}
|
|
219
|
+
phraseEntry.text = phraseEntry.timeline!.map(wordEntry => wordEntry.text).join(' ')
|
|
150
220
|
|
|
151
|
-
|
|
152
|
-
|
|
221
|
+
if (phrase.length > 0) {
|
|
222
|
+
phonemizedSentence.push(phrase)
|
|
223
|
+
}
|
|
153
224
|
}
|
|
154
225
|
}
|
|
155
226
|
|
|
@@ -157,15 +228,15 @@ export async function preprocessAndSynthesize(text: string, language: string, es
|
|
|
157
228
|
|
|
158
229
|
logger.end()
|
|
159
230
|
|
|
160
|
-
return { referenceSynthesizedAudio, referenceTimeline, fragments, preprocessedFragments, phonemizedFragmentsSubstitutions, phonemizedSentence }
|
|
231
|
+
return { referenceSynthesizedAudio, referenceTimeline: clauseTimeline, fragments, preprocessedFragments, phonemizedFragmentsSubstitutions, phonemizedSentence }
|
|
161
232
|
}
|
|
162
233
|
|
|
163
|
-
export async function synthesizeFragments(fragments: string[], espeakOptions: EspeakOptions) {
|
|
234
|
+
export async function synthesizeFragments(fragments: string[], espeakOptions: EspeakOptions, callbacks: SynthesisCallbacks) {
|
|
164
235
|
espeakOptions = extendDeep(defaultEspeakOptions, espeakOptions)
|
|
165
236
|
|
|
166
237
|
const voice = espeakOptions.voice
|
|
167
238
|
|
|
168
|
-
const sampleRate =
|
|
239
|
+
const sampleRate = getSampleRate()
|
|
169
240
|
|
|
170
241
|
if (fragments.length === 0) {
|
|
171
242
|
return {
|
|
@@ -210,7 +281,7 @@ export async function synthesizeFragments(fragments: string[], espeakOptions: Es
|
|
|
210
281
|
}
|
|
211
282
|
}
|
|
212
283
|
|
|
213
|
-
const { rawAudio, events } = await synthesize(textWithMarkers, { ...espeakOptions, ssml: true })
|
|
284
|
+
const { rawAudio, events } = await synthesize(textWithMarkers, { ...espeakOptions, ssml: true }, callbacks)
|
|
214
285
|
|
|
215
286
|
// Add first marker if missing
|
|
216
287
|
if (fragments.length > 0) {
|
|
@@ -352,7 +423,7 @@ export async function synthesizeFragments(fragments: string[], espeakOptions: Es
|
|
|
352
423
|
continue
|
|
353
424
|
}
|
|
354
425
|
|
|
355
|
-
const wordReferencePhonemes =
|
|
426
|
+
const wordReferencePhonemes = textToPhonemes(wordEntry.text, espeakOptions.voice, true).split('_')
|
|
356
427
|
|
|
357
428
|
const wordReferenceIPA = wordReferencePhonemes.join(' ')
|
|
358
429
|
|
|
@@ -449,8 +520,8 @@ export async function synthesizeFragments(fragments: string[], espeakOptions: Es
|
|
|
449
520
|
return { rawAudio, timeline: clauseTimeline, events }
|
|
450
521
|
}
|
|
451
522
|
|
|
452
|
-
export async function synthesize(text: string, espeakOptions: EspeakOptions) {
|
|
453
|
-
const logger = new Logger()
|
|
523
|
+
export async function synthesize(text: string, espeakOptions: EspeakOptions, callbacks: SynthesisCallbacks) {
|
|
524
|
+
const logger = new Logger(callbacks.logLevel)
|
|
454
525
|
|
|
455
526
|
espeakOptions = extendDeep(defaultEspeakOptions, espeakOptions)
|
|
456
527
|
|
|
@@ -460,7 +531,7 @@ export async function synthesize(text: string, espeakOptions: EspeakOptions) {
|
|
|
460
531
|
text = escapeHtml(text)
|
|
461
532
|
}
|
|
462
533
|
|
|
463
|
-
const { instance } = await getEspeakInstance()
|
|
534
|
+
const { instance } = await getEspeakInstance(callbacks)
|
|
464
535
|
|
|
465
536
|
const sampleChunks: Float32Array[] = []
|
|
466
537
|
const allEvents: EspeakEvent[] = []
|
|
@@ -468,14 +539,14 @@ export async function synthesize(text: string, espeakOptions: EspeakOptions) {
|
|
|
468
539
|
logger.start('Synthesize with eSpeak')
|
|
469
540
|
|
|
470
541
|
if (espeakOptions.useKlatt) {
|
|
471
|
-
|
|
542
|
+
setVoice(`${espeakOptions.voice}+klatt6`)
|
|
472
543
|
} else {
|
|
473
|
-
|
|
544
|
+
setVoice(espeakOptions.voice)
|
|
474
545
|
}
|
|
475
546
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
547
|
+
setRate(espeakOptions.rate)
|
|
548
|
+
setPitch(espeakOptions.pitch)
|
|
549
|
+
setPitchRange(espeakOptions.pitchRange)
|
|
479
550
|
|
|
480
551
|
instance.synthesize(text, (samples: Int16Array, events: EspeakEvent[]) => {
|
|
481
552
|
if (samples && samples.length > 0) {
|
|
@@ -501,22 +572,24 @@ export async function synthesize(text: string, espeakOptions: EspeakOptions) {
|
|
|
501
572
|
return { rawAudio, events: allEvents }
|
|
502
573
|
}
|
|
503
574
|
|
|
504
|
-
export
|
|
505
|
-
|
|
575
|
+
export function textToIPA(text: string, voice: string) {
|
|
576
|
+
errorIfEspeakInstanceNotLoaded()
|
|
577
|
+
|
|
578
|
+
setVoice(voice)
|
|
506
579
|
|
|
507
|
-
const
|
|
508
|
-
const ipa: string = (instance.synthesize_ipa(text).ipa as string).trim()
|
|
580
|
+
const ipa: string = (espeakInstance.synthesize_ipa(text).ipa as string).trim()
|
|
509
581
|
|
|
510
582
|
return ipa
|
|
511
583
|
}
|
|
512
584
|
|
|
513
|
-
export
|
|
514
|
-
|
|
585
|
+
export function textToPhonemes(text: string, voice: string, useIPA = true) {
|
|
586
|
+
errorIfEspeakInstanceNotLoaded()
|
|
515
587
|
|
|
516
|
-
|
|
517
|
-
const textPtr = instance.convert_to_phonemes(text, useIPA)
|
|
588
|
+
setVoice(voice)
|
|
518
589
|
|
|
519
|
-
const
|
|
590
|
+
const textPtr = espeakInstance.convert_to_phonemes(text, useIPA)
|
|
591
|
+
|
|
592
|
+
const wasmHeap = wrapEmscriptenModuleHeap(espeakModule)
|
|
520
593
|
|
|
521
594
|
const resultRef = wasmHeap.wrapNullTerminatedUtf8String(textPtr.ptr)
|
|
522
595
|
const result = resultRef.value
|
|
@@ -527,46 +600,46 @@ export async function textToPhonemes(text: string, voice: string, useIPA = true)
|
|
|
527
600
|
}
|
|
528
601
|
|
|
529
602
|
let lastVoiceId: string | undefined
|
|
530
|
-
export
|
|
531
|
-
|
|
603
|
+
export function setVoice(voiceId: string) {
|
|
604
|
+
errorIfEspeakInstanceNotLoaded()
|
|
532
605
|
|
|
533
606
|
if (voiceId !== lastVoiceId) {
|
|
534
|
-
|
|
607
|
+
espeakInstance.set_voice(voiceId)
|
|
535
608
|
|
|
536
609
|
lastVoiceId = voiceId
|
|
537
610
|
}
|
|
538
611
|
}
|
|
539
612
|
|
|
540
|
-
export
|
|
541
|
-
|
|
613
|
+
export function setVolume(volume: number) {
|
|
614
|
+
errorIfEspeakInstanceNotLoaded()
|
|
542
615
|
|
|
543
|
-
return
|
|
616
|
+
return espeakInstance.setVolume(volume)
|
|
544
617
|
}
|
|
545
618
|
|
|
546
619
|
export async function setRate(rate: number) {
|
|
547
|
-
|
|
620
|
+
errorIfEspeakInstanceNotLoaded()
|
|
548
621
|
|
|
549
|
-
return
|
|
622
|
+
return espeakInstance.set_rate(rate)
|
|
550
623
|
}
|
|
551
624
|
|
|
552
625
|
export async function setPitch(pitch: number) {
|
|
553
|
-
|
|
626
|
+
errorIfEspeakInstanceNotLoaded()
|
|
554
627
|
|
|
555
|
-
return
|
|
628
|
+
return espeakInstance.set_pitch(pitch)
|
|
556
629
|
}
|
|
557
630
|
|
|
558
631
|
export async function setPitchRange(pitchRange: number) {
|
|
559
|
-
|
|
632
|
+
errorIfEspeakInstanceNotLoaded()
|
|
560
633
|
|
|
561
|
-
return
|
|
634
|
+
return espeakInstance.set_range(pitchRange)
|
|
562
635
|
}
|
|
563
636
|
|
|
564
|
-
export
|
|
637
|
+
export function getSampleRate(): 22050 {
|
|
565
638
|
return 22050
|
|
566
639
|
}
|
|
567
640
|
|
|
568
|
-
export async function listVoices() {
|
|
569
|
-
const { instance } = await getEspeakInstance()
|
|
641
|
+
export async function listVoices(callbacks: OperationCallbacks) {
|
|
642
|
+
const { instance } = await getEspeakInstance(callbacks)
|
|
570
643
|
|
|
571
644
|
const voiceList: {
|
|
572
645
|
identifier: string,
|
|
@@ -580,9 +653,19 @@ export async function listVoices() {
|
|
|
580
653
|
return voiceList
|
|
581
654
|
}
|
|
582
655
|
|
|
583
|
-
|
|
656
|
+
function errorIfEspeakInstanceNotLoaded() {
|
|
584
657
|
if (!espeakInstance) {
|
|
585
|
-
|
|
658
|
+
throw new Error(`Espeak instance has not been initialized.`)
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
async function getEspeakInstance(callbacks: OperationCallbacks) {
|
|
663
|
+
if (!espeakInstance) {
|
|
664
|
+
const packagePath = await loadPackage('espeak-ng-emscripten', callbacks)
|
|
665
|
+
const normalizedModulePath = resolvePath(packagePath, 'espeak-ng.js')
|
|
666
|
+
const modulePathAsFileUrl = pathToFileUrl(normalizedModulePath).href
|
|
667
|
+
|
|
668
|
+
const { default: EspeakInitializer } = await import(modulePathAsFileUrl)
|
|
586
669
|
|
|
587
670
|
const m = await EspeakInitializer()
|
|
588
671
|
espeakInstance = await (new m.eSpeakNGWorker())
|
|
@@ -592,6 +675,10 @@ async function getEspeakInstance() {
|
|
|
592
675
|
return { instance: espeakInstance, module: espeakModule }
|
|
593
676
|
}
|
|
594
677
|
|
|
678
|
+
export async function ensureEspeakInstanceInitialized(callbacks: OperationCallbacks) {
|
|
679
|
+
await getEspeakInstance(callbacks)
|
|
680
|
+
}
|
|
681
|
+
|
|
595
682
|
export type EspeakEventType = 'sentence' | 'word' | 'phoneme' | 'end' | 'mark' | 'play' | 'msg_terminated' | 'list_terminated' | 'samplerate'
|
|
596
683
|
|
|
597
684
|
export interface EspeakEvent {
|
|
@@ -622,8 +709,8 @@ export const defaultEspeakOptions: EspeakOptions = {
|
|
|
622
709
|
}
|
|
623
710
|
|
|
624
711
|
export async function testKirshenbaumPhonemization(text: string, language = 'en-us') {
|
|
625
|
-
const ipaPhonemizedSentence =
|
|
626
|
-
const kirshenbaumPhonemizedSentence =
|
|
712
|
+
const ipaPhonemizedSentence = phonemizeSentence(text, language).flatMap(clause => clause)
|
|
713
|
+
const kirshenbaumPhonemizedSentence = phonemizeSentence(text, language, undefined, false).flatMap(clause => clause)
|
|
627
714
|
|
|
628
715
|
const ipaFragments = ipaPhonemizedSentence.map(word => word.join(''))
|
|
629
716
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SynthesisVoice } from '../api/API.js'
|
|
1
|
+
import { SynthesisCallbacks, SynthesisVoice } from '../api/API.js'
|
|
2
2
|
import { decodeWaveToRawAudio } from '../audio/AudioUtilities.js'
|
|
3
3
|
import { Logger } from '../utilities/Logger.js'
|
|
4
4
|
import { getRandomHexString, logToStderr, resolveModuleMainPath } from '../utilities/Utilities.js'
|
|
@@ -11,8 +11,8 @@ export type FliteVoiceName = 'kal' | 'kal16' | 'awb' | 'rms' | 'slt' | string
|
|
|
11
11
|
|
|
12
12
|
let fliteModuleObject: WebAssembly.Module
|
|
13
13
|
|
|
14
|
-
export async function synthesize(text: string, voice: FliteVoiceName, voiceDir: string | undefined, rate: number, pitchMeanHz
|
|
15
|
-
const logger = new Logger()
|
|
14
|
+
export async function synthesize(text: string, voice: FliteVoiceName, voiceDir: string | undefined, rate: number, pitchMeanHz: number | undefined, pitchStdDev: number | undefined, callbacks: SynthesisCallbacks) {
|
|
15
|
+
const logger = new Logger(callbacks.logLevel)
|
|
16
16
|
logger.start('Get Flite WASI instance')
|
|
17
17
|
|
|
18
18
|
const randomId = getRandomHexString(16)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defaultGnuSpeechOptions, GnuSpeechOptions, synthesize as gnuSpeechSynthesize } from '@echogarden/gnuspeech-wasm'
|
|
2
|
-
import { SynthesisVoice } from '../api/Synthesis.js'
|
|
2
|
+
import { SynthesisCallbacks, SynthesisVoice } from '../api/Synthesis.js'
|
|
3
3
|
import { decodeWaveToRawAudio } from '../audio/AudioUtilities.js'
|
|
4
4
|
import { extendDeep } from '../utilities/ObjectUtilities.js'
|
|
5
5
|
|
|
6
|
-
export async function synthesize(text: string, options: GnuSpeechOptions) {
|
|
6
|
+
export async function synthesize(text: string, options: GnuSpeechOptions, callbacks: SynthesisCallbacks) {
|
|
7
7
|
const gnuSpeechOptions = extendDeep(defaultGnuSpeechOptions, options)
|
|
8
8
|
|
|
9
9
|
const { audioData, params } = await gnuSpeechSynthesize(text, gnuSpeechOptions)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { request } from 'gaxios'
|
|
2
1
|
import { Logger } from '../utilities/Logger.js'
|
|
3
2
|
import { logToStderr } from '../utilities/Utilities.js'
|
|
4
3
|
import { decodeBase64 } from '../encodings/Base64.js'
|
|
5
4
|
import * as FFMpegTranscoder from '../codecs/FFMpegTranscoder.js'
|
|
5
|
+
import { requestHttp } from 'easier-http-request'
|
|
6
|
+
import { VoiceListRequestCallbacks, SynthesisCallbacks } from '../api/API.js'
|
|
6
7
|
|
|
7
8
|
const log = logToStderr
|
|
8
9
|
|
|
@@ -16,9 +17,10 @@ export async function synthesize(
|
|
|
16
17
|
volumeGainDecibels = 0.0,
|
|
17
18
|
ssml = false,
|
|
18
19
|
audioEncoding: AudioEncoding = 'MP3',
|
|
19
|
-
sampleRate = 24000
|
|
20
|
+
sampleRate = 24000,
|
|
21
|
+
callbacks: SynthesisCallbacks) {
|
|
20
22
|
|
|
21
|
-
const logger = new Logger()
|
|
23
|
+
const logger = new Logger(callbacks.logLevel)
|
|
22
24
|
logger.start('Request synthesis from Google Cloud')
|
|
23
25
|
|
|
24
26
|
const requestBody = {
|
|
@@ -49,7 +51,7 @@ export async function synthesize(
|
|
|
49
51
|
requestBody.input.text = text
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
const response = await
|
|
54
|
+
const response = await requestHttp({
|
|
53
55
|
method: 'POST',
|
|
54
56
|
|
|
55
57
|
url: `https://texttospeech.googleapis.com/v1beta1/text:synthesize`,
|
|
@@ -62,18 +64,25 @@ export async function synthesize(
|
|
|
62
64
|
'User-Agent': ''
|
|
63
65
|
},
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
body: requestBody,
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
abortSignal: callbacks?.abortSignal
|
|
68
70
|
})
|
|
69
71
|
|
|
72
|
+
const responseObject = await response.json()
|
|
73
|
+
|
|
70
74
|
logger.start('Parse result')
|
|
71
75
|
|
|
72
|
-
const result =
|
|
76
|
+
const result = parseResponseObject(responseObject)
|
|
73
77
|
|
|
74
78
|
logger.start('Decode to raw audio')
|
|
75
79
|
|
|
76
|
-
const rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
80
|
+
const rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
81
|
+
result.audioData,
|
|
82
|
+
undefined,
|
|
83
|
+
undefined,
|
|
84
|
+
{ abortSignal: callbacks.abortSignal, logLevel: 'warning' },
|
|
85
|
+
)
|
|
77
86
|
const timepoints = result.timepoints
|
|
78
87
|
|
|
79
88
|
logger.end()
|
|
@@ -81,7 +90,7 @@ export async function synthesize(
|
|
|
81
90
|
return { rawAudio, timepoints }
|
|
82
91
|
}
|
|
83
92
|
|
|
84
|
-
function
|
|
93
|
+
function parseResponseObject(responseBody: any) {
|
|
85
94
|
const audioData = decodeBase64(responseBody.audioContent)
|
|
86
95
|
const timepoints: timePoint[] = responseBody.timepoints
|
|
87
96
|
|
|
@@ -89,10 +98,10 @@ function parseResponseBody(responseBody: any) {
|
|
|
89
98
|
}
|
|
90
99
|
|
|
91
100
|
// Voices with audio samples: https://cloud.google.com/text-to-speech/docs/voices
|
|
92
|
-
export async function getVoiceList(apiKey: string) {
|
|
101
|
+
export async function getVoiceList(apiKey: string, callbacks: VoiceListRequestCallbacks) {
|
|
93
102
|
const requestURL = `https://texttospeech.googleapis.com/v1beta1/voices`
|
|
94
103
|
|
|
95
|
-
const response = await
|
|
104
|
+
const response = await requestHttp({
|
|
96
105
|
method: 'GET',
|
|
97
106
|
|
|
98
107
|
url: requestURL,
|
|
@@ -105,12 +114,12 @@ export async function getVoiceList(apiKey: string) {
|
|
|
105
114
|
'User-Agent': ''
|
|
106
115
|
},
|
|
107
116
|
|
|
108
|
-
|
|
117
|
+
abortSignal: callbacks?.abortSignal
|
|
109
118
|
})
|
|
110
119
|
|
|
111
|
-
const
|
|
120
|
+
const responseObject = await response.json()
|
|
112
121
|
|
|
113
|
-
const voices: GoogleCloudVoice[] =
|
|
122
|
+
const voices: GoogleCloudVoice[] = responseObject.voices
|
|
114
123
|
|
|
115
124
|
return voices
|
|
116
125
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { request } from 'gaxios'
|
|
2
1
|
import { Phrase, splitToFragments } from '../nlp/Segmentation.js'
|
|
3
2
|
import { concatFloat32Arrays, concatUint8Arrays, logToStderr } from '../utilities/Utilities.js'
|
|
4
3
|
import * as FFMpegTranscoder from '../codecs/FFMpegTranscoder.js'
|
|
@@ -8,17 +7,18 @@ import { Timeline } from '../utilities/Timeline.js'
|
|
|
8
7
|
import { getShortLanguageCode } from '../utilities/Locale.js'
|
|
9
8
|
import { getChromeOnWindowsHeaders } from '../utilities/BrowserRequestHeaders.js'
|
|
10
9
|
import { decodeBase64 } from '../encodings/Base64.js'
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
import { requestHttp } from 'easier-http-request'
|
|
11
|
+
import { SynthesisCallbacks } from '../api/API.js'
|
|
13
12
|
|
|
14
13
|
const maxTextLengthPerRequest = 200
|
|
15
14
|
|
|
16
|
-
export async function synthesizeLongText(text: string, languageCode = 'en', tld = 'us', sentenceEndPause = 0.75, segmentEndPause = 1.0) {
|
|
15
|
+
export async function synthesizeLongText(text: string, languageCode = 'en', tld = 'us', sentenceEndPause = 0.75, segmentEndPause = 1.0, callbacks: SynthesisCallbacks) {
|
|
17
16
|
if (text.length == 0) {
|
|
18
17
|
throw new Error('Text is empty')
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
const logger = new Logger()
|
|
20
|
+
const logger = new Logger(callbacks.logLevel)
|
|
21
|
+
|
|
22
22
|
logger.start('Prepare and split text')
|
|
23
23
|
|
|
24
24
|
const fragments = await splitToFragments(text, maxTextLengthPerRequest, languageCode)
|
|
@@ -32,13 +32,19 @@ export async function synthesizeLongText(text: string, languageCode = 'en', tld
|
|
|
32
32
|
const fragment = fragments[i]
|
|
33
33
|
|
|
34
34
|
logger.start(`Request synthesis for text fragment ${i + 1}/${fragments.length} from Google Translate`)
|
|
35
|
-
const fragmentMp3Stream = await synthesizeShortText(fragment.text, languageCode, tld)
|
|
35
|
+
const fragmentMp3Stream = await synthesizeShortText(fragment.text, languageCode, tld, callbacks)
|
|
36
36
|
|
|
37
37
|
if (fragmentMp3Stream.length == 0) {
|
|
38
38
|
continue
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
const rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
41
|
+
const rawAudio = await FFMpegTranscoder.decodeToChannels(
|
|
42
|
+
fragmentMp3Stream,
|
|
43
|
+
24000,
|
|
44
|
+
1,
|
|
45
|
+
{ abortSignal: callbacks.abortSignal, logLevel: 'warning' }
|
|
46
|
+
)
|
|
47
|
+
|
|
42
48
|
fragmentsSampleRate = rawAudio.sampleRate
|
|
43
49
|
|
|
44
50
|
let targetEndingSilenceTime: number
|
|
@@ -76,7 +82,7 @@ export async function synthesizeLongText(text: string, languageCode = 'en', tld
|
|
|
76
82
|
}
|
|
77
83
|
}
|
|
78
84
|
|
|
79
|
-
export async function synthesizeShortText(text: string, languageCode = 'en', tld = 'us') {
|
|
85
|
+
export async function synthesizeShortText(text: string, languageCode = 'en', tld = 'us', callbacks: SynthesisCallbacks) {
|
|
80
86
|
if (text.length > maxTextLengthPerRequest) {
|
|
81
87
|
throw new Error(`Text is ${text.length} characters, which is longer than the maximum of ${maxTextLengthPerRequest}`)
|
|
82
88
|
}
|
|
@@ -90,7 +96,7 @@ export async function synthesizeShortText(text: string, languageCode = 'en', tld
|
|
|
90
96
|
const stringifiedForm = JSON.stringify(requestForm)
|
|
91
97
|
const requestBody = `f.req=${encodeURIComponent(stringifiedForm)}&`
|
|
92
98
|
|
|
93
|
-
const response = await
|
|
99
|
+
const response = await requestHttp({
|
|
94
100
|
method: 'POST',
|
|
95
101
|
|
|
96
102
|
url: `https://translate.google.${tld}/_/TranslateWebserverUi/data/batchexecute`,
|
|
@@ -109,14 +115,16 @@ export async function synthesizeShortText(text: string, languageCode = 'en', tld
|
|
|
109
115
|
|
|
110
116
|
body: requestBody,
|
|
111
117
|
|
|
112
|
-
|
|
118
|
+
abortSignal: callbacks?.abortSignal,
|
|
113
119
|
})
|
|
114
120
|
|
|
121
|
+
const responseBody = await response.text()
|
|
122
|
+
|
|
115
123
|
//log(response.data)
|
|
116
124
|
|
|
117
125
|
const audioChunks: Uint8Array[] = []
|
|
118
126
|
|
|
119
|
-
for (const line of
|
|
127
|
+
for (const line of responseBody.split(/\r?\n/)) {
|
|
120
128
|
const match = line.match(/"jQ1olc","\[\\"(.*)\\"]/)
|
|
121
129
|
|
|
122
130
|
if (match != null) {
|