🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

bpm-detective

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bpm-detective - npm Package Compare versions

Comparing version

to
2.0.1

2

package.json
{
"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 @@