Is there a way to detect either time signatures or to find the time until the next beat of a currently playing sound?
I am currently working on a Pong project and want to make the ball move across the screen in time with the music.
Thank you in advance for any help!
- Saryu asked 11 years ago
I can always hard code the time signature and force it to work, but generally I find hard coding anything to be in bad practice. The idea is that the user can put any mp3 or wav file into the Music folder, the program does a quick batch search of the folder, populates a music list, and the user selects a song from that list. The song is then either analyzed and varying time signatures at song times loaded OR the time in ms from the current beat to the next beat is recorded.
Based off of either one of these pieces of data, it’s trivial to set the ball to follow the beats.
Maybe that’s a little more clear as to what I’m trying to accomplish.
Beat detection isn’t really a simple or entirely accurate process if you’re trying to write code to do it from scratch, I know there is software around that does it though. If you can find a way of doing it then I’d store the bpm of a song in a separate file and let the user check whether it is correct and edit if necessary ie. if it detects something as 120 bpm when it’s actually 60. Not going to work with everything though if a song doesn’t start on a beat or has variable tempo.
- identitycrisisuk answered 11 years ago
Please login first to submit.