npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

baidu-tt

v1.0.5

Published

Baidu Speech to Text

Downloads

3

Readme

Baidu Speech to Text

Latest Version: 1.0.4 CHANGELOG

Hi, this project is aim to speech to text by baidu ai service, now, it's good for chinese you can also use it for English.

Before you install the module, you must install sox on Mac OS X or Windows, or arecord on Linux and alsa on Linux

  • Install

you can use npm

npm install baidu_stt

or you can also use yarn

yarn add baidu_stt
  • How to use
const Baidu_STT = require('baidu-stt');

const bdstt = new Baidu_STT({
  apiKey: '......',
  secertKey: '......',
  language: 'zh',
  voiceRate: '8000',
  voiceType: 'wav',
  voicePath: './',
  continual: false,
  voiceReacod: false
})

bdstt.init();
bdstt.on('ready', () => {
  console.log('Start listen...');
  bdstt.listen();
});

bdstt.on('start', () => console.log('Please speak something, I\'m listening...'));
bdstt.on('listening', () => console.log('I\'m listen'));
bdstt.on('stop', () => console.log('Copy that'));
bdstt.on('upload', () => console.log('Uploading voice data...'));

bdstt.on('success', data => {
  console.log(data);
});

bdstt.on('fail', err => console.log(err));
  • API

Baidu_STT(options)

Return an Baidu_STT object instance

  • options JSON containing command line options. Following are valid options:
    • apiKey {string} App api key
    • secretKey {string} App secret key
    • language {stirng} Choose your language, default is 'zh', you can choose 'en' for English
    • continual {string} Continue to recoding after uploading voice data, if true it will be contunal
    • recordVoice {boolean} Whether save the voice on your disk, default is false
    • voiceRate {string} The rate of voice record, default is '16000', you can set '8000' or any vaild vaule in sox OR arecord
    • voicePath {string} The path of saved voice, default is ./
    • voiceType {string} The type of recod voice file, default is wav

instance.init()

Request token then emit ready event.

instance.listen()

Set instance listen for your voice.

  • Event

start

Start record voice after you call listen()

listening

Recoding voice

stop

Stop recoding voice

upload

Upload voice date to service

success

Success for recogniting your voice content, and return the result it is array type, because there may be many result. Normally the first result is better than other. I see ��

fail

When baidu can not recognting, it will return error message, it's string type.