Skip to content
This repository has been archived by the owner on Dec 28, 2019. It is now read-only.

chunkai1312/itri-tts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published