-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from Kitt-AI/devel
v1.1.0
- Loading branch information
Showing
27 changed files
with
786 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/lib/libsnowboy-detect.a | ||
snowboy-detect-swig.cc | ||
snowboydetect.py | ||
.DS_Store | ||
|
||
*.pyc | ||
*.o | ||
*.so | ||
|
||
/examples/C++/* | ||
/examples/Python/* | ||
|
||
/swig/Android/* | ||
/swig/Python/* | ||
|
||
/build | ||
/node_modules | ||
|
||
/lib/node/*.ts | ||
/lib/node/*.d.ts | ||
|
||
.npmignore | ||
.travis.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
language: cpp | ||
|
||
# Cache node dependencies | ||
cache: | ||
directories: | ||
- node_modules | ||
|
||
# Ubuntu 14.04 Trusty support | ||
sudo: required | ||
dist: trusty | ||
|
||
addons: | ||
apt: | ||
sources: | ||
# add PPAs with more up-to-date toolchains | ||
- ubuntu-toolchain-r-test | ||
- llvm-toolchain-precise-3.9 | ||
packages: | ||
# install toolchains | ||
- libmagic-dev | ||
- libatlas-base-dev | ||
- gcc-5 | ||
- g++-5 | ||
- clang-3.8 | ||
|
||
os: | ||
- linux | ||
- osx | ||
|
||
env: | ||
global: | ||
- secure: Hpft/SbwPrjQbHq+3DeJ8aMCpg2uW4z9MY4XaPPA5FQ80QkUdFMqALRvd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vi7aegRoiqHNrs4m2JuQDCPXu53HKh22+nWgRLLXFT2oBN3FdCz3xj04t+LyT+P5uq9q0jXxKc1nlNpvF3nDzhIuJKcfgBRNm9Wt1vz04xzSRgZEFGMTRWkYTdV+0ZVeqEQjEPo4fRNJ6PT1Tem8VqIoHEKGivGkwiAZ6FhQ/TNkVD7tv5Vhq7eK3ZPXDRakuBsLJ5Nc9QnLCpoEqbuIYqjr8ODKV2HSjS16VaGPbvtYPWzhGKU9C4= | ||
matrix: | ||
- NODE_VERSION="4.0.0" | ||
- NODE_VERSION="5.0.0" | ||
- NODE_VERSION="6.0.0" | ||
|
||
before_install: | ||
# use the correct version of node | ||
- rm -rf ~/.nvm/ && git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm | ||
- source ~/.nvm/nvm.sh | ||
- nvm install $NODE_VERSION | ||
- nvm use $NODE_VERSION | ||
# get commit message | ||
- COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d '\n') | ||
# put local node-pre-gyp on PATH | ||
- export PATH=./node_modules/.bin/:$PATH | ||
# put global node-gyp on PATH | ||
- npm install node-gyp -g | ||
# install aws-sdk so it is available for publishing | ||
- npm install aws-sdk | ||
# figure out if we should publish or republish | ||
- PUBLISH_BINARY=false | ||
- REPUBLISH_BINARY=false | ||
# if we are building a tag then publish | ||
- if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]]; then PUBLISH_BINARY=true; fi; | ||
# or if we put [publish binary] in the commit message | ||
- if test "${COMMIT_MESSAGE#*'[publish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true; fi; | ||
# alternativly we can [republish binary] which will replace any existing binary | ||
- if test "${COMMIT_MESSAGE#*'[republish binary]'}" != "$COMMIT_MESSAGE"; then PUBLISH_BINARY=true && REPUBLISH_BINARY=true; fi; | ||
install: | ||
# ensure source install works | ||
- npm install --build-from-source | ||
# test our module | ||
- node lib/node/index.js | ||
|
||
before_script: | ||
# if publishing, do it | ||
- if [[ $REPUBLISH_BINARY == true ]]; then node-pre-gyp package unpublish; fi; | ||
- if [[ $PUBLISH_BINARY == true ]]; then node-pre-gyp package publish; fi; | ||
# cleanup | ||
- node-pre-gyp clean | ||
- node-gyp clean | ||
|
||
script: | ||
# if publishing, test installing from remote | ||
- INSTALL_RESULT=0 | ||
- if [[ $PUBLISH_BINARY == true ]]; then INSTALL_RESULT=$(npm install --fallback-to-build=false > /dev/null)$? || true; fi; | ||
# if install returned non zero (errored) then we first unpublish and then call false so travis will bail at this line | ||
- if [[ $INSTALL_RESULT != 0 ]]; then echo "returned $INSTALL_RESULT";node-pre-gyp unpublish;false; fi | ||
# If success then we arrive here so lets clean up | ||
- node-pre-gyp clean | ||
|
||
after_success: | ||
# if success then query and display all published binaries | ||
- node-pre-gyp info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ by [KITT.AI](http://kitt.ai). | |
|
||
(The discussion group is new since September 2016 as we are getting many messages every day. Please send general questions there. For bugs, use Github issues.) | ||
|
||
Version: 1.0.4 (7/13/2016) | ||
Version: 1.1.0 (9/20/2016) | ||
|
||
Snowboy is a customizable hotword detection engine for you to create your own | ||
hotword like "OK Google" or "Alexa". It is powered by deep neural networks and | ||
|
@@ -42,12 +42,24 @@ pull request! | |
If you want support on other hardware/OS, please send your request to | ||
[[email protected]](mailto:snowboy.kitt.ai) | ||
|
||
## Precompiled node module | ||
|
||
Snowboy is available in the form of a native node module precompiled for: | ||
64 bit Ubuntu, MacOS X, and the Raspberry Pi (Raspbian 8.0+). For quick | ||
installation run: | ||
|
||
npm install --save snowboy | ||
|
||
For sample usage see the `examples/Node` folder. You may have to install | ||
dependencies like `fs`, `wav` or `node-record-lpcm16` depending on which script | ||
you use. | ||
|
||
## Precompiled Binaries with Python Demo | ||
* 64 bit Ubuntu [12.04](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/ubuntu1204-x86_64-1.0.4.tar.bz2) | ||
/ [14.04](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/ubuntu1404-x86_64-1.0.4.tar.bz2) | ||
* [MacOS X](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/osx-x86_64-1.0.4.tar.bz2) | ||
* 64 bit Ubuntu [12.04](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/ubuntu1204-x86_64-1.1.0.tar.bz2) | ||
/ [14.04](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/ubuntu1404-x86_64-1.1.0.tar.bz2) | ||
* [MacOS X](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/osx-x86_64-1.1.0.tar.bz2) | ||
* Raspberry Pi with Raspbian 8.0, all versions | ||
([1/2/3/Zero](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/rpi-arm-raspbian-8.0-1.0.4.tar.bz2)) | ||
([1/2/3/Zero](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/rpi-arm-raspbian-8.0-1.1.0.tar.bz2)) | ||
|
||
If you want to compile a version against your own environment/language, read on. | ||
|
||
|
@@ -85,6 +97,15 @@ Make sure that you can record audio with your microphone: | |
If you need extra setup on your audio (especially on a Raspberry Pi), please see the [full documentation](http://docs.kitt.ai/snowboy). | ||
|
||
## Compile a Node addon | ||
Compiling a node addon for Linux and the Raspberry Pi requires the installation of the following dependencies: | ||
|
||
sudo apt-get install libmagic-dev libatlas-base-dev | ||
|
||
Then to compile the addon run the following from the root of the snowboy repository: | ||
|
||
node-pre-gyp clean configure build | ||
|
||
## Compile a Python Wrapper | ||
|
||
cd swig/Python | ||
|
@@ -172,6 +193,13 @@ See [Full Documentation](http://docs.kitt.ai/snowboy). | |
|
||
## Change Log | ||
|
||
**v1.1.0, 9/20/2016** | ||
|
||
* Added library for Node. | ||
* Added support for Python3. | ||
* Added universal model `alexa.umdl` | ||
* Updated universal model `snowboy.umdl` so that it works in noisy environment. | ||
|
||
**v1.0.4, 7/13/2016** | ||
|
||
* Updated universal `snowboy.umdl` model to make it more robust. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
'targets': [{ | ||
'target_name': 'snowboy', | ||
'sources': [ | ||
'swig/Node/snowboy.cc' | ||
], | ||
'conditions': [ | ||
['OS=="mac"', { | ||
'link_settings': { | ||
'libraries': [ | ||
'<(module_root_dir)/lib/osx/libsnowboy-detect.a', | ||
] | ||
} | ||
}], | ||
['OS=="linux" and target_arch=="x64"', { | ||
'link_settings': { | ||
'libraries': [ | ||
'<(module_root_dir)/lib/ubuntu64/libsnowboy-detect.a', | ||
] | ||
} | ||
}], | ||
['OS=="linux" and target_arch=="arm"', { | ||
'link_settings': { | ||
'libraries': [ | ||
'<(module_root_dir)/lib/rpi/libsnowboy-detect.a', | ||
] | ||
} | ||
}] | ||
], | ||
'cflags': [ | ||
'-std=c++11', | ||
'-fexceptions', | ||
'-Wall', | ||
'-D_GLIBCXX_USE_CXX11_ABI=0' | ||
], | ||
'cflags!': [ | ||
'-fno-exceptions' | ||
], | ||
'cflags_cc!': [ | ||
'-fno-exceptions' | ||
], | ||
'include_dirs': [ | ||
"<!(node -e \"require('nan')\")", | ||
"<!(pwd)/include" | ||
], | ||
'libraries': [ | ||
'-lcblas' | ||
], | ||
'xcode_settings': { | ||
'MACOSX_DEPLOYMENT_TARGET': '10.11', | ||
"GCC_ENABLE_CPP_EXCEPTIONS": "YES", | ||
'OTHER_CFLAGS': [ | ||
'-std=c++11', | ||
'-stdlib=libc++' | ||
] | ||
} | ||
}, | ||
{ | ||
"target_name": "action_after_build", | ||
"type": "none", | ||
"dependencies": [ "<(module_name)" ], | ||
"copies": [ | ||
{ | ||
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ], | ||
"destination": "<(module_path)" | ||
} | ||
] | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const fs = require('fs'); | ||
const wav = require('wav'); | ||
const {Detector, Models} = require('../../'); | ||
|
||
const models = new Models(); | ||
|
||
models.add({ | ||
file: 'resources/snowboy.umdl', | ||
sensitivity: '0.5', | ||
hotwords : 'snowboy' | ||
}); | ||
|
||
const detector = new Detector({ | ||
resource: "resources/common.res", | ||
models: models, | ||
audioGain: 1.0 | ||
}); | ||
|
||
detector.on('silence', function () { | ||
console.log('silence'); | ||
}); | ||
|
||
detector.on('sound', function () { | ||
console.log('sound'); | ||
}); | ||
|
||
detector.on('error', function () { | ||
console.log('error'); | ||
}); | ||
|
||
detector.on('hotword', function (index, hotword) { | ||
console.log('hotword', index, hotword); | ||
}); | ||
|
||
const file = fs.createReadStream('resources/snowboy.wav'); | ||
const reader = new wav.Reader(); | ||
|
||
file.pipe(reader).pipe(detector); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const record = require('node-record-lpcm16'); | ||
const {Detector, Models} = require('../../'); | ||
|
||
const models = new Models(); | ||
|
||
models.add({ | ||
file: 'resources/snowboy.umdl', | ||
sensitivity: '0.5', | ||
hotwords : 'snowboy' | ||
}); | ||
|
||
const detector = new Detector({ | ||
resource: "resources/common.res", | ||
models: models, | ||
audioGain: 2.0 | ||
}); | ||
|
||
detector.on('silence', function () { | ||
console.log('silence'); | ||
}); | ||
|
||
detector.on('sound', function () { | ||
console.log('sound'); | ||
}); | ||
|
||
detector.on('error', function () { | ||
console.log('error'); | ||
}); | ||
|
||
detector.on('hotword', function (index, hotword) { | ||
console.log('hotword', index, hotword); | ||
}); | ||
|
||
const mic = record.start({ | ||
threshold: 0, | ||
verbose: true | ||
}); | ||
|
||
mic.pipe(detector); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../resources/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
interface SnowboyDetectNativeInterface { | ||
new (resource: string, models: string): SnowboyDetectNativeInterface; | ||
Reset(): boolean; | ||
RunDetection(audioData: Buffer): number; | ||
SetSensitivity(sensitivity: string): void; | ||
GetSensitivity(): string; | ||
SetAudioGain(audioGain: number): void; | ||
UpdateModel(): void; | ||
NumHotwords(): number; | ||
SampleRate(): number; | ||
NumChannels(): number; | ||
BitsPerSample(): number; | ||
} |
Oops, something went wrong.