Skip to content

Instantly share code, notes, and snippets.

@htor
Created June 27, 2017 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save htor/efe15236a590688c86214070d2e8592e to your computer and use it in GitHub Desktop.
Save htor/efe15236a590688c86214070d2e8592e to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://unpkg.com/bpm-detective@2.0.1/dist/bpm-detective.js" charset="utf-8"></script>
<script>
let context = new AudioContext();
fetch("01 Xtal.mp3")
.then(response => response.arrayBuffer())
.then(data => context.decodeAudioData(data))
.then(buffer => {
try {
const bpm = DetectBPM(buffer);
alert(`Detected BPM: ${bpm}`);
} catch (err) {
console.error(err);
}
});
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment