Jump to content
  • 0

Can the Pmod MIC3 be used to read frequency in Hz or sound in db?


WaveRep

Question

1 answer to this question

Recommended Posts

@WaveRep,

Yes and no.  The PModMIC3 will allow you to sample an audio waveform.  Think of this as reading the deflection that sound will make upon a membrane (this might be literally how the MIC3 works).  A single membrane deflection often doesn't mean much, so you will need to measure many such deflections to capture an audio waveform.  The PModMIC3 can be used to do this.

Calculating frequency, though, is not such a simple task.  Your first difficulty will be the fact that most sound components are composed of energy at *many* frequencies.  Perhaps an example might help this discussion.  Below is a spectrogram from a discussion preceding one of my favorite songs.  Zero frequency is at the bottom, and frequency goes up from there to the top.  Time as well goes from left to right.  Energy, as in the amount of energy in the signal comes out of the page with black being the least energy and white being the most.

burning-bush.png.c1b011e7ed866e90cdedf30115071964.png

This image shows you, spectrally, what you might get from the PModMIC3: lots of frequencies at various volumes superimposed on top of each other.

Some applications, though, require frequency estimation--such as you are requesting.  For music applications this often means 1) generating a chart like this one vertical slice at a time.  This usually involves collecting samples together, windowing them, taking a Fourier transform, and squaring the complex valued result (see periodogram). 2) Picking the strongest component somehow.  There are lots of ways to do this.  Perhaps my favorite is to take an inverse Fourier transform of the result of the last step and to look for a maximum--the location of this maximum will be the period of the fundamental frequency that you are looking for. 3) Applying some form of frequency super-resolution method focused on this frequency alone to find the "frequency" of the dominant component in the chart.  While not strictly required, every application I've seen has done this.  There are many methods for achieving such superresolution.  One is to interpolate the peak location from the last step to get subsample resolution.  Another method is to take two Fourier transforms, separated by a short distance, and to look for a changing phase within the frequency bin of interest.  (See frequency detector) If you haven't guessed, there are whole fields of study designed for this task.

By "sound in db", I'm going to assume that you are looking for an absolute measure of the volume of sound received rather than decibels as a relative measure.  Again, the PMod MIC3 can be used for this purpose, but you need to start with sampled audio as before.  In this case, if you aren't interested in the strength of each individual tone, you might consider squaring the output of the PModMIC3 and averaging the result.  You'll then need to take a logarithm of this result.  For this purpose, that can usually be as simple as finding the highest bit set, and running a table lookup on the bits following.

In other words, doing what you want is a touch more involved--however, the PModMIC3 can be a valuable component of your solution.

Dan

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...