Skip to content

This python-script performs the task of recognition sounds and run specific commands after detecting these sounds.

Notifications You must be signed in to change notification settings

ThomasBS/Recognition-of-sounds

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Recognition-of-sounds

This python-script performs the task of recognition sounds and run specific commands after detecting these sounds.


Some technical details

This script is based on the creation of sound fingerprint for etalon .wav file.

(Etalon file is divided into parts.

Then in each part we are looking for frequency which corresponds to the max amplitude of sound.)

We get a list of frequencies

(It will be store in the file: frequency_list_etalon )

When we run

python cts.py standart 

We run endless loop.

Each iteration of this loop does:

  • create a short .wav file (0.5 sec),
  • make sound fingerprint of this short file,
  • make list of frequencies for it,
  • save this data in in the general list,
  • delete this short file.

(This loop is used for continuous listening microphone and recording data, when the script is running)

So we get a list of which is constantly supplemented.

Then we compare etalon frequency list and general frequencies list.

When a match occurs lists (80%) - run a command (run firefox)

For details --see code.


Usage

create etalon .wav file (script will recognize the sounds of this file and do the action (run firefox) )

python cts.py etalon

Run script

python cts.py standart

When the script is running, it waiting for the etalon sounds to do the action (run firefox)

Requirements

python 2.7

sudo apt-get install python-alsaaudio

pip install pyalsaaudio==0.8.2
pip install numpy==1.9.2
pip install scipy==0.15.1
pip install matplotlib==1.4.3

The script is based on ideas and parts of the code from this article:

http://habrahabr.ru/post/252937/

A short video, how this script works:

https://www.youtube.com/watch?v=hi8_oyXEssY&feature=youtu.be

About

This python-script performs the task of recognition sounds and run specific commands after detecting these sounds.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%