This library aims to get the BPM (beat per minute) automatically with Web Audio API.
To install Pulse.js with bower: bower install pulsejs
Here is a basic usage of Pulse:
var uri = "song.mp3";
var pulse = new Pulse({
// when Pulse has finished to compute main data: beat, significant peaks...
onComplete: function(event, pulse) {
var extrapolatedPeaks = pulse.getExtrapolatedPeaks(
pulse.renderedBuffer,
pulse.significantPeaks,
pulse.beat
);
// beat (ms and bpm properties)
console.log(pulse.beat);
// extrapolated peaks
console.log(extrapolatedPeaks);
}
});
pulse.loadBufferFromURI(uri);
This is a screenshot of a game based on rhythms like "Dance Dance Revolution". It show one of the several possibilities of Pulse.
Mark Ronson - Uptown Funk feat. Bruno Mars
Avicii - The Nights
Avicii - The Nights
The full documentation can be found on this repository.
- Install all grunt tasks:
npm install
. - Then run:
grunt watch
. - Write your tests and make your changes.
- Enjoy :-) and please do not forget comments.
Of course, all contributions are welcome.