Sound monitor for a child's room

Does anyone know of any code (I'm a copy paste coder at the moment but developing...) which would sample the noise level in my son's room say every five seconds and only if the noise is CONSISTENTLY above a threshold on (say) three subsequent checks do something? I want to avoid the odd door slam or dropping a CD case from triggering the sensor. Basically what I want to 'catch' is if he's listening to music or a story tape early in the morning and annoying the neighbours without waking me up! We're on separate floors and he could be 'happily' listening to a CD which would be loud enough to wake the neighbour through the party wall but NOT loud enough to wake his parents upstairs!

The only thing I've found so far is this, but not sure if it's the right thing.

Thank you!

(This isn't an excuse for parenting, if you ask me, more - it's to give me the chance to come down and have a word!!)

It is not, of course, my business to tell you how to bring up your son. However, I feel it approprate to tell you about my mother as her behaviour seems, to me, to have some bearing on this. My mother had no respect for my privacy. As I boy I didn’t really understand it in those terms. What I did understand is that I had to pester my dad to fit a lock to the bathroom door and to my bedroom door. I put signs on cupboards in my bedroom saying ‘KEEP OUT’. The signs were ignored. For a boy to have his privacy invaded by his mother coming into the bathroom while I was in the bath, not by accident, but quite deliberately and without respect was utterly horrifying. As an adult looking back I realise she had not the slightest clue the effect that was having. As an adult I realise that if you share a house and a bedroom or bathroom door is closed then you knock or shout then wait to be invited in, or not as the case may be. You don’t just walk in.

I realise you are not proposing the same thing exactly, but to my mind it’s pretty close.

As an adult I had a very poor relationship with my mother.

This doesn't have to do with privacy but much more with general behaviour.

For this project, I'd use a sound sensor (there are various kinds around). Two basic types: analog and digital output. The second just gives a signal if the sound is above a certain level, while the first tells you more about the actual level of the sound.

One measurement in 5 mins won't cut it as sound levels go up and down all the time. Measure constantly, sampling 10 times a second or so, and record whether the sound is higher or lower than a threshold. Do this for say a minute, and if say 500 of the 600 samples are above the threshold it's too loud. These numbers sound like a good starting point, adjust as needed.

This will filter out short loud noises as that gives maybe a dozen samples above the threshold in an otherwise quiet series.