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 Mathematics & Computer Science · Entry J1428

Resources

Related projects

Closest projects by meaning, across every fair and year in the corpus.

Browse more like this

Source: California Science & Engineering Fair public projects

Save projects to your library

Sign in with Google to keep track of projects you find interesting, organized into folders. An account also raises your daily allowance for “Has this been done?”, and lets you create a key for the MCP server with a much higher limit than anonymous use. Browsing stays public.

Continue with Google