1.0.8 • Published 4 years ago

@imtoanle/snowboy v1.0.8

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

snowboy

This package was cloned from @bugsounet/snowboy.

Sorry!!! and Thank to @bugsounet

snowboy project will to shut down ... in Dec. 31st, 2020.

So i will try to maintened it ;)

I will ONLY maintened JS code for node use for continue to use snowboy as detector for home assistant or other. (exemple for MagicMirror Project) I have decoded other version of snowboy

I will start this new versioning at v1.4.0 (same as v1.3.1 in Kitt-AI repository)

Update

  • V1.5.0 (20/05/31)

    • Update library
  • v1.4.6-v1.4.7 (20/05/06)

    • installer review
    • use @bugousnet/lpcm16 library
  • v1.4.5 (20/05/02)

    • add log on start
  • v1.4.4 (20/04/22)

    • writing help and sample
  • v1.4.3 (20/04/21)

    • prepare npm library
    • create new Snowboy library
    • create sample
    • update package.json
  • v1.4.2 (20/04/19)

    • internal test for npm install
  • v1.4.1 (20/04/10)

    • Cleaning: now ONLY for Node version
    • update library database
    • compilation error solved
    • npm install complete without error
    • added Alexa keyword in database
  • V1.4.0

    • initial version of Kitt-AI@snowboy

Dependencies

For listening keyword, you have to use a mic, so snowboy need some dependencies to use it

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

Installation

npm install @imtoanle/snowboy

In the ending of installation, if you use electron you can do electron rebuild step.

Do you want to execute electron rebuild ? [Y/n]
Your choice:

Sample with new Snowboy contructor

/** sample code for using snowboy library **/
/** @imtoanle **/

const Snowboy = require("@imtoanle/snowboy").Snowboy

var config = {
  debug: true,
  snowboy: {
    audioGain: 2.0,
    Frontend: true,
    Model: "ecovy",
    Sensitivity: null
  },
  micConfig: {
    recorder: "arecord",
    device: "plughw:1",
  },
}

this.snowboy = new Snowboy(config.snowboy, config.micConfig, (detected) => { detect(detected) }, config.debug )
this.snowboy.init()
this.snowboy.start()

function detect(detected) {
  console.log("Make your script if " + detected + " is detected")
}

constructor of Snowboy

Snowboy(snowboyConfig, micConfig, callback, debug)

SnowboyConfig

  • AudioGain - set the gain of mic. Usually you don't need to set or adjust this value.

  • Frontend - set pre-processing of hotword detection. When you use only snowboy and smart_mirror, false is better. But with other models, true is better to recognize.

  • Model - set the name of your detector. Available: "smart_mirror", "jarvis", "computer", "snowboy", "subex", "neo_ya", "hey_extreme", "view_glass", "ecovy"

  • Sensitivity - Override default sensitivity value for applied model defined in Model.

    • Value could be within a range from 0.0 to 1.0.
    • Default sensitivity values for preconfigured models are:

      • smart_mirror: 0.5
      • ecovy: 0.7
      • jarvis: 0.7
      • computer: 0.6
      • snowboy: 0.5
      • subex: 0.6
      • neo_ya: 0.7
      • hey_extreme: 0.6
      • view_glass: 0.7
      • alexa: 0.6
    • null will set default sensitivity.

micConfig

  • recorder - record program, rec, arecord, sox, parec is available.

    • On RaspberryPi or some linux machines, arecord is better.
    • On OSX, rec is better.
    • If you prefer to use pulse audio, parec would be available also.
  • device - recording device (microphone) name of your environment. (e.g. "plughw:1")

    • Find proper device name by yourself. (arecord -l will be help on Raspberry Pi or linux platform)

callback

if snowboy detect a keyword, it return it with his name

debug

if you want debuging information, just set to true

Functions

  • init() : initialize the constructor
  • start() : start listening and waiting for your keyword
  • stop() : force stop listening

Old constructor of Kitt-AI still also available !

see Kitt-AI@snowboy repository for manual of Models, Detector