https://github.com/131/clap-trigger
Nodejs clap detector
https://github.com/131/clap-trigger
Last synced: about 1 year ago
JSON representation
Nodejs clap detector
- Host: GitHub
- URL: https://github.com/131/clap-trigger
- Owner: 131
- Created: 2016-01-17T21:14:06.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-03-10T18:44:41.000Z (over 5 years ago)
- Last Synced: 2024-08-09T20:51:00.172Z (almost 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Clap detection trigger for nodejs
===
# Motivation
I just bought a Phillips Hue lamp. My son and i want to switch on / off by clapping hands (see working code here http://pastie.org/10692960)
This module conforms to "strict minimal composition" (use browserify and you'll get the tiniest possible code, with all underlying componants fully tested)
# How
This module relies on sox ("Swiss Army knife of sound processing programs").
Sox is available on all platforms.
# Windows requirements
Have sox.exe available in your path (download http://sox.sourceforge.net/)
# Linux requirements
```
apt-get install sox
gpasswd -a [username] audio
```
# API
```
var engine = require('clap-trigger');
var trigger = new engine(); // options here
trigger.start(function(){
console.log("Stopped")
});
trigger.stop(); //stop listening
trigger.clap(function() {
console.log("Simple clap here");
});
trigger.claps(2, function() {
console.log("Double clap here");
});
```
# Testing
```
npm test
# current code coverage is 100%
```
# Credits
* Derived from https://github.com/tom-s/clap-detector