Skip to content

Instantly share code, notes, and snippets.

@Supinic
Created November 26, 2020 20:31
Show Gist options
  • Save Supinic/8c7b6cb5fe435b25c0f42aeac3118a27 to your computer and use it in GitHub Desktop.
Save Supinic/8c7b6cb5fe435b25c0f42aeac3118a27 to your computer and use it in GitHub Desktop.
essentia.js + necrodancer
(async () => {
const essentia = require("essentia.js")
const time = {
start: process.hrtime.bigint()
};
const file = await require("fs").promises.readFile("D:\\pirate gay remake.wav");
time.file = process.hrtime.bigint();
const vector = essentia.arrayToVector(file);
time.vector = process.hrtime.bigint();
const result = await essentia.BeatTrackerDegara(vector, 208, 40);
time.beats = process.hrtime.bigint();
const nam = [];
for (let i = 0; i < result.ticks.size(); i++) {
nam.push(result.ticks.get(i));
}
console.log("fs" , Number(time.file - time.start) / 1e9);
console.log("vector", Number(time.vector - time.file) / 1e9);
console.log("beats", Number(time.beats - time.vector) / 1e9);
console.log("beats detected", nam.length)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment