Coder Social home page Coder Social logo

ebezzam / melody-detection Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 2.0 2.86 MB

(Whistled) melody detection workshop. First presented at LauzHack Days (Nov 13, 2018).

License: MIT License

Python 86.87% C++ 13.13%
signal-processing whistle-detector

melody-detection's Introduction

Fun Fourier Transform Workshop: Whistle Detector

Check out this Colaboratory notebook for the exercises!

  • Press "Open in Playground" under the toolbar in order to make edits.
  • You will have to be signed into your Google Account to run the notebook.

If you are having technical difficulties or prefer running locally, no problem! Go to "File > Download .ipynb". Locally, you don't need to run the cells with following lines of code:

from google.colab import files
files.upload()

Just make sure that the WAV files are in the same directory as the notebook.

Accompanying slides can be found here!

You can request for the solutions here or by emailing me: ebezzam[at]gmail[dot]com

Requirements if running locally

Make sure you have the packages specified in requirements.txt: matplotlib and pyserial are only needed for the NeoPixels demo.

Live testing of the whistle detector

Once you have completed the following functions from the notebook:

transcribe
estimateBaseFreq
dtw

Copy them to the utils.py file.

You can then run demo_audio_feedback.py to test the Whistle Detector! A command line prompt will appear; you can press "r+Enter" to record yourself and see if you can match the "passphrase". You should hear a bell if you whistled the correct tune and a buzzer if not.

If you have an Arduino and a NeoPixels 60 LED Ring, you can run demo_neopixels.py for a whistle detector that provides visual feedback (green for correct, red for incorrect). You will first have to flash your Arduino with neopixels_firmware/neopixels_firmware.ino.

Tuning the whistle detector

Think you got it right but it's not detecting the melody? Or perhaps your detection thinks everything is correct (false positives).

You can tune the whistle detector by adjusting the following parameters:

  • THRESHOLD at the top of the demo_*.py scripts. A lower value will be more selective, while a higher value will yield a less strict detector.
  • PEAK_WIDTH and E_RATIO in the utils.transcribe function.

Otherwise, you can tune your own whistling ;)

References

Workshop content is modified from material by Paolo Prandoni.

WAV file sources:

melody-detection's People

Contributors

ebezzam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

geocali lauzhack

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.