monstercat / Bpm.js
Pure js bpm detection on raw audio streams
Stars: ✭ 52
Programming Languages
javascript
184084 projects - #8 most used programming language
bpm.js
Calculate bpm from a raw audio stream. pure js. non blocking.
Installation
Install with npm
$ npm install bpm.js
Example
var bpmSink = require('bpm.js')
var spawn = require('child_process').spawn
createAudioStream("track.mp3")
.pipe(bpmSink())
.on("bpm", function(bpm){
console.log("bpm is %d", bpm)
});
// needed to convert mp3 to proper format
function createAudioStream(filename) {
var args = "-t raw -r 44100 -e float -c 1 -".split(" ")
args.unshift(filename)
var sox = spawn("sox", args)
return sox.stdout
}
Tests
$ npm test
To make the tests pass install the following native dependencies:
apt-get install sox
apt-get install libsox-fmt-mp3
Brought to you by...
This source code was human-transpiled from the C version here:
http://www.pogo.org.uk/~mark/bpm-tools/
License
GPLv2
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].