只需一次通话即可同时从AWS Polly获取mp3和json(节省成本)

只需一次通话即可同时从AWS Polly获取mp3和json(节省成本),json,amazon-web-services,mp3,text-to-speech,amazon-polly,Json,Amazon Web Services,Mp3,Text To Speech,Amazon Polly,我在这里问了一个问题,几秒钟后我自己回答了: 我想知道我是否需要打两个电话来获取我文本的json和mp3 let params = { 'Text': 'Hi, my name is Soley. We are building something amazing!', 'OutputFormat': 'json', 'VoiceId': 'Matthew', 'SpeechMarkTypes': ['word', 'sentence'] } 及 看起来波利也会

我在这里问了一个问题,几秒钟后我自己回答了:

我想知道我是否需要打两个电话来获取我文本的json和mp3

let params = {
    'Text': 'Hi, my name is Soley. We are building something amazing!',
    'OutputFormat': 'json',
    'VoiceId': 'Matthew',
    'SpeechMarkTypes': ['word', 'sentence']
}

看起来波利也会分开做吗


^没有mp3的下载链接,请求json时只需播放按钮。

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

 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