Beat detection might be the most difficult... The bass isn't always the best indication of beat. Sometimes it's a snare drum, etc.
------------------------------------------------------------------------------------
First off, you need the "right" connection or the "right" microphone/circuit, etc.
Typically, you'll use a line-level headphone-level) audio signal and bias the input so you can read the negative-half of the audio signal. My post for
The Worlds Simplest Lighting Effect has an attached schematic for a bias circuit.
------------------------------------------------------------------------------------
Amplitude is pretty straightforward as long as you understand that you are sampling a waveform so you need to find the peaks, or the RMS, or the average of the absolute values, or the average of the positive half of the waveform, etc. My "Simplest Effect" looks for the peaks. The waveform is positive half the time and negative half the time, so the true-average, ignoring or subtracting any "artificial" bias, is zero.
I didn't do this for my "simplest effect" example, but generally use a peak detector (AKA envelope follower) which converts the waveform into a varying DC voltage proportional to the peak amplitude. That simplifies the software and I only have to sample about 10 times per second instead of thousands of times per second. But of course, you loose frequency information.
------------------------------------------------------------------------------------
FFT (or FHT) can give you the frequency information (the amplitude of each frequency band) and there are FFT & FHT libraries for the Arduino. If you search YouTube for "Arduino Spectrum Analyzer" you'll get some ideas of what you can do with FFT.
I don't know if the MSGEQ7 will give you the resolution you want, but if it works for you, it greatly simplifies your software and it takes care of the bias issue. It gives the same information as FFT (amplitude for each frequency-band) but it's done with filters in hardware.
------------------------------------------------------------------------------------
I've done crude beat detection and for my purposes I
like the imperfect beat detection. I wasn't trying to "calculate" BPM, I was making lights blink/change with the beat.
Here's something I wrote previously:
I don't know how this is done "properly", but I've made a crude beat detector. I lost the source code in a computer crash but here's how it works.
1. I read and save the peak value (presumably the beat).
2. I delay about 1/4 second (maybe 200mS, I don't remember for sure) to prevent a false trigger.
3. Then I look for another peak equal to (or greater than) the previous peak and over then next several milliseconds the trigger threshold drifts down in case the next beat isn't quite as strong as the last one.
4. When a beat is triggered, I save that as the new threshold and start the loop over.
This is NOT perfect and it's NOT triggered by every beat. But that's OK for my sound activated lighting effects because I don't really want a boring-constant 1-2-3-4-1-2-3-4...
I don't do any bass filtering. I don't know if that would make it better or not. Sometimes there is a snare drum that emphasizes the beat.
What I think WOULD really help would be something that calculates and "remembers" the timing... For example, when you dance or tap your foot to the beat you don't wait 'til you hear the beat... You "get in rhythm" and you anticipate the next beat.