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

iobroker.sonus

v0.1.1

Published

With this adapter you can control ioBroker with voice in many different languages

Downloads

9

Readme

Logo

ioBroker.sonus

NPM version Downloads Dependency Status Known Vulnerabilities

NPM

Tests: Linux/Mac: Travis-CI Windows: AppVeyor

sonus adapter for ioBroker

With this adapter you can control ioBroker with voice in many different languages.

It uses open source package snowboy to detect the hotword and google speech service to convert the recorded voice to text. Only 5 seconds after the hot word will be recorded.

Installation on linux

To compile to snowboy (before the installation of this adapter) you need some linux packages.

sudo apt-get install libmagic-dev 
sudo apt-get install libatlas-base-dev 
sudo apt-get install build-essential 
sudo apt-get install sox libsox-fmt-all

Check microphone

For good recognition quality you need a good microphone. I tested it with UMA-8 USB mic array.

List all record devices:

arecord -l

If you have extra micro, you must set the default microphone:

**** List of CAPTURE Hardware Devices ****
card 1: SpkUAC20 [miniDSP VocalFusion Spk (UAC2.0], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Edit /usr/share/alsa/alsa.conf and replace defaults.pcm.card 0 with defaults.pcm.card 1, because in example there is a microphone on card 1.

You can test the microphone with rec test.wav.

Google credentials

For text recognition after the hot word was detected this adapter uses google speech API. To enable it you must get your own credentials and paste it into configuration as JSON.

The instruction can be found here: https://www.npmjs.com/package/@google-cloud/speech#using-the-client-library or here

Google JSON file looks like:

{
  "type": "service_account",
  "project_id": "ыаыаыаыва",
  "private_key_id": "ун457567565",
  "private_key": "-----BEGIN PRIVATE KEY-----\шукгншугкнеушеуке\n-----END PRIVATE KEY-----\n",
  "client_email": "рапрарапрапр.iam.gserviceaccount.com",
  "client_id": "апрапрарапрапр",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/аапрарарапрапра.iam.gserviceaccount.com"
}

And just the whole copied text insert into iobroker configuration.

Own hot word

Default hotword is snowboy or sonus, but you can create your own "hot word" model here https://snowboy.kitt.ai/hotword/ and upload it to adapter.

How to parse the text

You have generally 2 possibilities to parse the text and trigger a command:

  • text2command
  • javascript

text2command

You can set trigger words in text2command, for that you must select the text2command instance in the configuration.

javascript

Write a script that will parse the text appeared in sonus.X.data.detected, where X is instance of sonus adapter.

Script should be like this one:

on({id: 'sonus.0.data.detected', change: 'any'), obj => {
    console.log('Detected words: ' + obj.state.val);
    let command = '';
    if (obj.state.val.match(/on|ein/)) {
        command = true;
    } else if (obj.state.val.match(/off|aus/)) {
        command = false;
    }
    
    if (command === '') {
        console.log('Cannot detect command');
    } else {
        if (obj.state.val.match(/light|backlight/) && obj.state.val.match(/living/)) {
            setState('hm-rpc.0.Q92837293.1.STATE'/* Living room light */, command);
        } else {
            console.log('Cannot detect room or function');
        }
    }  
});

Changelog

0.1.1 (2019-05-24)

  • (bluefox) added sensitivity parameter

0.1.0 (2019-05-20)

  • (bluefox) initial release

License

MIT License

Copyright (c) 2019 bluefox

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.