Skip to content
vedsmehtaPublic

About

MacOS Guitar Tuning Application

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pytuner

A macOS guitar tuner built with a custom implementation of the YIN and YAAPT pitch detection algorithms. Originally developed for the 2021 Georgia Science and Technology Fair — 2nd Place in Project Programming.

Overview

pytuner detects the pitch of a live microphone input or audio file and matches it to the nearest guitar note (E2–E5). The app provides a tkinter GUI with a note display, tuning indicator, and a reference note playback feature.

Two pitch detection algorithms are implemented from scratch:

  • YIN — autocorrelation-based method using the cumulative mean normalized difference function (CMNDF), based on de Cheveigné & Kawahara (2002)
  • YAAPT — "Yet Another Algorithm for Pitch Tracking," using AM-FM decomposition via the amfm_decompy library

YIN is the default. YAAPT is available as an alternative and is more robust on noisy or complex signals.

Installation

Requirements: Python 3.7+, macOS (tkinter is bundled with the macOS Python installer)

git clone https://github.com/vmehta-11/pytuner.git
cd pytuner
pip install -r requirements.txt

If sounddevice has trouble finding your microphone, you may need to grant Terminal microphone access in System Preferences → Security & Privacy → Microphone.

Usage

cd tuner
python tuner.py

The GUI will open. Click Start to begin listening to your microphone. The detected note and tuning offset are displayed in real time. Use the note dropdown to play a reference pitch.

To switch between YIN and YAAPT, change the algorithm variable at the top of tuner.py.

Project Structure

tuner/
├── tuner.py          Main application and GUI
├── tunertools.py     YIN and YAAPT pitch detection, audio utilities
├── dropdown.py       Custom tkinter dropdown widget
└── GuitarNotes/      Reference audio samples (one .wav per note)
docs/                 Sphinx documentation source

How It Works

  1. sounddevice captures a short audio buffer from the microphone at 44100 Hz.
  2. The buffer is passed to YIN() or yaapt() in tunertools.py.
  3. The returned pitch (Hz) is averaged across frames using avg_pitch().
  4. quantize() snaps the frequency to the nearest note in the guitar frequency table.
  5. The GUI updates with the detected note name and cents offset.

License

MIT — see LICENSE.

About

MacOS Guitar Tuning Application

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages