5
$\begingroup$

I’d like to use my Raspberry Pi to record when and how often my dog barks. But for privacy reasons, I don’t simply want to record the loudness in the room, so I have to automatically detect barks.

How would I do that?

$\endgroup$
  • 1
    $\begingroup$ I can program, but have little idea about Signal Processing, so I’m hoping for some existing tools that I can “just use”. $\endgroup$ – Joachim Breitner May 17 '15 at 19:29
  • $\begingroup$ Hmm. A downvote without a comment. I’m obviously new here, so I would appreciate an explanation about why this is a bad question. $\endgroup$ – Joachim Breitner May 17 '15 at 21:28
  • 1
    $\begingroup$ A GOOD QUESTION! An arrogant voter, may be with too many spares to waste. First you need to develop a "signature" of the barking by analyzing the typical sound created by your dog barking. This signature may utilize typical voice analysis for human voice recognition (may be you could use of the shelf SW or open source). Once you have the signature, you need to create a program that monitors continually the voices in the room and detect such barking with a certain PD and PFAR. You may utilize a circular buffer to record time periods that will allow you also to record barking identified periods $\endgroup$ – Moti May 17 '15 at 22:12
  • 1
    $\begingroup$ For this kind of system I would try to make it as simple as possible. You want to prevent false alarms to not disturb your count. Is the environment you are going to use your system having a lot of other noises? If so you might want to just detect peak amplitude with a microphone and threshold it before you add it to your bark count. Barks are noticeably louder than many other kinds of sounds. $\endgroup$ – panthyon May 18 '15 at 1:55
  • $\begingroup$ This paper gives a pretty thorough overview on acoustical characteristics of barks if you really require something sophisticated, but I always would favor simplicity. drsophiayin.com/docs/YinMcCowan04.pdf $\endgroup$ – panthyon May 18 '15 at 1:56
2
$\begingroup$

Interesting question. Take a look at: http://www.dsprelated.com/showthread/comp.dsp/129392-1.php And keep in mind that there are commercial products out there to identify barking and emit ultrasound when a dog barks, such as: http://www.ultimatebarkcontrol.com/dog-silencer.htm#tabContent

I don't know how complicated you'd want to make things (ie: detect just your dog barking, other dogs barking, detect a single bark, mutiple barks, etc.). Or, as mentioned by Moti, what kind of probability of detection (PD) or false alarm rate (PFAR) you'd like to achieve. I suppose the simplest approach would be to record several single barks from your dog, then set your phone to listening, and process the incoming signal. If the loudness level exceeds a certain threshold, and the time length seems appropriate, you'd suspect that it's a bark, and either cross correlate the suspected bark with your previous recordings, or compute the coherence function to determine the similarity of the incoming signal with the previous recordings.

Maximizing correct detections and minimizing false alarms may be difficult with a simple system, though. I don't know how sophisticated the commercial systems get, but you may want to look into them and see if you can garner any hints/suggestions.

| improve this answer | |
$\endgroup$
2
$\begingroup$

You don't necessarily have to keep a recording of the sound in order to process it. Just read in frames, compute the RMS energy (for example), and recycle your frame buffer. Essentially rewriting history and preserving your privacy. A circular buffer design would be suitable for audio processing (think about sliding windows in FFTs).

That said, while most commercial and open source dog bark detection systems rely on simply the volume of the dog bark, they are not very robust. If your neighbour is hammering away at some DIY woodwork, your system will trigger.

Regarding the Pi, if you're still working on this, maybe check out David Hunt's Pi-Rex project... maybe you can even improve upon it!

| improve this answer | |
$\endgroup$
  • $\begingroup$ The barking got better, so I won’t pursue it for now, but thanks nevertheless :-) $\endgroup$ – Joachim Breitner May 11 '16 at 7:41
  • $\begingroup$ Nice [: I'm glad you didn't have to resort to one of those terrible ultrasound-punishment techniques that some companies are suggesting... :/ $\endgroup$ – yunque May 11 '16 at 10:07
0
$\begingroup$

Here is the Bark detection script in Python.

| improve this answer | |
$\endgroup$
  • $\begingroup$ That’s just a noise detection script, isn’t it? $\endgroup$ – Joachim Breitner Feb 14 '17 at 14:29
0
$\begingroup$

You could train a deep learning AI to classify the sounds for you, then use that as an event source.

https://medium.com/@mikesmales/sound-classification-using-deep-learning-8bc2aa1990b7

| improve this answer | |
$\endgroup$
-1
$\begingroup$

Use a directional microphone. Shotgun mikes work excellent. Point at dog location and have recording start at a db level you determine by experiment. You can weed out high frequencies (non dog barks) by simply placing a piece of plastic wrap looselystretched over a toilet paper roll attached to and in front of the microphone.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.