Electronic – How to measure loudness

analogmicrocontrollermusicsoundwave

I was toying around with an idea for a digital musical instrument with breath control. I've successfully experimented with pressure sensors and they are probably the right way to go, but my first idea was just using a plastic sealed microphone. I never got very far with it, but I think it still has potential for the kind of response I want.

The idea was that a stream of air directed to the hit the microphone would generate white'ish noise (just thinking blowing on a mic) and I could use the loudness of this noise to create the ADSR envelope for my sound. Covering the mic with plastic sheeting still allows this to work and protects it from the moisture in your breath.

However, most of my electronics experience is digital (from discrete digital in college to microcontrollers now) and I'm more of a programmer. I got as far as looking at the noise signal on my 'scope and verifying that it had the characteristics I wanted (to use the smoothed, positive magnitude of the noise as the loudness of the synthesized tones) and I know that if I can get it to a wide enough analog range I can use an ADC to get a digital magnitude. What I lack is the analog knowledge to take the noise waveform and transform it to a varying analog signal representing the average positive magnitude at a fairly high sampling rate.

Any ideas or links to get me started?

P.S.
I won't really know which answer is totally correct until I get do some experimentation, but the responses have been great so far. The VU meter is pretty close that what I need and the reminder that loudness is logarithmic is useful as well.

It may have been easier to state my problem this way: I want to control a digital tone (either generated or via MIDI) where the "loudness" of the tone is proportional to the intensity of the sound generated by blowing on the mic if that makes any more sense.

Best Answer

Loudness is roughly correlated to RMS amplitude, not to peak amplitude, so you need to

  1. sample the input regularly, recording the samples to memory
  2. take a chunk of samples and square each
  3. take the average of all the resulting values
  4. square root

You can probably simplify this depending on how much accuracy you need.


Oh wait, you want analog output. You can put the wave through a precision rectifier (schematics) to get the absolute value, and then filter with an RC filter to get its envelope, as in the circuitry leading to pin 5 of this schematic. Instead of that IC, pin 5 would be your micro's ADC. It's not RMS, but it will show you approximate loudness. This is how most VU meters work.