echogarden 0.12.2 → 1.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/README.md +15 -14
- package/data/schemas/options.json +398 -111
- package/dist/alignment/DTWMfccSequenceAlignment.d.ts +1 -1
- package/dist/alignment/DTWMfccSequenceAlignment.js +8 -8
- package/dist/alignment/DTWSequenceAlignment.d.ts +1 -1
- package/dist/alignment/DTWSequenceAlignment.js +1 -1
- package/dist/alignment/DTWSequenceAlignmentWindowed.d.ts +1 -1
- package/dist/alignment/DTWSequenceAlignmentWindowed.js +2 -2
- package/dist/alignment/LevenshteinSequenceAlignment.d.ts +1 -1
- package/dist/alignment/LevenshteinSequenceAlignment.js +1 -1
- package/dist/alignment/SpeechAlignment.d.ts +11 -6
- package/dist/alignment/SpeechAlignment.js +113 -71
- package/dist/alignment/SpeechAlignment.js.map +1 -1
- package/dist/api/API.d.ts +13 -12
- package/dist/api/API.js +14 -13
- package/dist/api/API.js.map +1 -1
- package/dist/api/APIOptions.d.ts +5 -4
- package/dist/api/Alignment.d.ts +15 -9
- package/dist/api/Alignment.js +92 -74
- package/dist/api/Alignment.js.map +1 -1
- package/dist/api/Common.js +1 -1
- package/dist/api/Denoising.d.ts +6 -6
- package/dist/api/Denoising.js +23 -23
- package/dist/api/Denoising.js.map +1 -1
- package/dist/api/LanguageDetection.d.ts +19 -12
- package/dist/api/LanguageDetection.js +88 -38
- package/dist/api/LanguageDetection.js.map +1 -1
- package/dist/api/Recognition.d.ts +16 -6
- package/dist/api/Recognition.js +129 -55
- package/dist/api/Recognition.js.map +1 -1
- package/dist/api/SourceSeparation.d.ts +17 -0
- package/dist/api/SourceSeparation.js +61 -0
- package/dist/api/SourceSeparation.js.map +1 -0
- package/dist/api/Synthesis.d.ts +18 -18
- package/dist/api/Synthesis.js +191 -164
- package/dist/api/Synthesis.js.map +1 -1
- package/dist/api/Translation.d.ts +19 -8
- package/dist/api/Translation.js +132 -35
- package/dist/api/Translation.js.map +1 -1
- package/dist/api/Vad.d.ts +10 -5
- package/dist/api/Vad.js +76 -38
- package/dist/api/Vad.js.map +1 -1
- package/dist/audio/AudioBufferConversion.d.ts +1 -1
- package/dist/audio/AudioBufferConversion.js +4 -4
- package/dist/audio/AudioPlayer.d.ts +1 -1
- package/dist/audio/AudioPlayer.js +26 -26
- package/dist/audio/AudioPlayer.js.map +1 -1
- package/dist/audio/AudioRecorder.d.ts +1 -1
- package/dist/audio/AudioRecorder.js +5 -5
- package/dist/audio/AudioUtilities.d.ts +13 -9
- package/dist/audio/AudioUtilities.js +86 -24
- package/dist/audio/AudioUtilities.js.map +1 -1
- package/dist/cli/CLI.d.ts +3 -3
- package/dist/cli/CLI.js +271 -162
- package/dist/cli/CLI.js.map +1 -1
- package/dist/cli/CLIConfigFile.js +8 -8
- package/dist/cli/CLILauncher.js +6 -6
- package/dist/cli/CLIOptionsSchema.js +2 -2
- package/dist/cli/CLIParser.js +5 -5
- package/dist/cli/CLIStarter.js +4 -4
- package/dist/codecs/FFMpegTranscoder.d.ts +2 -2
- package/dist/codecs/FFMpegTranscoder.js +37 -37
- package/dist/codecs/FFMpegTranscoder.js.map +1 -1
- package/dist/codecs/TIMITCodec.js +5 -5
- package/dist/codecs/WaveCodec.d.ts +1 -1
- package/dist/codecs/WaveCodec.js +22 -22
- package/dist/denoising/RNNoise.d.ts +1 -1
- package/dist/denoising/RNNoise.js +9 -9
- package/dist/dsp/BiquadFilter.d.ts +3 -2
- package/dist/dsp/BiquadFilter.js +18 -11
- package/dist/dsp/BiquadFilter.js.map +1 -1
- package/dist/dsp/DecayingPeakEstimator.d.ts +16 -0
- package/dist/dsp/DecayingPeakEstimator.js +23 -0
- package/dist/dsp/DecayingPeakEstimator.js.map +1 -0
- package/dist/dsp/FFT.d.ts +8 -4
- package/dist/dsp/FFT.js +76 -30
- package/dist/dsp/FFT.js.map +1 -1
- package/dist/dsp/KWeightingFilter.d.ts +9 -0
- package/dist/dsp/KWeightingFilter.js +40 -0
- package/dist/dsp/KWeightingFilter.js.map +1 -0
- package/dist/dsp/LoudnessEstimator.d.ts +21 -0
- package/dist/dsp/LoudnessEstimator.js +47 -0
- package/dist/dsp/LoudnessEstimator.js.map +1 -0
- package/dist/dsp/MFCC.d.ts +2 -2
- package/dist/dsp/MFCC.js +15 -15
- package/dist/dsp/MelSpectogram.d.ts +1 -1
- package/dist/dsp/MelSpectogram.js +6 -6
- package/dist/dsp/Rubberband.d.ts +11 -11
- package/dist/dsp/Rubberband.js +27 -27
- package/dist/dsp/Sonic.d.ts +1 -1
- package/dist/dsp/Sonic.js +3 -3
- package/dist/dsp/SpeexResampler.d.ts +1 -1
- package/dist/dsp/SpeexResampler.js +2 -2
- package/dist/math/VectorMath.d.ts +12 -8
- package/dist/math/VectorMath.js +35 -32
- package/dist/math/VectorMath.js.map +1 -1
- package/dist/nlp/ChineseSegmentation.js +2 -2
- package/dist/nlp/CompromiseNLP.js +3 -3
- package/dist/nlp/EspeakPhonemizer.js +30 -30
- package/dist/nlp/IPA.js +20 -20
- package/dist/nlp/JapaneseSegmentation.js +6 -6
- package/dist/nlp/Lexicon.d.ts +1 -1
- package/dist/nlp/Lexicon.js +7 -7
- package/dist/nlp/Segmentation.d.ts +3 -0
- package/dist/nlp/Segmentation.js +21 -14
- package/dist/nlp/Segmentation.js.map +1 -1
- package/dist/nlp/TextNormalizer.js +16 -16
- package/dist/recognition/AmazonTranscribeSTT.d.ts +2 -2
- package/dist/recognition/AmazonTranscribeSTT.js +13 -14
- package/dist/recognition/AmazonTranscribeSTT.js.map +1 -1
- package/dist/recognition/AzureCognitiveServicesSTT.js +5 -6
- package/dist/recognition/AzureCognitiveServicesSTT.js.map +1 -1
- package/dist/recognition/GoogleCloudSTT.d.ts +3 -3
- package/dist/recognition/GoogleCloudSTT.js +18 -18
- package/dist/recognition/OpenAICloudSTT.d.ts +19 -0
- package/dist/recognition/OpenAICloudSTT.js +81 -0
- package/dist/recognition/OpenAICloudSTT.js.map +1 -0
- package/dist/recognition/SileroSTT.d.ts +2 -2
- package/dist/recognition/SileroSTT.js +25 -25
- package/dist/recognition/VoskSTT.d.ts +2 -2
- package/dist/recognition/VoskSTT.js +8 -8
- package/dist/recognition/WhisperCppSTT.d.ts +88 -0
- package/dist/recognition/WhisperCppSTT.js +332 -0
- package/dist/recognition/WhisperCppSTT.js.map +1 -0
- package/dist/recognition/WhisperSTT.d.ts +49 -25
- package/dist/recognition/WhisperSTT.js +626 -481
- package/dist/recognition/WhisperSTT.js.map +1 -1
- package/dist/server/Client.d.ts +1 -1
- package/dist/server/Client.js +22 -22
- package/dist/server/Server.js +9 -9
- package/dist/server/Server.js.map +1 -1
- package/dist/server/Worker.d.ts +22 -22
- package/dist/server/Worker.js +36 -36
- package/dist/server/Worker.js.map +1 -1
- package/dist/server/WorkerStarter.js +2 -2
- package/dist/source-separation/MDXNetSourceSeparation.d.ts +11 -0
- package/dist/source-separation/MDXNetSourceSeparation.js +161 -0
- package/dist/source-separation/MDXNetSourceSeparation.js.map +1 -0
- package/dist/speech-language-detection/SileroLanguageDetection.d.ts +1 -1
- package/dist/speech-language-detection/SileroLanguageDetection.js +7 -7
- package/dist/subtitles/Subtitles.d.ts +10 -0
- package/dist/subtitles/Subtitles.js +2 -2
- package/dist/subtitles/Subtitles.js.map +1 -1
- package/dist/synthesis/AwsPollyTTS.d.ts +1 -1
- package/dist/synthesis/AwsPollyTTS.js +12 -12
- package/dist/synthesis/AzureCognitiveServicesTTS.js +7 -7
- package/dist/synthesis/CoquiServerTTS.js +10 -10
- package/dist/synthesis/CoquiServerTTS.js.map +1 -1
- package/dist/synthesis/ElevenlabsTTS.d.ts +23 -0
- package/dist/synthesis/ElevenlabsTTS.js +103 -0
- package/dist/synthesis/ElevenlabsTTS.js.map +1 -0
- package/dist/synthesis/EspeakTTS.d.ts +6 -5
- package/dist/synthesis/EspeakTTS.js +81 -69
- package/dist/synthesis/EspeakTTS.js.map +1 -1
- package/dist/synthesis/FliteTTS.d.ts +3 -3
- package/dist/synthesis/FliteTTS.js +154 -154
- package/dist/synthesis/FliteTTS.js.map +1 -1
- package/dist/synthesis/GoogleCloudTTS.d.ts +3 -3
- package/dist/synthesis/GoogleCloudTTS.js +17 -17
- package/dist/synthesis/GoogleCloudTTS.js.map +1 -1
- package/dist/synthesis/GoogleTranslateTTS.d.ts +1 -1
- package/dist/synthesis/GoogleTranslateTTS.js +103 -103
- package/dist/synthesis/MicrosoftEdgeTTS.d.ts +2 -2
- package/dist/synthesis/MicrosoftEdgeTTS.js +74 -74
- package/dist/synthesis/OpenAICloudTTS.d.ts +13 -0
- package/dist/synthesis/OpenAICloudTTS.js +169 -0
- package/dist/synthesis/OpenAICloudTTS.js.map +1 -0
- package/dist/synthesis/SamTTS.js +3 -3
- package/dist/synthesis/SapiTTS.d.ts +3 -3
- package/dist/synthesis/SapiTTS.js +26 -26
- package/dist/synthesis/StreamlabsPollyTTS.d.ts +2 -2
- package/dist/synthesis/StreamlabsPollyTTS.js +27 -27
- package/dist/synthesis/SvoxPicoTTS.d.ts +2 -2
- package/dist/synthesis/SvoxPicoTTS.js +65 -65
- package/dist/synthesis/SvoxPicoTTS.js.map +1 -1
- package/dist/synthesis/VitsTTS.d.ts +3 -3
- package/dist/synthesis/VitsTTS.js +378 -378
- package/dist/synthesis/VitsTTS.js.map +1 -1
- package/dist/tests/Test.js +2 -2
- package/dist/utilities/Compression.d.ts +5 -0
- package/dist/utilities/Compression.js +29 -13
- package/dist/utilities/Compression.js.map +1 -1
- package/dist/utilities/FileDownloader.d.ts +1 -1
- package/dist/utilities/FileDownloader.js +16 -16
- package/dist/utilities/FileSystem.js +7 -7
- package/dist/utilities/Locale.d.ts +7 -7
- package/dist/utilities/Locale.js +15 -15
- package/dist/utilities/Logger.js +3 -3
- package/dist/utilities/ObjectUtilities.js +19 -19
- package/dist/utilities/OpenPromise.js +2 -2
- package/dist/utilities/OpenPromise.js.map +1 -1
- package/dist/utilities/PackageManager.js +31 -0
- package/dist/utilities/PackageManager.js.map +1 -1
- package/dist/utilities/PathUtilities.js +8 -8
- package/dist/utilities/RandomGenerator.js +2 -2
- package/dist/utilities/SmoothEstimator.d.ts +8 -0
- package/dist/utilities/SmoothEstimator.js +25 -0
- package/dist/utilities/SmoothEstimator.js.map +1 -0
- package/dist/utilities/TarballMaker.js +8 -8
- package/dist/utilities/Timeline.d.ts +3 -2
- package/dist/utilities/Timeline.js +11 -11
- package/dist/utilities/Timeline.js.map +1 -1
- package/dist/utilities/Timer.js +4 -4
- package/dist/utilities/Utilities.d.ts +4 -0
- package/dist/utilities/Utilities.js +38 -15
- package/dist/utilities/Utilities.js.map +1 -1
- package/dist/utilities/WasmMemoryManager.js +7 -7
- package/dist/utilities/WebReader.js +23 -23
- package/dist/utilities/WikipediaReader.js +2 -2
- package/dist/voice-activity-detection/AdaptiveGateVAD.d.ts +28 -0
- package/dist/voice-activity-detection/AdaptiveGateVAD.js +138 -0
- package/dist/voice-activity-detection/AdaptiveGateVAD.js.map +1 -0
- package/dist/voice-activity-detection/SileroVAD.d.ts +1 -1
- package/dist/voice-activity-detection/SileroVAD.js +5 -5
- package/dist/voice-activity-detection/SileroVAD.js.map +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.d.ts +1 -1
- package/dist/voice-activity-detection/WebRtcVAD.js +4 -4
- package/docs/API.md +29 -11
- package/docs/CLI.md +31 -7
- package/docs/Contributing.md +38 -0
- package/docs/Development.md +91 -19
- package/docs/Engines.md +28 -16
- package/docs/Licenses.md +4 -1
- package/docs/Options.md +159 -79
- package/docs/Releases.md +262 -0
- package/docs/Server.md +7 -7
- package/docs/Tasklist.md +96 -76
- package/docs/Technical.md +4 -4
- package/package.json +13 -14
- package/src/alignment/DTWMfccSequenceAlignment.ts +9 -9
- package/src/alignment/DTWSequenceAlignment.ts +2 -2
- package/src/alignment/DTWSequenceAlignmentWindowed.ts +3 -3
- package/src/alignment/LevenshteinSequenceAlignment.ts +2 -2
- package/src/alignment/SpeechAlignment.ts +195 -86
- package/src/api/API.ts +14 -13
- package/src/api/APIOptions.ts +12 -11
- package/src/api/Alignment.ts +148 -92
- package/src/api/Common.ts +1 -1
- package/src/api/Denoising.ts +28 -28
- package/src/api/LanguageDetection.ts +135 -48
- package/src/api/Recognition.ts +198 -59
- package/src/api/SourceSeparation.ts +99 -0
- package/src/api/Synthesis.ts +217 -181
- package/src/api/Translation.ts +193 -40
- package/src/api/Vad.ts +110 -41
- package/src/audio/AudioBufferConversion.ts +4 -4
- package/src/audio/AudioPlayer.ts +27 -27
- package/src/audio/AudioRecorder.ts +5 -5
- package/src/audio/AudioUtilities.ts +107 -24
- package/src/cli/CLI.ts +313 -164
- package/src/cli/CLIConfigFile.ts +8 -8
- package/src/cli/CLILauncher.ts +6 -6
- package/src/cli/CLIOptionsSchema.ts +2 -2
- package/src/cli/CLIParser.ts +5 -5
- package/src/cli/CLIStarter.ts +4 -4
- package/src/codecs/FFMpegTranscoder.ts +38 -38
- package/src/codecs/TIMITCodec.ts +5 -5
- package/src/codecs/WaveCodec.ts +22 -22
- package/src/denoising/RNNoise.ts +9 -9
- package/src/dsp/BiquadFilter.ts +19 -11
- package/src/dsp/DecayingPeakEstimator.ts +35 -0
- package/src/dsp/FFT.ts +103 -35
- package/src/dsp/KWeightingFilter.ts +43 -0
- package/src/dsp/LoudnessEstimator.ts +74 -0
- package/src/dsp/MFCC.ts +15 -15
- package/src/dsp/MelSpectogram.ts +7 -7
- package/src/dsp/Rubberband.ts +38 -38
- package/src/dsp/Sonic.ts +4 -4
- package/src/dsp/SpeexResampler.ts +2 -2
- package/src/math/VectorMath.ts +42 -33
- package/src/nlp/ChineseSegmentation.ts +3 -3
- package/src/nlp/CompromiseNLP.ts +3 -3
- package/src/nlp/EspeakPhonemizer.ts +30 -30
- package/src/nlp/IPA.ts +20 -20
- package/src/nlp/JapaneseSegmentation.ts +6 -6
- package/src/nlp/Lexicon.ts +8 -8
- package/src/nlp/Segmentation.ts +23 -14
- package/src/nlp/TextNormalizer.ts +16 -16
- package/src/recognition/AmazonTranscribeSTT.ts +16 -17
- package/src/recognition/AzureCognitiveServicesSTT.ts +8 -6
- package/src/recognition/GoogleCloudSTT.ts +21 -21
- package/src/recognition/OpenAICloudSTT.ts +142 -0
- package/src/recognition/SileroSTT.ts +26 -26
- package/src/recognition/VoskSTT.ts +10 -10
- package/src/recognition/WhisperCppSTT.ts +555 -0
- package/src/recognition/WhisperSTT.ts +760 -507
- package/src/server/Client.ts +23 -23
- package/src/server/Server.ts +9 -9
- package/src/server/Worker.ts +53 -53
- package/src/server/WorkerStarter.ts +2 -2
- package/src/source-separation/MDXNetSourceSeparation.ts +228 -0
- package/src/speech-language-detection/SileroLanguageDetection.ts +8 -8
- package/src/subtitles/Subtitles.ts +3 -3
- package/src/synthesis/AwsPollyTTS.ts +14 -14
- package/src/synthesis/AzureCognitiveServicesTTS.ts +10 -10
- package/src/synthesis/CoquiServerTTS.ts +10 -10
- package/src/synthesis/ElevenlabsTTS.ts +137 -0
- package/src/synthesis/EspeakTTS.ts +90 -71
- package/src/synthesis/FliteTTS.ts +157 -157
- package/src/synthesis/GoogleCloudTTS.ts +19 -19
- package/src/synthesis/GoogleTranslateTTS.ts +104 -104
- package/src/synthesis/MicrosoftEdgeTTS.ts +80 -80
- package/src/synthesis/OpenAICloudTTS.ts +196 -0
- package/src/synthesis/SamTTS.ts +3 -3
- package/src/synthesis/SapiTTS.ts +29 -29
- package/src/synthesis/StreamlabsPollyTTS.ts +29 -29
- package/src/synthesis/SvoxPicoTTS.ts +67 -67
- package/src/synthesis/VitsTTS.ts +380 -380
- package/src/tests/Test.ts +4 -4
- package/src/utilities/Compression.ts +34 -13
- package/src/utilities/FileDownloader.ts +19 -19
- package/src/utilities/FileSystem.ts +7 -7
- package/src/utilities/Locale.ts +22 -22
- package/src/utilities/Logger.ts +4 -4
- package/src/utilities/ObjectUtilities.ts +19 -19
- package/src/utilities/OpenPromise.ts +2 -2
- package/src/utilities/PackageManager.ts +40 -0
- package/src/utilities/PathUtilities.ts +8 -8
- package/src/utilities/RandomGenerator.ts +3 -3
- package/src/utilities/SmoothEstimator.ts +35 -0
- package/src/utilities/TarballMaker.ts +9 -9
- package/src/utilities/Timeline.ts +15 -13
- package/src/utilities/Timer.ts +4 -4
- package/src/utilities/Utilities.ts +49 -15
- package/src/utilities/WasmMemoryManager.ts +7 -7
- package/src/utilities/WebReader.ts +23 -23
- package/src/utilities/WikipediaReader.ts +2 -2
- package/src/voice-activity-detection/AdaptiveGateVAD.ts +202 -0
- package/src/voice-activity-detection/SileroVAD.ts +5 -5
- package/src/voice-activity-detection/WebRtcVAD.ts +5 -5
- package/dist/synthesis/ElevenLabsTTS.d.ts +0 -8
- package/dist/synthesis/ElevenLabsTTS.js +0 -82
- package/dist/synthesis/ElevenLabsTTS.js.map +0 -1
- package/src/synthesis/ElevenLabsTTS.ts +0 -104
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { ensureRawAudio } from '../audio/AudioUtilities.js';
|
|
2
|
+
import { Logger } from '../utilities/Logger.js';
|
|
3
|
+
import { extendDeep } from '../utilities/ObjectUtilities.js';
|
|
4
|
+
export async function synthesize(text, voice, speed, options) {
|
|
5
|
+
const logger = new Logger();
|
|
6
|
+
logger.start('Request synthesis from OpenAI Cloud API');
|
|
7
|
+
options = extendDeep(defaultOpenAICloudTTSOptions, options);
|
|
8
|
+
if (!options.apiKey) {
|
|
9
|
+
throw new Error(`No API key given`);
|
|
10
|
+
}
|
|
11
|
+
const { default: OpenAI } = await import('openai');
|
|
12
|
+
const openai = new OpenAI(options);
|
|
13
|
+
const result = await openai.audio.speech.create({
|
|
14
|
+
input: text,
|
|
15
|
+
model: options.model,
|
|
16
|
+
voice: voice,
|
|
17
|
+
response_format: 'opus',
|
|
18
|
+
speed,
|
|
19
|
+
}, {
|
|
20
|
+
maxRetries: 10
|
|
21
|
+
});
|
|
22
|
+
const resultBuffer = await result.buffer();
|
|
23
|
+
logger.start('Decode returned audio');
|
|
24
|
+
const resultRawAudio = ensureRawAudio(resultBuffer);
|
|
25
|
+
logger.end();
|
|
26
|
+
return resultRawAudio;
|
|
27
|
+
}
|
|
28
|
+
export const defaultOpenAICloudTTSOptions = {
|
|
29
|
+
apiKey: undefined,
|
|
30
|
+
organization: undefined,
|
|
31
|
+
baseURL: undefined,
|
|
32
|
+
model: 'tts-1',
|
|
33
|
+
timeout: undefined,
|
|
34
|
+
maxRetries: 10,
|
|
35
|
+
};
|
|
36
|
+
export const supportedLanguages = [
|
|
37
|
+
'en',
|
|
38
|
+
'zh',
|
|
39
|
+
'de',
|
|
40
|
+
'es',
|
|
41
|
+
'ru',
|
|
42
|
+
'ko',
|
|
43
|
+
'fr',
|
|
44
|
+
'ja',
|
|
45
|
+
'pt',
|
|
46
|
+
'tr',
|
|
47
|
+
'pl',
|
|
48
|
+
'ca',
|
|
49
|
+
'nl',
|
|
50
|
+
'ar',
|
|
51
|
+
'sv',
|
|
52
|
+
'it',
|
|
53
|
+
'id',
|
|
54
|
+
'hi',
|
|
55
|
+
'fi',
|
|
56
|
+
'vi',
|
|
57
|
+
'iw',
|
|
58
|
+
'uk',
|
|
59
|
+
'el',
|
|
60
|
+
'ms',
|
|
61
|
+
'cs',
|
|
62
|
+
'ro',
|
|
63
|
+
'da',
|
|
64
|
+
'hu',
|
|
65
|
+
'ta',
|
|
66
|
+
'no',
|
|
67
|
+
'th',
|
|
68
|
+
'ur',
|
|
69
|
+
'hr',
|
|
70
|
+
'bg',
|
|
71
|
+
'lt',
|
|
72
|
+
'la',
|
|
73
|
+
'mi',
|
|
74
|
+
'ml',
|
|
75
|
+
'cy',
|
|
76
|
+
'sk',
|
|
77
|
+
'te',
|
|
78
|
+
'fa',
|
|
79
|
+
'lv',
|
|
80
|
+
'bn',
|
|
81
|
+
'sr',
|
|
82
|
+
'az',
|
|
83
|
+
'sl',
|
|
84
|
+
'kn',
|
|
85
|
+
'et',
|
|
86
|
+
'mk',
|
|
87
|
+
'br',
|
|
88
|
+
'eu',
|
|
89
|
+
'is',
|
|
90
|
+
'hy',
|
|
91
|
+
'ne',
|
|
92
|
+
'mn',
|
|
93
|
+
'bs',
|
|
94
|
+
'kk',
|
|
95
|
+
'sq',
|
|
96
|
+
'sw',
|
|
97
|
+
'gl',
|
|
98
|
+
'mr',
|
|
99
|
+
'pa',
|
|
100
|
+
'si',
|
|
101
|
+
'km',
|
|
102
|
+
'sn',
|
|
103
|
+
'yo',
|
|
104
|
+
'so',
|
|
105
|
+
'af',
|
|
106
|
+
'oc',
|
|
107
|
+
'ka',
|
|
108
|
+
'be',
|
|
109
|
+
'tg',
|
|
110
|
+
'sd',
|
|
111
|
+
'gu',
|
|
112
|
+
'am',
|
|
113
|
+
'yi',
|
|
114
|
+
'lo',
|
|
115
|
+
'uz',
|
|
116
|
+
'fo',
|
|
117
|
+
'ht',
|
|
118
|
+
'ps',
|
|
119
|
+
'tk',
|
|
120
|
+
'nn',
|
|
121
|
+
'mt',
|
|
122
|
+
'sa',
|
|
123
|
+
'lb',
|
|
124
|
+
'my',
|
|
125
|
+
'bo',
|
|
126
|
+
'tl',
|
|
127
|
+
'mg',
|
|
128
|
+
'as',
|
|
129
|
+
'tt',
|
|
130
|
+
'haw',
|
|
131
|
+
'ln',
|
|
132
|
+
'ha',
|
|
133
|
+
'ba',
|
|
134
|
+
'jw',
|
|
135
|
+
'su',
|
|
136
|
+
];
|
|
137
|
+
export const voiceList = [
|
|
138
|
+
{
|
|
139
|
+
name: 'alloy',
|
|
140
|
+
languages: ['en-US', ...supportedLanguages],
|
|
141
|
+
gender: 'male',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'echo',
|
|
145
|
+
languages: ['en-US', ...supportedLanguages],
|
|
146
|
+
gender: 'male',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: 'fable',
|
|
150
|
+
languages: ['en-GB', ...supportedLanguages],
|
|
151
|
+
gender: 'male',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: 'onyx',
|
|
155
|
+
languages: ['en-US', ...supportedLanguages],
|
|
156
|
+
gender: 'male',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'nova',
|
|
160
|
+
languages: ['en-US', ...supportedLanguages],
|
|
161
|
+
gender: 'female',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'shimmer',
|
|
165
|
+
languages: ['en-US', ...supportedLanguages],
|
|
166
|
+
gender: 'female',
|
|
167
|
+
},
|
|
168
|
+
];
|
|
169
|
+
//# sourceMappingURL=OpenAICloudTTS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OpenAICloudTTS.js","sourceRoot":"","sources":["../../src/synthesis/OpenAICloudTTS.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY,EAAE,KAAa,EAAE,KAAa,EAAE,OAA8B;IAC1G,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAA;IAE3B,MAAM,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAA;IAEvD,OAAO,GAAG,UAAU,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAA;IAE3D,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;IACpC,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAA;IAElD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAA;IAElC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;QAC/C,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,OAAO,CAAC,KAAM;QACrB,KAAK,EAAE,KAAY;QACnB,eAAe,EAAE,MAAM;QACvB,KAAK;KACL,EAAE;QACF,UAAU,EAAE,EAAE;KACd,CAAC,CAAA;IAEF,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAA;IAE1C,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;IACrC,MAAM,cAAc,GAAG,cAAc,CAAC,YAAY,CAAC,CAAA;IAEnD,MAAM,CAAC,GAAG,EAAE,CAAA;IAEZ,OAAO,cAAc,CAAA;AACtB,CAAC;AAaD,MAAM,CAAC,MAAM,4BAA4B,GAA0B;IAClE,MAAM,EAAE,SAAS;IACjB,YAAY,EAAE,SAAS;IACvB,OAAO,EAAE,SAAS;IAElB,KAAK,EAAE,OAAO;IAEd,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,EAAE;CACd,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACJ,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAqB;IAC1C;QACC,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,CAAC,OAAO,EAAE,GAAG,kBAAkB,CAAC;QAC3C,MAAM,EAAE,MAAM;KACd;IACD;QACC,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,CAAC,OAAO,EAAE,GAAG,kBAAkB,CAAC;QAC3C,MAAM,EAAE,MAAM;KACd;IACD;QACC,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,CAAC,OAAO,EAAE,GAAG,kBAAkB,CAAC;QAC3C,MAAM,EAAE,MAAM;KACd;IACD;QACC,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,CAAC,OAAO,EAAE,GAAG,kBAAkB,CAAC;QAC3C,MAAM,EAAE,MAAM;KACd;IACD;QACC,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,CAAC,OAAO,EAAE,GAAG,kBAAkB,CAAC;QAC3C,MAAM,EAAE,QAAQ;KAChB;IACD;QACC,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,CAAC,OAAO,EAAE,GAAG,kBAAkB,CAAC;QAC3C,MAAM,EAAE,QAAQ;KAChB;CACD,CAAA"}
|
package/dist/synthesis/SamTTS.js
CHANGED
|
@@ -6,13 +6,13 @@ import { Logger } from '../utilities/Logger.js';
|
|
|
6
6
|
// https://habr-com.translate.goog/ru/post/500764/?_x_tr_sl=auto&_x_tr_tl=en
|
|
7
7
|
export async function synthesize(text, pitch = 64, speed = 72, mouth = 128, throat = 128) {
|
|
8
8
|
const logger = new Logger();
|
|
9
|
-
logger.start(
|
|
9
|
+
logger.start('Initialize sam module');
|
|
10
10
|
const { default: SamJs } = await import('sam-js');
|
|
11
11
|
const sam = new SamJs({ pitch, speed, mouth, throat });
|
|
12
|
-
logger.start(
|
|
12
|
+
logger.start('Synthesize with sam');
|
|
13
13
|
const samples = sam.buf32(text);
|
|
14
14
|
if (!samples) {
|
|
15
|
-
throw new Error(
|
|
15
|
+
throw new Error('Sam TTS failed');
|
|
16
16
|
}
|
|
17
17
|
const rawAudio = { audioChannels: [samples], sampleRate: 22050 };
|
|
18
18
|
logger.end();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SynthesisVoice } from
|
|
2
|
-
import { RawAudio } from
|
|
3
|
-
import { Timeline } from
|
|
1
|
+
import { SynthesisVoice } from '../api/API.js';
|
|
2
|
+
import { RawAudio } from '../audio/AudioUtilities.js';
|
|
3
|
+
import { Timeline } from '../utilities/Timeline.js';
|
|
4
4
|
export declare function synthesize(text: string, voiceName: string, rate?: number, useSpeechPlatform?: boolean): Promise<{
|
|
5
5
|
rawAudio: RawAudio;
|
|
6
6
|
timeline: Timeline;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { decodeToChannels } from
|
|
2
|
-
import { SampleFormat } from
|
|
3
|
-
import { getShortLanguageCode, lcidToIsoLanguageCode } from
|
|
4
|
-
import { Logger } from
|
|
5
|
-
import { logToStderr } from
|
|
1
|
+
import { decodeToChannels } from '../audio/AudioBufferConversion.js';
|
|
2
|
+
import { SampleFormat } from '../codecs/WaveCodec.js';
|
|
3
|
+
import { getShortLanguageCode, lcidToIsoLanguageCode } from '../utilities/Locale.js';
|
|
4
|
+
import { Logger } from '../utilities/Logger.js';
|
|
5
|
+
import { logToStderr } from '../utilities/Utilities.js';
|
|
6
6
|
const log = logToStderr;
|
|
7
7
|
export function synthesize(text, voiceName, rate = 0, useSpeechPlatform = false) {
|
|
8
8
|
return new Promise(async (resolve, reject) => {
|
|
9
9
|
const logger = new Logger();
|
|
10
|
-
logger.start(
|
|
11
|
-
const { default: WinAX } = await import(
|
|
10
|
+
logger.start('Initialize winax module');
|
|
11
|
+
const { default: WinAX } = await import('winax');
|
|
12
12
|
const ActiveXObject = global.ActiveXObject;
|
|
13
|
-
logger.start(
|
|
14
|
-
const sapiVoice = new ActiveXObject(useSpeechPlatform ?
|
|
13
|
+
logger.start('Create SAPI COM object');
|
|
14
|
+
const sapiVoice = new ActiveXObject(useSpeechPlatform ? 'Speech.SPVoice' : 'SAPI.SPVoice');
|
|
15
15
|
sapiVoice.EventInterests = 33790;
|
|
16
|
-
logger.start(
|
|
16
|
+
logger.start('Get SAPI voice list and select best match');
|
|
17
17
|
if (voiceName) {
|
|
18
18
|
const voiceObjects = sapiVoice.GetVoices();
|
|
19
19
|
for (let i = 0; i < voiceObjects.Count; i++) {
|
|
@@ -26,11 +26,11 @@ export function synthesize(text, voiceName, rate = 0, useSpeechPlatform = false)
|
|
|
26
26
|
}
|
|
27
27
|
sapiVoice.Rate = rate;
|
|
28
28
|
// Create phone converter for language
|
|
29
|
-
const sapiPhoneConverter = new ActiveXObject(useSpeechPlatform ?
|
|
29
|
+
const sapiPhoneConverter = new ActiveXObject(useSpeechPlatform ? 'Speech.SpPhoneConverter' : 'SAPI.SpPhoneConverter');
|
|
30
30
|
const sapiLanguageCodeHex = sapiVoice.Voice.GetAttribute('Language');
|
|
31
31
|
const sapiLanguageCode = parseInt(sapiLanguageCodeHex, 16);
|
|
32
32
|
sapiPhoneConverter.LanguageId = sapiLanguageCode;
|
|
33
|
-
logger.start(
|
|
33
|
+
logger.start('Synthesize with SAPI');
|
|
34
34
|
const sampleRate = 22050;
|
|
35
35
|
const bytesPerSecond = sampleRate * 2;
|
|
36
36
|
const sapiOutputStream = new ActiveXObject('SAPI.SpMemoryStream');
|
|
@@ -54,7 +54,7 @@ export function synthesize(text, voiceName, rate = 0, useSpeechPlatform = false)
|
|
|
54
54
|
}
|
|
55
55
|
const wordText = text.substring(charPos, charPos + length);
|
|
56
56
|
const startTime = streamPos / bytesPerSecond;
|
|
57
|
-
const wordEvent = { type:
|
|
57
|
+
const wordEvent = { type: 'word', text: wordText, startTime, endTime: -1, timeline: [] };
|
|
58
58
|
events.push(wordEvent);
|
|
59
59
|
lastWordEvent = wordEvent;
|
|
60
60
|
lastWordCharPos = charPos;
|
|
@@ -64,12 +64,12 @@ export function synthesize(text, voiceName, rate = 0, useSpeechPlatform = false)
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
const phoneText = sapiPhoneConverter.IdToPhone(currentPhoneId);
|
|
67
|
-
if (phoneText ==
|
|
67
|
+
if (phoneText == ',' || phoneText == '_') {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
const startTime = streamPos / bytesPerSecond;
|
|
71
71
|
const endTime = startTime + (duration / 1000);
|
|
72
|
-
events.push({ type:
|
|
72
|
+
events.push({ type: 'phone', text: phoneText, startTime, endTime });
|
|
73
73
|
},
|
|
74
74
|
EndStream: (streamId, streamPos) => {
|
|
75
75
|
clearInterval(dispatchMessagesInterval);
|
|
@@ -85,15 +85,15 @@ export function synthesize(text, voiceName, rate = 0, useSpeechPlatform = false)
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
export async function getVoiceList(useSpeechPlatform = false) {
|
|
88
|
-
const { default: WinAX } = await import(
|
|
88
|
+
const { default: WinAX } = await import('winax');
|
|
89
89
|
const ActiveXObject = global.ActiveXObject;
|
|
90
|
-
const sapiVoice = new ActiveXObject(useSpeechPlatform ?
|
|
90
|
+
const sapiVoice = new ActiveXObject(useSpeechPlatform ? 'Speech.SPVoice' : 'SAPI.SPVoice');
|
|
91
91
|
const voiceObjects = sapiVoice.GetVoices();
|
|
92
92
|
const voices = [];
|
|
93
93
|
for (let i = 0; i < voiceObjects.Count; i++) {
|
|
94
94
|
const voiceObject = voiceObjects.Item(i);
|
|
95
95
|
const voiceName = voiceObject.GetDescription();
|
|
96
|
-
const voiceGender = voiceObject.GetAttribute(
|
|
96
|
+
const voiceGender = voiceObject.GetAttribute('Gender')?.toLowerCase();
|
|
97
97
|
const sapiLanguageCodeHex = voiceObject.GetAttribute('Language');
|
|
98
98
|
const sapiLanguageCode = parseInt(sapiLanguageCodeHex, 16);
|
|
99
99
|
const languageCodes = await lcidToIsoLanguageCode(sapiLanguageCode);
|
|
@@ -113,31 +113,31 @@ export async function getVoiceList(useSpeechPlatform = false) {
|
|
|
113
113
|
voices.push({
|
|
114
114
|
name: voiceName,
|
|
115
115
|
languages: resultLanguageCodes,
|
|
116
|
-
gender: voiceGender ||
|
|
116
|
+
gender: voiceGender || 'unknown'
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
WinAX.release(sapiVoice);
|
|
120
120
|
return voices;
|
|
121
121
|
}
|
|
122
122
|
export async function AssertSAPIAvailable(testForSpeechPlatform = false) {
|
|
123
|
-
if (process.platform !=
|
|
123
|
+
if (process.platform != 'win32') {
|
|
124
124
|
throw new Error(`SAPI is not available on your platform. SAPI is a Microsoft Windows technology that is only runs on a Windows OS.`);
|
|
125
125
|
}
|
|
126
126
|
try {
|
|
127
|
-
const { default: WinAX } = await import(
|
|
127
|
+
const { default: WinAX } = await import('winax');
|
|
128
128
|
}
|
|
129
129
|
catch (e) {
|
|
130
130
|
throw new Error(`winax package, which is required for SAPI support, was not found. You can install it by running 'npm install winax -g'.`);
|
|
131
131
|
}
|
|
132
132
|
const ActiveXObject = global.ActiveXObject;
|
|
133
133
|
try {
|
|
134
|
-
const voice = new ActiveXObject(
|
|
134
|
+
const voice = new ActiveXObject('SAPI.SPVoice');
|
|
135
135
|
}
|
|
136
136
|
catch (e) {
|
|
137
137
|
throw new Error(`Failed creating a SAPI instance: ${e}`);
|
|
138
138
|
}
|
|
139
139
|
try {
|
|
140
|
-
const voice = new ActiveXObject(
|
|
140
|
+
const voice = new ActiveXObject('Speech.SPVoice');
|
|
141
141
|
}
|
|
142
142
|
catch (e) {
|
|
143
143
|
throw new Error(`Failed creating an msspeech instance. Please ensure you installed the Microsoft Speech Platform runtime correctly.`);
|
|
@@ -146,12 +146,12 @@ export async function AssertSAPIAvailable(testForSpeechPlatform = false) {
|
|
|
146
146
|
function eventsToTimeline(events, totalDuration) {
|
|
147
147
|
const timeline = [];
|
|
148
148
|
for (const event of events) {
|
|
149
|
-
if (event.type ==
|
|
149
|
+
if (event.type == 'word') {
|
|
150
150
|
timeline.push(event);
|
|
151
151
|
}
|
|
152
|
-
else if (event.type ==
|
|
152
|
+
else if (event.type == 'phone') {
|
|
153
153
|
if (timeline.length == 0) {
|
|
154
|
-
throw new Error(
|
|
154
|
+
throw new Error('Unexpected: phone event preceded a word event');
|
|
155
155
|
}
|
|
156
156
|
const lastWordEntry = timeline[timeline.length - 1];
|
|
157
157
|
lastWordEntry.endTime = event.endTime;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { SynthesisVoice } from
|
|
3
|
-
import { Timeline } from
|
|
2
|
+
import { SynthesisVoice } from '../api/API.js';
|
|
3
|
+
import { Timeline } from '../utilities/Timeline.js';
|
|
4
4
|
export declare function synthesizeLongText(text: string, voice: string, languageCode: string, sentenceEndPause?: number, segmentEndPause?: number): Promise<{
|
|
5
5
|
rawAudio: {
|
|
6
6
|
audioChannels: Float32Array[];
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { request } from
|
|
2
|
-
import { trimAudioEnd } from
|
|
3
|
-
import * as FFMpegTranscoder from
|
|
4
|
-
import { Phrase, splitToFragments } from
|
|
5
|
-
import { Logger } from
|
|
6
|
-
import { concatFloat32Arrays, logToStderr } from
|
|
1
|
+
import { request } from 'gaxios';
|
|
2
|
+
import { trimAudioEnd } from '../audio/AudioUtilities.js';
|
|
3
|
+
import * as FFMpegTranscoder from '../codecs/FFMpegTranscoder.js';
|
|
4
|
+
import { Phrase, splitToFragments } from '../nlp/Segmentation.js';
|
|
5
|
+
import { Logger } from '../utilities/Logger.js';
|
|
6
|
+
import { concatFloat32Arrays, logToStderr } from '../utilities/Utilities.js';
|
|
7
7
|
const log = logToStderr;
|
|
8
8
|
const maxTextLengthPerRequest = 200;
|
|
9
9
|
export async function synthesizeLongText(text, voice, languageCode, sentenceEndPause = 0.75, segmentEndPause = 1.0) {
|
|
10
10
|
if (text.length == 0) {
|
|
11
|
-
throw new Error(
|
|
11
|
+
throw new Error('Text is empty');
|
|
12
12
|
}
|
|
13
13
|
const logger = new Logger();
|
|
14
|
-
logger.start(
|
|
14
|
+
logger.start('Prepare and split text');
|
|
15
15
|
const fragments = await splitToFragments(text, maxTextLengthPerRequest, languageCode);
|
|
16
16
|
const audioFragments = [];
|
|
17
17
|
let fragmentsSampleRate = 0;
|
|
@@ -40,7 +40,7 @@ export async function synthesizeLongText(text, voice, languageCode, sentenceEndP
|
|
|
40
40
|
const startTime = timeline.length == 0 ? 0 : timeline[timeline.length - 1].endTime;
|
|
41
41
|
const endTime = startTime + (trimmedAudio.length / fragmentsSampleRate);
|
|
42
42
|
timeline.push({
|
|
43
|
-
type:
|
|
43
|
+
type: 'segment',
|
|
44
44
|
text: fragment.text,
|
|
45
45
|
startTime,
|
|
46
46
|
endTime
|
|
@@ -56,33 +56,33 @@ export async function synthesizeLongText(text, voice, languageCode, sentenceEndP
|
|
|
56
56
|
export async function synthesizeFragment(text, voice) {
|
|
57
57
|
const response = await request({
|
|
58
58
|
url: `https://streamlabs.com/polly/speak`,
|
|
59
|
-
method:
|
|
59
|
+
method: 'POST',
|
|
60
60
|
data: {
|
|
61
61
|
voice,
|
|
62
62
|
text,
|
|
63
63
|
},
|
|
64
|
-
responseType:
|
|
64
|
+
responseType: 'json'
|
|
65
65
|
});
|
|
66
66
|
const responseObject = response.data;
|
|
67
67
|
const audioUrl = responseObject.speak_url;
|
|
68
|
-
const audioUrlResponse = await request({ url: audioUrl, responseType:
|
|
68
|
+
const audioUrlResponse = await request({ url: audioUrl, responseType: 'arraybuffer' });
|
|
69
69
|
return Buffer.from(audioUrlResponse.data);
|
|
70
70
|
}
|
|
71
71
|
export const voiceList = [
|
|
72
|
-
{ name:
|
|
73
|
-
{ name:
|
|
74
|
-
{ name:
|
|
75
|
-
{ name:
|
|
76
|
-
{ name:
|
|
77
|
-
{ name:
|
|
78
|
-
{ name:
|
|
79
|
-
{ name:
|
|
80
|
-
{ name:
|
|
81
|
-
{ name:
|
|
82
|
-
{ name:
|
|
83
|
-
{ name:
|
|
84
|
-
{ name:
|
|
85
|
-
{ name:
|
|
86
|
-
{ name:
|
|
72
|
+
{ name: 'Brian', languages: ['en-GB', 'en'], gender: 'male' },
|
|
73
|
+
{ name: 'Emma', languages: ['en-GB', 'en'], gender: 'female' },
|
|
74
|
+
{ name: 'Russell', languages: ['en-AU', 'en'], gender: 'male' },
|
|
75
|
+
{ name: 'Joey', languages: ['en-US', 'en'], gender: 'male' },
|
|
76
|
+
{ name: 'Matthew', languages: ['en-US', 'en'], gender: 'male' },
|
|
77
|
+
{ name: 'Joanna', languages: ['en-US', 'en'], gender: 'female' },
|
|
78
|
+
{ name: 'Kimberly', languages: ['en-US', 'en'], gender: 'female' },
|
|
79
|
+
{ name: 'Amy', languages: ['en-GB', 'en'], gender: 'female' },
|
|
80
|
+
{ name: 'Geraint', languages: ['en-GB-WLS', 'en-GB', 'en'], gender: 'male' },
|
|
81
|
+
{ name: 'Nicole', languages: ['en-AU', 'en'], gender: 'female' },
|
|
82
|
+
{ name: 'Justin', languages: ['en-US', 'en'], gender: 'male' },
|
|
83
|
+
{ name: 'Ivy', languages: ['en-US', 'en'], gender: 'female' },
|
|
84
|
+
{ name: 'Kendra', languages: ['en-US', 'en'], gender: 'female' },
|
|
85
|
+
{ name: 'Salli', languages: ['en-US', 'en'], gender: 'female' },
|
|
86
|
+
{ name: 'Raveena', languages: ['en-IN', 'en'], gender: 'female' },
|
|
87
87
|
];
|
|
88
88
|
//# sourceMappingURL=StreamlabsPollyTTS.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SynthesisVoice } from
|
|
2
|
-
import { RawAudio } from
|
|
1
|
+
import { SynthesisVoice } from '../api/API.js';
|
|
2
|
+
import { RawAudio } from '../audio/AudioUtilities.js';
|
|
3
3
|
export declare function synthesize(text: string, textAnalysisFilePath: string, signalGenerationFilePath: string, postprocessOutput?: boolean): Promise<{
|
|
4
4
|
rawAudio: RawAudio;
|
|
5
5
|
}>;
|