Socket
Socket
Sign inDemoInstall

baidu-yuyin-api

Package Overview
Dependencies
56
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

baidu-yuyin-api

Nodejs implementation of Baidu Yuyin, support text to speech and speech recognition


Version published
Maintainers
1
0

Weekly downloads

Readme

Source

Baidu Yuyin API

npm version Dependency Status

This is a forked repo of baidu_yuyin. Currently under development, use with caution. The original README is here(in Chinese).

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

Keywords

FAQs

Last updated on 02 Dec 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc