【问题标题】:Get mp3 and json from AWS Polly at the same time with one call (saving cost)一次调用同时从 AWS Polly 获取 mp3 和 json(节省成本)
【发布时间】:2019-07-19 07:54:11
【问题描述】:

我在这里问了一个问题,几秒钟后我自己回答了: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'
}

看来 polly ui https://us-east-1.console.aws.amazon.com/polly/home/SynthesizeSpeech 也是分开做的?

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

【问题讨论】:

    标签: json amazon-web-services mp3 text-to-speech amazon-polly


    【解决方案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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-01-10
      • 2023-03-10
      • 2023-03-14
      • 1970-01-01
      • 2022-06-21
      • 1970-01-01
      • 2011-01-10
      相关资源
      最近更新 更多