Search code examples
text-to-speechssml

Audio spells markup when ssml format passed in Ivona


when i call Ivona API with input as ssml format, i get audio which pronounce ssml markup.

How to correctly call using ssml as input.


Solution

  • I was reqesting the audio with request type as 'text/plain'. The correct input type will be 'application/ssml+xml'.

    I am using ivona-node library to get the audio.

    The format will be something like this:

    var audioText = '<?xml version="1.0"?><speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"><p><s>This is the first sentence of the paragraph.</s><s>Here is another sentence.</s></p></speak>';
    
    ivona.createVoice(audioText, {
      body: {
        input: {
          data: null,
          type: 'application/ssml+xml'
        },
        voice: {
          name: 'Raveena',
          language: 'en-IN',
          gender: 'Female'
        }
      }
    }).pipe(fs.createWriteStream('output.mp3'));