我在这里问了一个问题,几秒钟后我一个人回答了:Get mp3 and speech mark from Amazon Polly using NodeJs
我想知道是否必须打两次电话才能获取文本的json和mp3吗?
let params = {
'Text': 'Hi, my name is Soley. We are building something amazing!',
'OutputFormat': 'json',
'VoiceId': 'Matthew',
'SpeechMarkTypes': ['word', 'sentence']
}
和
let params = {
'Text': 'Hi, my name is Soley. We are building something amazing!',
'OutputFormat': 'mp3',
'VoiceId': 'Matthew'
}
似乎波莉ui https://us-east-1.console.aws.amazon.com/polly/home/SynthesizeSpeech还要分开做吗?
^没有mp3的下载链接,仅在请求json时播放按钮。
答案 0 :(得分:1)
SynthesizeSpeech API只能为输出格式采用一个参数,因此,您必须调用它两次。
OutputFormat
The format in which the returned output will be encoded.
For audio stream, this will be mp3, ogg_vorbis, or pcm.
For speech marks, this will be json.
When pcm is used, the content returned is audio/pcm in a signed 16-bit,
1 channel (mono), little-endian format.
Type: String
Valid Values: json | mp3 | ogg_vorbis | pcm
Required: Yes
https://docs.aws.amazon.com/polly/latest/dg/API_SynthesizeSpeech.html