简体   繁体   中英

Watson TTS doesn't allow to choose voice

Created a Bluemix app to get the proper credentials and using Fiddler Text to Speech(TTS) to record prompts. Recordings use the default "Michael" voice. I want Allison.

If I try passing in "voice", I get the following error, even when I specify "Michael" as my choice:

{
  "code_description": "Bad request",
  "code": 400,
  "error": "The argument(s) [u'voice'} are not allowed."
}

This is my payload:

{
"text": "Hello,, this is Dora. How are you today?",
"voice": "en-US_AllisonVoice"
}

I have a developer account, do I need to sign up to use "voice"? Even if I pass in the default "Michael"?

I think your problem is in the way you are specifing the voice parameter.
The voice and text parameters can be send as query parameters in a GET.

Examples

1. Curl

curl -u "{username}":"{password}" "https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?voice=en-US_AllisonVoice&text=Hello%2C%20this%20is%20Dora.%20How%20are%20you%20today%3F"

Node

var watson = require('watson-developer-cloud');
var fs = require('fs');

var text_to_speech = watson.text_to_speech({
  username: '<username>',
  password: '<password>',
  version: 'v1'
});

var params = {
  text: 'Hello, this is Dora. How are you today?',
  voice: 'en-US_AllisonVoice',
  accept: 'audio/wav'
};

// Pipe the synthesized text to a file
text_to_speech.synthesize(params).pipe(fs.createWriteStream('output.wav'));

See the Text to Speech API Reference for more examples on how to call the service.
Try the example above here:

https://text-to-speech-demo.mybluemix.net/api/synthesize?voice=en-US_AllisonVoice&text=Hello%2C%20this%20is%20Dora.%20How%20are%20you%20today%3F

Powered by the demo app: https://text-to-speech-demo.mybluemix.net

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM