To the left is a spectrogram of my cat purring very clearly and loudly into the microphone. I've dropped the sample rate down to 600 hz so lower frequencies are more visible. You can see a very clear bump in intensity starting around 20-25hz and appearing again up at higher harmonic frequencies. This matches what I expect to see based on data which shows domestic cats have been measured to purr around 21-27hz.
Based on this measurement it looks like detecting strong intensities around 21-23 hz would detect a cat purr.
You can also see in the second image the hardware can be put together into a simple wearable collar. I took two pieces of velcro and sandwiched the hardware in the center. Holes were cut out to show the LEDs, USB mini port, and microphone.
Unfortunately in practice I found trying to detect purrs reliably is quite difficult. The spectrogram to the left shows more typical data, where the movement of the cat against the microphone (or even biting the microphone!) generates a lot of noise which obscures the purr. The noise unfortunately leads to false positives which make the purr detection unreliable.
Reliable purr detection will likely require more work to analyze the audio and try to remove sources of noise. Some ideas to consider are:
- Run filters to remove higher frequency noise from the audio.
- Look into better ways to place the microphone so it's less susceptible to noise from movement or rubbing.
- Look into alternative ways of detecting purr vibrations. Could an accelerometer detect the ~20hz vibration without as much noise?
Continue on for a summary and some ideas for other applications of the Fourier transform.