Hey! Ah cool, think I saw that one. For sure, I can let you know a bit about the code.
First and foremost, I would say that the software’s most important feature is the detection and analysis of beats within a provided audio source. Most things in the software make use of these beats in some way. For example, the spinning sphere flashes on the beat usually.
My beat detection system is a kind of custom simplistic one I wrote myself. I’ll quote you what I wrote last time, perhaps it’ll help you
I used a FFT (Fast Fourier Transform) object (docs). This allows you to split the audio into a spectrum (multiple bouncing frequency bands, like you might see on a graphic equalizer).
Since my music has a pretty constant pulsing bassy beat, I simply access the value for the lowest band of the FFT (number 0), then set a threshold for what constitutes a beat on that band. I also have a sensitivity value that I can change on the fly, so that 2 beats aren’t detected too close together. This works reasonably well, and is something I can quickly mess with at live shows if the beat detection goes wrong (I have threshold and sensitivity mapped to the arrow keys).
Here’s some code for that last bit:
if (frameCount >= mostRecentBeatFrameCount + sensitivity) {
if (selectedAverageBandLevel > chosenThreshold) {
mostRecentBeatFrameCount = frameCount;
}
}
So yeah, pretty simple solution, works well for live situations with 4x4 bass heavy music. There’s definitely, definitely better ways to approach it though. You can find scientific papers and other writings online about better beat detection methods, I would like to implement one one day!
One you are detecting beats, it’s should be straightforward to create some visuals. For example: when you detect a beat, flash a colour up on screen for a few frames (that’s one I use). Then you’ll have a pulsing effect, in time with music. Any parameter that processing allows you access to, you can manipulate in time with your detected bits, and create cool music reactive effects. That part is all about experimentation, to see what works well!
Hope that helps, cheers!