<< Chapter < Page | Chapter >> Page > |
One of the algorithms we chose to implement was a beat detections algorithm. In the game this maps to a pulsing visualization.
When a drum is hit, a spike in energy occurs across all frequencies. When a bass guitar is plucked, there is a spike in energy in the lower frequires. As these two instruments are commonly used in modern music to give a song rhythm or a beat, we decided to look at energy in the lower end of the spectrum. Theoretically, this should automatically filter out other spikes of energy created by a vocalist or electric guitar.
Beat detection on metric's "gimme sympathy"
Beat detection on flogging molly's "don't shut 'em down"
If a beat is detected, its sample number is recorded in a vector. If a beat spikes for multiple samples, multiple beats would be recorded which leads to an overestimation of the current tempo. To account for this, we merely look at the samples, detect a leading edge where the first beat is recorded, and ignore all subsequent sequential beats.
Notification Switch
Would you like to follow the 'Tetris sound: using music to affect gameplay' conversation and receive update notifications?