Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tone.js and music-tempo: bpm detection mismatch #12

Open
jumeca opened this issue Nov 2, 2023 · 2 comments
Open

Tone.js and music-tempo: bpm detection mismatch #12

jumeca opened this issue Nov 2, 2023 · 2 comments

Comments

@jumeca
Copy link

jumeca commented Nov 2, 2023

Hi,
I am creating a web app using Tone.js and music-tempo to get the bpm of the song. Tone is creating an audioContext that gets the sample rate from my laptop (48000Hz) and music-tempo is calculating a tempo that is always 10 bpm less than what it should be (e.g. a song at 120bpm, I'm getting a result of 110bpm). I suspect that it could be because in the examples provided the audioContext is set to 44100 instead of 48000Hz. Any help would be much appreciated.

@killercrush
Copy link
Owner

Hello, you should set sampleRate of AudioContext to match sampleRate of your audio file

@jumeca
Copy link
Author

jumeca commented Nov 3, 2023

Thanks! I managed to fix it by passing the hopsize based on the sample rate of the audio context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants