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

turen

v1.6.9

Published

TurenCore client for Node.js

Downloads

43

Readme

node-turen

The Node.js client for TurenCore.

NPM version

Installation

$ npm install turen --save

Get Started

var options = {
  host: 'apigwws.open.rokid.com',
  port: 443,
  key: 'rokid openplatform key',
  secret: 'rokid openplatform secret',
  deviceTypeId: 'rokid device type id',
  deviceId: 'rokid device id',
};
var speech = new TurenSpeech();
speech.on('voice coming', (event) => {
  // voice coming
});
speech.on('voice accept', (event) => {
  // voice accept
});
speech.on('asr end', (asr, event) => {
  // asr
});
speech.on('nlp', (response, event) => {
  // response.asr
  // response.nlp
  // response.action
});
speech.on('disconnect', (socketType/* event or rpc */) => {
  // got if some event is disconnected
});
speech.start(options);

Services

TurenCore provides multiple socket-based services for different functionalities.

RPC

Rpc service is used to call method of TurenCore, which includes:

  • Restart()
  • RestartWithoutArgs()
  • Pickup()
  • IsPickup()
  • OpenMic()
  • SetStack()
  • SetSkillOption()

CMD

Cmd service is used to call debug method which includes:

  • openMic()
  • closeMic()
  • pickup()
  • reset()
  • readyForAsr()
  • setAngle(deg)

Event

Event service is to be notified for all voice and nlp events, includes:

  • voice coming returns the speech energy and direction sl when triggered locally.
  • voice local sleep when sleep locally.
  • asr begin when cloud speech recognition begins.
  • asr end returns the final value asr when cloud speech recognition ends.
  • nlp returns the nlp and action when NLP is done.

A complete events list is at here.

Audio

Audio service is also to debug with TurenCore, we could pull audio streams from every stage like AEC/BF/VAD.

You could use it as a socket handle:

var audioStream = new TurenAudio('mic_in');
audioStream.on('data', (chunk) => {
  // got data
});
audioStream.connect();

Streaming API also could use used:

var writable = fs.createWriteStream('/path/to/your/file');
writable.pipe(audioStream);

Push audio data to TurenCore:

var audioWritable = new TurenAudio('mic_out');
await audioWritable.connect();

// write a buffer
audioWritable.send(new Buffer(1024));
// write a readable stream
audioWritable.send(fs.createReadStream('/path/to/your/pcm/file'));

The available type values of TurenAudio is:

  • mic_in as a Readable stream to pull the raw data, its format depends on your micphone configuration.
  • bf_out as a Readable stream to pull the pcm after BF.
  • bf4_out as a Readable stream to pull the pcm after BF with selected 4 channels.
  • bf12_out as a Readable stream to pull the pcm after BF with the full 12 channels.
  • aec_out as a Readable stream to pull the pcm after AEC.
  • codec_in as a Readable stream to pull the pcm before opu codec.
  • speech_in as a Readable stream to pull the opu before uploading to cloud speech service.
  • mic_out as a Writable stream to push raw data.

The following types are available only for our CTC model:

  • ctc.line_0 as a Readable stream to pull the pcm to the CTC line 0.
  • ctc.line_1 as a Readable stream to pull the pcm to the CTC line 1.
  • ctc.line_2 as a Readable stream to pull the pcm to the CTC line 2.
  • ctc.line_3 as a Readable stream to pull the pcm to the CTC line 3.

Logger

You also could access to TurenCore's logs by TurenLogger:

var TurenLogger = require('turen').client.TurenLogger;
var logger = new TurenLogger();
logger.on('data', (data) => {
  // receives the data
});
logger.connect();

License

MIT