I was thinking about the Jukebox ASA project a bit this morning. After talking with one of the group members yesterday about adding LED ribbons to the project, I got to wondering how complicated it would be to detect the beat of whatever song was playing so the LEDs could flash to the music. Turns out, it’s not too difficult! It only took me 5 minutes to find three viable looking guides for finding the beat. From there it would be a simple matter of turning a Raspberry Pi GPIO on/off. I’ve listed the beat-finding guides here in order of which I think you should try.
- Librosa library with beat tracker demo
- Aubio library with TapTheBeat demo
- Learn Audio Beat Tracking for Music Information Retrieval
- Index of python music libraries
For playing the actual MP3 files, I’m expecting the project team to use PyGame since that is what you have past experience with. A reminder that there is code for that here. The only other thing missing is for you to tell when your song has finished playing, so you can start the next song in the queue. Pygame lets you find out through the
.get_busy() function as shown below.
song_is_playing = pygame.mixer.music.get_busy() # returns True or False
I’m looking forward to seeing this project finally come together!