Pitch Detection on Arduino Using Autocorrelation
CSEF · 2016 Mathematics & Computer Science
Overview
Objectives/Goals This project aims to create a device that reliably converts sound from an instrument into an array of notes. Methods/Materials Arduino Uno running C++, microphone with automatic gain control, credit card size printed circuit board, push button, 1.8″ TFT LCD screen, iPad running Garage Band (as synthesizer). Built a device to reliably calculate frequency of sound sample from microphone input, convert to notes and send to synthesizer as output. Results Evaluation criteria are: (a) no noticeable delay between the incoming audio signal and the digital MIDI output; (b) the correct pitch should be detected for the notes produced by a B flat clarinet and samples tested from the University of Iowa Electronic Music Studios; (c) the beginning and duration of each note should be consistently identified (called segmentation). Device results are that pitch detection on the test set was accurate from Eb3 (155.5 Hz) to G6 (1568 Hz). It missed the top three notes on clarinet, mainly played by professional musicians. Note level segmentation worked well and was verified by playing a clarinet while listening to the output of a MIDI synthesizer. Conclusions/Discussion While the project pushed the limits of the Arduino in processing power and available memory, it can be made for about $20. Excluding the optional display, the product fits on a very small device that can be clipped onto an instrument. Using a synthesizer, the notes generated by the device can be played simultaneously on different instruments. Or, using music notation software, these notes can be printed as sheet music. It was a fun, interesting and educational project that might benefit others.
Summary statement
I created a device that uses the mathematical principle of autocorrelation to convert sound it detects from a musical instrument into an array of notes.
Help received
I researched and developed the algorithms, built the device and performed experiments. My father, Coert Vonk, helped in reviewing my code to keep it organized and maintainable. He contributed a driver to digitize the analog input signal.
Competition history
- CSEF 2016
Resources
Related projects
CSEF · 2016
Are You in Tune? A Program to Make You a Better Musician
ISEF · 2019
MADSA: Musical Accuracy Development Using Spectral Analysis
CSEF · 2002
Harmonic Analysis: Using the Least Squares Method to Analyze Sound Waves
ISEF · 2014
Developing Automatic Music Transcription Software
CSEF · 2006
The Science of Music
ISEF · 2020
Stay Tuned: An Automatic Tuning Device for Violins
CSEF · 2014
Can You Hear That Note? A Specialized Hearing Aid for Musicians
CSEF · 2010
Synthesis of Piano Notes
Closest projects by meaning, across every fair and year in the corpus.
Browse more like this
Source: California Science & Engineering Fair public projects