2015-07-19 33 views

回答

2

我要求請求類型爲'text/plain'的音頻。正確的輸入類型將是'application/ssml + xml'。

我正在使用ivona-node庫來獲取音頻。

格式將是這樣的:

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'));