Hi... Im wondering if someone here will know if is possible to do this...
(basically is for a friend who rents apartments, and sometimes neighbours complained about parties and else)
so the idea, is to set a device in the apartment that recognizes when the ambience sounds gets higher than allowed, an a red light and a beep alarm sound, so the people there realize and put the volume down...
In the web, I found some projects who turn on leds from green to red when inputing a sound (from low to laud)... but so far none wich produce a sound alert after some treshold is passed...
also it looks like one issue is to convert data in to db so the sound meter is acurate
Have you thought this through? You're saying that when the ambient noise is excessively loud you want to add some more noise by starting a beeper going? And obviously it will need to be a very loud beeper if it is to be heard above the already excessive noise.
Anything used for legal or regulatory purposes has to be calibrated & certified by an independent lab, and nobody is going to certify your homemade SPL meter.
It easy to calculate dB from an amplitude (as long as you have a reference). The reference the hard part so you'll need a real SPL meter (sound pressure level meter) to calibrate your "raw" ADC readings.
SPL is normally short-term averaged and [u]A-weighted[/u]. That's difficult in a "homemade" SPL meter. As long as you are always measuring the same thing (like a room full of people at a party) you can calibrate your meter to measure the same as the real meter. But when the nature of the sound changes, the readings will no longer match.
If you just want to set your own "annoyance level" without knowing the dB SPL, that's a whole lot easier.
If you still want to proceed, here is a [u]previous post[/u] where I give an example of how to calibrate & calculate SPL.
Also, you need to realize that sound is a pressure wave. Even with a constant-tone the pressure is changing moment-to-moment. It's positive half the time and negative half the time, and it crosses-through zero twice per cycle. So, the readings will "look random" (within a range) and you'll have to find the peaks, or take an average of the positive values, or an average of the absolute values, or calculate the RMS, etc. Any of those methods can work because you'll be calibrating, and it's not going to be perfect anyway.
If that's confusing, the [u]Audacity website[/u] has a little explanation of how audio is digitized.
Thanks DVDdoug ... in fact, I hadn't thought about the entire regulatory process ...
the truth, we were thinking about how to make the tenants aware of their noise ...
but you're right ... that's important too.
Regarding the project, (without knowing what you are telling me now) I attach a couple of codes that I found in github, and that I have been implementing for my project, but so far without much luck.