From 99286071e3ea5c0c43959d8b1032b9fea854caf0 Mon Sep 17 00:00:00 2001 From: chenguoguo Date: Sat, 4 Jun 2016 15:25:05 +0800 Subject: [PATCH] Updated README.md to reflect the recent changes --- README.md | 56 +++++++++++++++++++++++++++++++++++++++---- swig/Android/Makefile | 2 +- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d278c136..2cd66b30 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ by [KITT.AI](http://kitt.ai). [Full Documentation](https://snowboy.kitt.ai/docs) -Version: 1.0.2 (5/24/2016) +Version: 1.0.3 (6/4/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 has the following properties: @@ -26,12 +26,14 @@ Currently Snowboy supports: * all versions of Raspberry Pi (with Raspbian based on Debian Jessie 8.0) * 64bit Mac OS X * 64bit Ubuntu (12.04 and 14.04) +* iOS +* Android -It ships in the form of a **C library** with **Python** wrappers generated by SWIG. We welcome wrappers for other languages -- feel free to send a pull request! +It ships in the form of a **C library** with language-dependent wrappers generated by SWIG. We welcome wrappers for new languages -- feel free to send a pull request! If you want support on other hardware/OS, please send your request to [snowboy@kitt.ai](mailto:snowboy.kitt.ai) -## Precompiled Binaries +## 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.2.tar.bz2) / [14.04](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/ubuntu1404-x86_64-1.0.2.tar.bz2) * [MacOS X](https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/osx-x86_64-1.0.2.tar.bz2) @@ -84,7 +86,47 @@ SWIG will generate a `_snowboydetect.so` file and a simple (but hard-to-read) py Feel free to adapt the `Makefile` in `swig/Python` to your own system's setting if you cannot `make` it. -## Quick Start +## Compile an iOS Wrapper + +Using Snowboy library in Objective-C does not really require a wrapper. It is basically the same as using C++ library in Objective-C. We have compiled a "fat" static library for iOS devices, see the library here `lib/ios/libsnowboy-detect.a`. + +To initialize Snowboy detector in Objective-C: + + snowboy::SnowboyDetect* snowboyDetector = new snowboy::SnowboyDetect( + std::string([[[NSBundle mainBundle]pathForResource:@"common" ofType:@"res"] UTF8String]), + std::string([[[NSBundle mainBundle]pathForResource:@"snowboy" ofType:@"umdl"] UTF8String])); + snowboyDetector->SetSensitivity("0.45"); // Sensitivity for each hotword + snowboyDetector->SetAudioGain(2.0); // Audio gain for detection + +To run hotword detection in Objective-C: + + int result = snowboyDetector->RunDetection(buffer[0], bufferSize); // buffer[0] is a float array + +You may want to play with the frequency of the calls to `RunDetection()`, which controls the CPU usage and the detection latency. + +## Compile an Android Wrapper + + cd swig/Android + # Make sure you set up the NDKROOT variable in Makefile before you run. + make + +Using Snowboy library on Android devices is a little bit tricky. We have compiled Snowboy using Android's cross-compilation toolchain for ARMV7 architecture, see the library here `lib/android/armv7a/libsnowboy-detect.a`. We then use SWIG to generate the Java wrapper, and use Android's cross-compilation toolchain to generate the corresponding JNI libraries. After running `make`, two directories will be created: `java` and `jniLibs`. Copy these two directories to your Android app directory (e.g., `app/src/main/`) and you should be able to call Snowboy funcitons within Java. + +To initialize Snowboy detector in Java: + + # Assume you put the model related files under /sdcard/snowboy/ + SnowboyDetect snowboyDetector = new SnowboyDetect("/sdcard/snowboy/common.res", + "/sdcard/snowboy/snowboy.umdl"); + snowboyDetector.SetSensitivity("0.45"); // Sensitivity for each hotword + snowboyDetector.SetAudioGain(2.0); // Audio gain for detection + +To run hotword detection in Java: + + int result = snowboyDetector.RunDetection(buffer, buffer.length); // buffer is a short array. + +You may want to play with the frequency of the calls to `RunDetection()`, which controls the CPU usage and the detection latency. + +## Quick Start for Python Demo Go to the `examples/Python` folder and open your python console: @@ -120,6 +162,12 @@ See [Full Documentation](https://snowboy.kitt.ai/docs). ## Change Log +**v1.0.3, 6/4/2016** + +* Updated universal `snowboy.umdl` model to make it more robust in non-speech environment. +* Fixed bug when using float as input data. +* Added library support for Android ARMV7 architecture. + **v1.0.2, 5/24/2016** * Updated universal `snowboy.umdl` model diff --git a/swig/Android/Makefile b/swig/Android/Makefile index aea5e370..59424207 100644 --- a/swig/Android/Makefile +++ b/swig/Android/Makefile @@ -9,7 +9,7 @@ SWIG := swig # Please specify your NDK root directory here. -NDKROOT := /Users/guoguo/Tools/android-ndk-r11c/ +NDKROOT := APILEVEL := 17 SNOWBOYDETECTSWIGITF = snowboy-detect-swig.i