Cat Purr Detection

Armed with knowledge of the Fourier transform and tools to analyze audio let's investigate detecting another signal, a cat purr.
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.



This investigation of cat purr detection highlights the challenge of dealing with noise when analyzing signals. It's relatively easy to get a signal and break it down into it's component frequencies with the Fourier transform. However with weak signals or noisy environments it can be quite challenging to make meaning of the output.

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?
I'm open to feedback or ideas that might help better detect purrs. You can look at this github repository for future info on my attempts at purr detection.

Continue on for a summary and some ideas for other applications of the Fourier transform.
This guide was first published on Oct 03, 2013. It was last updated on Oct 03, 2013. This page (Cat Purr Detection) was last updated on Nov 17, 2019.