bpm-detective
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "bpm-detective", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Detects the BPM of a song or audio sample", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -15,3 +15,3 @@ # bpm-detective | ||
The module exports one function. The function takes an [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) as it's only argument. It returns a promise that resolves to the detected BPM. If the sample was too short or if, for any other reason, the detection failed, the promise will be rejected. | ||
The module exports one function. The function takes an [AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) as its only argument. It *returns the detected BPM*. If the sample was too short or if, for any other reason, the detection failed, the method *throws an error*. | ||
@@ -27,14 +27,13 @@ ```javascript | ||
.then(response => response.arrayBuffer()) | ||
// Decode audio into an AudioBuffer | ||
.then(data => context.decodeAudioData(data)) | ||
// Run detection | ||
.then(buffer => { | ||
// Decode audio into an AudioBuffer | ||
return new Promise((resolve, reject) => { | ||
context.decodeAudioData(buffer, resolve, reject); | ||
}); | ||
}) | ||
// Run detection | ||
.then(detect) | ||
// Log error | ||
.catch(::console.error) | ||
// Log result | ||
.then(bpm => console.log(`Detected BPM: ${ bpm }`)): | ||
try { | ||
const bpm = detect(buffer); | ||
alert(`Detected BPM: ${ bpm }`); | ||
} catch (err) { | ||
console.error(err); | ||
} | ||
); | ||
``` | ||
@@ -41,0 +40,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
1526143
45