When my dear friend Jana, who is a 6th grade teacher, told me about the difficulties of keeping a class quiet during silent reading, my inner techno-utopian sprang into action.
My goal was to create something that could be used to monitor noise levels and give feedback if things were too loud. Try out the Noise Analyzer here - you'll need to enable microphone permissions.
I was delighted to learn that microphone input had recently become easily available in the browser. Playing around in code, I quickly learned a few things.
First, raw input volume level is too erratic, and needs to be averaged out over a few samplings to get a sense for what's happening.
Second, basic "loud noise detection" is no good. Something like a creaking chair or a cough can be loud and abrupt, but isn't a problem. To address this, I implemented the "cumulative noise" meter which grows quickly, but also decays over time. Cough once, no problem. Make noise consistently for 10 seconds, you lose.
Finally, changes in ambient noise and microphone placement can make a big difference. To that end, adjustable settings are needed. I provided settings for the following:
Check out my professional work.
And a few personal projects.