0

I am trying to use IBM Watson Text to Speech because I need to get some audio file to insert in a video but I am not a developer, at all! Looking a the scarce tutorial provided on IBM cloud website, I figured out how to get the audio file using curl. But I cannot find a way to use the SSML possibilities to modify the voice. I don't understand where we have to specify the tags in the code. Here is the code I use, it works to produce the audio file. Where should I insert the tags to customize the voice?... Any help would be more than welcome! Many thanks in advance

curl -X POST -u "credential OK":"credential ok" \        
--header "Content-Type: application/json" \        
--header "Accept: audio/mp3" \        
--data '{"text": "The visceral leishmaniasis, also known as kala-azar is characterized by irregular bouts of fever, substantial weight loss, swelling of the spleen and liver, and anaemia. Visceral leishmaniasis is fatal in over 95% of cases if left untreated."}' \        
--output Essai.mp3 \        
"https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?voice=en-US_AllisonVoice"\   
Morvader
  • 2,317
  • 3
  • 31
  • 44

2 Answers2

0

You put the SSML tags round the text that it need to be applied to

eg. for your example

--data '{"text": "<express-as type='GoodNews'> The visceral leishmaniasis, also known as kala-azar </express-as> is characterized by irregular bouts of fever, substantial weight loss, swelling of the spleen and liver, and anaemia. Visceral leishmaniasis is fatal in over 95% of cases if left untreated."}'
chughts
  • 4,210
  • 2
  • 14
  • 27
  • Thanks for your input. I gave it a try but it returns me a blank audio file. Any idea why? – AMarie Lab Oct 25 '18 at 09:11
  • Check your output for errors you might be seeing something on the lines of " is not supported in the current voice" – chughts Oct 26 '18 at 07:40
  • I don't see any errors in the output... I don't know...it creates the file, but the file is empty. SSML should supported with the chosen voice – AMarie Lab Oct 26 '18 at 13:20
-1

I know this answer is late in coming but it might help someone else with the same problem.

--data "{\"text\": \"<voice-transformation type='Custom' breathiness='35%' pitch='-80%' pitch_range='60%' glottal_tension='-40%' ><p><s>The visceral leishmaniasis, <break strength='500ms'></break>also known as kala-azar, <break strength='500ms'></break> <express-as type='Uncertainty'>is characterized by irregular bouts of fever, substantial weight loss, swelling of the spleen and liver, and anaemia.</express-as></s> <s>Visceral leishmaniasis is fatal in over 95% of cases if left untreated.</s></p></voice-transformation>\"}" \

I believe the reason that the example provided by chughts did not work, may be because of improper escaping of quotes in the JASON object. *Also please note that the the express-as element only works with the en-US_AllisonVoice.

Personally I can't tell the difference in the voice using any of the express-as element type options. FWIW, I much prefer the en-US_LisaV3Voice, but you can't use voice-transformations with the V3 voices.

skrantz
  • 39
  • 1
  • 6