This package has been deprecated

Author message:

ITRI TTS Web Service API has stopped working.

itri-tts

2.0.0 • Public • Published

itri-tts

NPM version Build Status Coverage Status

[DEPRECATED] ITRI TTS Web Service API for Node.js

Deprecation Notice

ITRI TTS Web Service API has stopped working.

Install

$ npm install --save itri-tts

Usage

var TTSClient = require('itri-tts')
var tts = new TTSClient(accountID, password)

ConvertSimple

var text = '您好,我是Bruce,感謝您使用工研院文字轉語音Web服務。'
 
tts.ConvertSimple(text, function (err, result) {
  if (err) throw err
  console.log(result)  // { resultCode: '0',
                       //   resultString: 'success',
                       //   resultConvertID: CONVERT_ID }
})
 
/* Promise Support */
tts.ConvertSimple(text)
  .then(function (result) {
    console.log(result)
  })
  .catch(function (err) {
    console.log(err)
  })

ConvertText

var options = {
  TTStext: '您好,我是Bruce,感謝您使用工研院文字轉語音Web服務。',
  TTSSpeaker: 'Bruce',  // 'Bruce', 'Theresa', 'Angela', default = Bruce
  volume: 100,          // 0 ~ 100, default = 100
  speed: 0,             // -10 ~ 10, default = 0
  outType: 'wav'        // 'wav', 'flv', default = 'wav'
}
 
tts.ConvertText(options, function (err, result) {
  if (err) throw err
  console.log(result)  // { resultCode: '0',
                       //   resultString: 'success',
                       //   resultConvertID: CONVERT_ID }
})
 
/* Promise Support */
tts.ConvertText(options)
  .then(function (result) {
    console.log(result)
  })
  .catch(function (err) {
    console.log(err)
  })

ConvertAdvancedText

var options = {
  TTStext: '您好,我是Bruce,感謝您使用工研院文字轉語音Web服務。',
  TTSSpeaker: 'Bruce',  // Bruce, Theresa, Angela, default = Bruce
  volume: 100,          // 0 ~ 100, default = 100
  speed: 0,             // -10 ~ 10, default = 0
  outType: 'wav',       // wav, flv
  PitchLevel: 0,        // -10 ~ 10, default = 0
  PitchSign: 0,         // 0, 1, 2, default = 0
  PitchScale: 5         // 0 ~ 20, default = 5
}
 
tts.ConvertAdvancedText(options, function (err, result) {
  if (err) throw err
  console.log(result)  // { resultCode: '0',
                       //   resultString: 'success',
                       //   resultConvertID: CONVERT_ID }
})
 
/* Promise Support */
tts.ConvertAdvancedText(options)
  .then(function (result) {
    console.log(result)
  })
  .catch(function (err) {
    console.log(err)
  })

GetConvertStatus

var convertID = 1234567890
 
tts.GetConvertStatus(convertID, function (err, result) {
  if (err) throw err
  console.log(result)  // { resultCode: '0',
                       //   resultString: 'success',
                       //   statusCode: '2',
                       //   status: 'completed',
                       //   resultUrl: AUDIO_ADDRESS }
})
 
/* Promise Support */
tts.GetConvertStatus(convertID)
  .then(function (result) {
    console.log(result)
  })
  .catch(function (err) {
    console.log(err)
  })

Reference

工研院文字轉語音Web服務

License

MIT © Chun-Kai Wang

Package Sidebar

Install

npm i itri-tts

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

13.3 kB

Total Files

6

Last publish

Collaborators

  • chunkai1312