Baidu Yuyin RESTful API Node JS Implementation.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 22 commits ahead, 23 commits behind aokihu:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
DEPRECATE-README.md
README.md
config.json
index.js
package.json
test.js
test.pcm
test_en.wav

README.md

Baidu Yuyin API

npm version Dependency Status

NPM

Usage

Need Nodejs v6 above to run this module.

Installation

npm install baidu-yuyin-api

Examples

var BaiduYuyin = require("baidu-yuyin-api");

// Init Baidu Yuyin API.
// Make sure the apiKey and secretKey are set.
// afplay is default player for Mac OS.
// For windows, can use vlc or wmplayer instead.
var speech = new BaiduYuyin(apiKey, secretKey, 'afplay', null, false); 

// Options
var optt = {tex: 'English testing, Hello world', lan: 'zh'}; // Text to speech, language not support English.
var optcn = {lan: 'zh'};
var opten = {format: 'wav', lan: 'en'};

speech.on('ready', () => {
    // Text to speech
    speech.speak("你好世界")
    .then(() => {
        return speech.speak(null, optt);
    })
    .then(() => {
        return speech.speak("测试结束");
    })
    .then(() => {
        return speech.recognize(fs.readFileSync('./test.pcm'), optcn);
    })
    .then(() => {
        return speech.recognize(fs.readFileSync('./test_en.wav'), opten);
    });
});

Test

Clone the repo to local, and run npm install && npm test.

Change Logs

Update 0.1.9 [2016-12-02]

  • Fix the auto renew session token

Update 0.1.8 [2016-12-01]

  • Make sure only renew session file when necessary
  • Minor fixes on README
  • Correct miss spelling words

Update 0.1.7 [2016-11-30]

  • Fix the samples in README
  • Add test API key in config.json
  • Auto renew session token if it expired (30 days)

Update 0.1.6 [2016-11-29]

  • Update README
  • Update test samples
  • Text to speech not support English output

Update 0.1.4 [2016-11-29]

  • Supporting speech recognition
  • Using NODE_DEBUG=request node test.js to test HTTP request

Update 0.1.3 [2016-11-28]

  • Using Linux file system
  • Support wmplayer and vlc player on Windows platform

Update 0.1.2 [2016-11-27]

  • Rewrite code style
  • Fix minor issues