clap-detector
Advanced tools
Comparing version 0.1.1 to 0.1.2
{ | ||
"name": "clap-detector", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Clap detection for node js (linux, raspberry systems)", | ||
@@ -20,3 +20,5 @@ "main": "index.js", | ||
"alsa", | ||
"microphone" | ||
"microphone", | ||
"raspberry", | ||
"raspbian" | ||
], | ||
@@ -23,0 +25,0 @@ "author": "tom-s", |
@@ -1,2 +0,2 @@ | ||
Clap detection module for node js | ||
Clap detection module for node js | ||
=== | ||
@@ -6,4 +6,4 @@ | ||
At the top of the file there should be a short introduction and/ or overview that explains **what** the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.) | ||
I created this module for my project of personal assistant on Raspberry Pi. The clap detection allows me to activate the assistant whenever I need it (and prevent it from continuously being listening for instructions or interpreting random noises as instructions) | ||
ClapDetector is a hand clap detection module for nodejs (iojs). I detect a clap or a series of claps and allow you to trigger callbacks whenever these events happen. | ||
I created this module for my project of personal assistant on Raspberry Pi (raspbian). The clap detection allows me to activate the assistant whenever I need it (and prevent it from continuously being listening for instructions or interpreting random noises as instructions) | ||
@@ -58,2 +58,31 @@ ## Requirements | ||
## Configuration | ||
You can pass a configuration object at initialisation time (clapDetector.init(yourConfObject)). If you don't the following config will be used. You should at least provide the audio input (if different from the default config). | ||
```bash | ||
// DEFAULT CONFIG | ||
var CONFIG = { | ||
AUDIO_SOURCE: 'hw:1,0', // this is your microphone input. if you don't know it you can refer to this thread (http://www.voxforge.org/home/docs/faq/faq/linux-how-to-determine-your-audio-cards-or-usb-mics-maximum-sampling-rate) | ||
DETECTION_PERCENTAGE_START : '5%', // minimum noise percentage threshold necessary to start recording sound | ||
DETECTION_PERCENTAGE_END: '5%', // minimum noise percentage threshold necessary to stop recording sound | ||
CLEANING: { | ||
PERFORM: false, // set to true if you want to clean the file from noise before analyzing it. It requires a sox noise profile | ||
NOISE_PROFILE: 'noise.prof' // path to the sox noise profile | ||
}, | ||
SOUND_FILE : "input.wav", // name of wav file created while recording | ||
SOUND_FILE_CLEAN : "input-clean.wav", // name of cleaned (if you activated cleaning) file | ||
CLAP_AMPLITUDE_THRESHOLD: 0.7, // minimum amplitude threshold to be considered as clap | ||
CLAP_ENERGY_THRESHOLD: 0.3, // minimum energy threshold to be considered as clap | ||
MAX_HISTORY_LENGTH: 10 // all claps are stored in history, this is its max length | ||
}; | ||
``` | ||
If you wish to improve the clap detection you can fiddle with the CLAP_AMPLITUDE_THRESHOLD and CLAP_ENERGY_THRESHOLD values. Depending on your microphone these might need to be modified. | ||
You can also activate cleaning (CLEANING.perform) of the noise for better results. In order to do that record a wav file (using your microphone) without talking and then generate the sox profile with the command: | ||
```bash | ||
sox -c 1 SILENCE.WAV -n trim 0 2 noiseprof noise.prof | ||
``` | ||
## Tests | ||
@@ -60,0 +89,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10306
99