If you can detect sound, you can detect loudness.
Then it’s just a matter of using [u]if-statments[/u] to take different actions depending on loudness.
For example (this is the basic logic, not actual C code) -
If ADC reading is < 100, it’s quiet so do nothing.
If ADC reading is > 99 and < 200 do something.
If ADC reading is > 199 and < 300 do something else.
- Raised voice
However, that is probably trickier than you think… People speak at different volume levels and it depends on how close they are to the microphone.
If you already have an Arduino and micrphone/preamp you can experiment by [u]reading the analog-to-digital converter[/u] and sending the readings to your computer via the [u]Serial Monitor[/u]. That should give you some quick results to find out if your project is feasible.
If you don’t yet have the hardware, I’d suggest you make some recordings and “analyze” the sound with an audio editor. If you don’t already have an audio editor, [u]Audacity[/u] is free, it can record, and it will display waveforms. And, there is an easy trick for finding the (relative) peak loudness if you’re not getting enough information from looking at the waveforms.
[u]This microphone board[/u] has a microphone, the electronics for powering an electret mic, a preamp, and a bias circuit so you can read the negative-half of the audio signal. (You don’t need the negative side for “loudness” but the Arduino can be damaged for actual negative voltages. The bias can be subtracted-out in software.) The one thing that board is lacking is a gain/sensitivity control.