...if a sound abnormally exceeds that sound level it starts flashing a LED.
That should be possible as long as you have access to a real SPL meter for calibration.
I built a VU meter "effect". It's a string of LEDs that bounce up & down to the loudness of the music, but it's not a true
meter because it's not calbrated so it can't truly measure anything... In fact-it "self-calibrates" to the changing long-term average for lots of "meter action" no matter what the volume setting. (My meter effect doesn't have a microphone, it hooks-up to the line-output of an audio device. If I wanted to use a mic, I'd also need a preamp.)
Note that with music the average is typically around 18dB below the peak. The average correlates with perceived loudness better than the peak.
So, you'll probably want a short-term average (at least a second or so).
Also, since our ears don't have flat frequency response, there is something called A-Weighting
. You may be able to ignore this if you don't need super-accurate readings and if the "character" of the sound is always the same (crowd noise, music, etc.) as long as you calibrate with an accurate A-weighted SPL meter.
If you need A-Weighting, I'd guess it's easier to implement on the analog side, before the signal hits the Arduino ADC.
Maybe I need another sensor to capture ambient sound too?
If you want to digitally record
, uncompressed audio takes a ship-load of memory and I wouldn’t recommend the Arduino.
If you just want to record the loudness
or the loudest reading, that’s easier (depending on how many data-points you want to save).
It would also be super-easy to add a 2nd LED that latches-on (stays on) to "remember" if the threshold was exceeded.