Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function calculateBetterBPM(danceability, energy, currentBPM) {
bpmWeight = 0.9;
}

const weightedAverage = (normalizedDanceability * danceabilityWeight + normalizedEnergy * energyWeight + normalizedBPM * bpmWeight) / (1 - danceabilityWeight + 1 - energyWeight + bpmWeight);
const weightedAverage = (normalizedDanceability * danceabilityWeight + normalizedEnergy * energyWeight + normalizedBPM * bpmWeight) / (2 - danceabilityWeight - energyWeight + bpmWeight);
let betterBPM = weightedAverage * maxBPM;

console.log({danceabilityWeight, energyWeight, currentBPM, weightedAverage, betterBPM, bpmWeight})
Expand Down Expand Up @@ -301,4 +301,4 @@ async function main() {
});
}

export default main; // Export the main function for use in the application
export default main; // Export the main function for use in the application