Go Down

Topic: Comparing frequencies with FFT (Read 2 times) previous topic - next topic


It is not at all trivial to recognize a particular sound from its FFT spectrum. But it may be possible that particular frequencies will show up in a baby's cry and not in other sounds.

A baby's cry has a frequency of 3500kHz on average. Is it possible to get the spectrum of that frequency and compare it to the samples?

For what purpose?

I'm working on a surveillance system for baby. It includes a PIR sensor, a sound sensor and a GSM module. The purpose is to detect if the baby stopped breathing or started crying and send an alert SMS to the parents.
I'm only having a problem with the sound sensor part.

It sounds like you're relatively new to audio analysis, to programming, and to this hardware.  You've selected a very challenging early project.  If you have a high tolerance for frustration and disappointment, then by all means, proceed.  If not, you might be better advised to start with easier projects with hope of quicker success, and less rigorous theoretical demands.

Yes I am new to audio analysis and Arduino, I can manage myself in programming.
It's a school project and I need to make it work for the sake of my grades xD
I have a teacher supervising me but he's an expert on STM boards he only can help me with the algorithm and a bit in the coding but I have to figure it out on my own first.
Isn't there an alternative way to get what I want then?

I assume that you're using an Uno.

Yes I am, I already mentioned it in my first post.

You'll need to characterize the sound you want to identify.  I don't really know how you're going to get sample data from a baby crying.  Maybe just run a recorder until you get what you want, or maybe introduce a recorder during the inevitable moments when somebody else unsuccessfully tries to quiet the baby.  For heaven's sake, don't make it cry just to get audio samples.

I assure you no babies will be harmed during the process xD
Do I have to get a sample data from a baby crying? Wouldn't it be a "particular baby" cry?

You'll also need to characterize the ambient sound in the environment where you'll use it.

We'll just consider that the baby is in a silent room sleeping peacefully until he wakes up and starts crying.

Thanks for your help.


OK, it sounds like the audio part of this problem is to discern the difference between these two conditions:

  • A quiet room, and

  • An otherwise quiet room with a baby crying in it.

The fact that it's very easy for a human to make that distinction is promising.  Here are some differences that we'd expect to find between when the baby cries:

  • The total audio signal will be louder overall - maybe a lot louder

  • The signal will have significant content at baby-crying frequencies

A start might be to find some audio files of babies crying, play them to your Arduino in a quiet room, and observe the output of the FFT with and without crying.  It will be easier to see the differences graphically.  I usually print the output to the serial monitor, copy it to a spreadsheet, and graph it.  There may be better or more convenient ways to do it.  A quick google finds a number of mp3's of babies crying.

A more fundamental approach would be to use test tones with known spectral content, to verify that the assembled project accurately reflects the audio signal.  I'd recommend this if it's important that you're able to accurately characterize how your system works, or how you derived your solution.  mp3 files of test tones are easy to google.

I have no expertise on the spectral content of babies crying.  I think that this:
A baby's cry has a frequency of 3500kHz on average.
is probably a typographical error, and that you meant to say 3500 Hz, or maybe 350 Hz.  3500 Hz is the third-highest white key on a concert piano - it's a really high note.  The first estimate of the pitch of a baby's cry that I found was 515 Hz.

Note that the output that you can expect from your code is a logarithmic representation of the Fourier transform.  That representation compresses the magnitude of the spectrum: it de-emphasizes large spectral components, and emphasizes small ones.  You might want to experiment with a linear representation.  You can find information about how to get that in the fft_read_me.txt file in the openmusiclabs FFT library.

What's your current understanding of the meaning of the FFT output?


Mar 01, 2014, 06:37 pm Last Edit: Mar 01, 2014, 08:21 pm by jremington Reason: 1
Audio spectrograms (FFT amplitudes versus frequency and time) are 3-D representations of audio samples and have been used extensively to characterize bird songs, animal vocalizations, etc. See  http://en.wikipedia.org/wiki/Spectrogram

I used to use a program called Spectrogram (for the PC) in teaching this material and found it to be extremely helpful. A quick search did not turn up that particular program, but many others like it are available and are free or inexpensive. If you are interested, I recommend that you spend some time learning about spectral analysis using a well documented, correctly functioning program on a PC or Mac before you tackle the subject with an Arduino. Raven Lite from Cornell is a free demo of a professional program that runs on all PC-type platforms and may be a good place to start. http://www.birds.cornell.edu/brp/Raven/RavenOverview.html
"It seems to run on some form of electricity"


if it is a quiet room,  just detect any noise.


Hi Guys !
Just windering if someone can tell us what happened :)
Iam trying to get my Arduino to detect breaking GLAS in a car that is parked in a quiet spot.
Is there anyone that can help me ?

Thank you all !

Go Up