Created
October 28, 2022 15:37
-
-
Save WoolDoughnut310/b49fad4596a8092e7f1439a90d7d039e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |
export default function extractFeatures(audioData: any) { | |
const features: number[] = []; | |
for (const [algorithm, identifier] of Object.entries(algorithms)) { | |
const algorithmFunc = essentia[algorithm]; | |
const value = algorithmFunc.call(essentia, audioData); | |
if (algorithm === "KeyExtractor") { | |
// Parse key returns array of 2 values | |
features.push(...parseKey(value)); | |
} else { | |
value[identifier] = Number(value[identifier].toFixed(2)); | |
features.push(value[identifier]); | |
} | |
} | |
return features; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment