lallulli / doorbell

Doorbell sound detector

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doorbell

This program can detect simple, continuous sounds, like the sound of a doorbell or entryphone, if it is generated by a buzzer. It is not suitable for "dling dlong"-like doorbells.

This program can discriminate between multiple different sounds. It uses Fast Fourier Transform for sound similarity analysis.

Once the sound is detected, an arbitrary action can be performed, such as calling a webhook. You can use services like IFTT to react to sound detection. For example, you may send a notification to your phone.

The program can be run on ARM-based devices, such as Odroid C2, incurring a minimal CPU usage.

Installation and configuration

Install dependencies:

sudo python3 -m pip install -r requirements.txt

On ARM-based devices, you may need to install NumPy from your Linux distribution. For example, in Ubuntu:

sudo apt-get update
sudo apt-get install python3-numpy

Then, in src directory create a settings.py file by copying settings.py.tpl:

cd src
cp settings.py.tpl settings.py

You may need to explicitly set your sound card device id in settings.py. To get the id of available sound cards, run the following command:

python -m sounddevice

Recording sample sounds

First, you need to record a sample for each sound you want to detect.

Enter src directory, and when no sound is played, run the command:

python doorbell.py SOUND_NAME  

Wait for Waiting for sound message. Then, shortly play your sound. 1 second is enough. The program detects your sound and saves a SOUND_NAME.npy "fingerprint" of your sound in current working directory.

Repeat the operation for all the sounds you want to detect.

Detecting sounds

Start sound detector by running

python doorbell.py

If you want to call a webhook upon sound detection, set a webhook URL in settings.py.

About

Doorbell sound detector

License:MIT License


Languages

Language:Python 87.5%Language:Smarty 12.5%