A fast, high-precision guitar tuner built as a cross-platform desktop application (Windows portable .exe) and modern web application. Powered by real-time Web Audio API signal processing and the YIN Pitch Detection algorithm for reliable pitch analysis across quiet audio inputs and diverse guitar tunings.
- YIN Pitch Detection Engine: Real-time time-domain autocorrelation pitch extraction with parabolic interpolation and RMS noise floor suppression.
- Auto & Manual Target String Locking: Automatically detects the closest string in real time or locks onto a target string.
- Preset & Custom Tunings: Out-of-the-box support for Standard E, Drop D, DADGAD, Open D, Half Step Down, plus an interactive Custom Tuning Editor.
- Audio Input Selection: Select dedicated audio interfaces (Focusrite, Behringer, etc.) or internal microphones dynamically.
-
Visual Cents Gauge: High-responsiveness needle gauge displaying exact cents offset (
$\pm 50$ cents) with instant visual feedback (Flat / Perfect / Sharp). -
Zero-Install Portable Executable: Standalone Windows desktop app packaged with
electron-builderinto a single.exefile.
| Category | Technology & Libraries |
|---|---|
| Frontend UI | React 19, TypeScript, Vanilla CSS design system |
| Audio Processing | Web Audio API (AudioContext, AnalyserNode), YIN Algorithm |
| Desktop Wrapper | Electron 43, electron-builder (Portable target) |
| Build & Dev Tooling | Vite 7, ESBuild, Concurrently, Wait-On |
| Testing & Quality | Vitest 3, @testing-library/react, Playwright (E2E), @axe-core/playwright |
| Linting & Formatting | ESLint 9 (Flat Config), Prettier, TypeScript Strict Mode |
| CI Automation | GitHub Actions CI |
The pitch detection algorithm extracts fundamental frequencies (
-
RMS Thresholding: Filters out background noise (
$RMS < 0.002$ ). -
Difference Function: Computes squared difference function across tau lags:
$$d_t(\tau) = \sum_{j=1}^{W} (x_j - x_{j+\tau})^2$$ -
Cumulative Mean Normalization: Minimizes octave errors by normalizing:
$d'(\tau) = \frac{\tau \cdot d(\tau)}{\sum_{j=1}^{\tau} d(j)}$ -
Parabolic Interpolation: Refines tau estimates to fractional sample resolution for sub-Hz accuracy:
$$f_{\text{detected}} = \frac{\text{sampleRate}}{\tau_{\text{interpolated}}}$$
Calculates pitch offset in logarithmic cents scale:
- Pitch status:
-
$|\text{cents}| \le 2$ : Perfect 🟢 -
$\text{cents} < -2$ : Flat 🔵 -
$\text{cents} > +2$ : Sharp 🔴
-
- Node.js (v18+ recommended)
npm
git clone https://github.com/Lanque/guitar-tuner.git
cd guitar-tuner
npm install
| Command | Action |
|---|---|
npm run dev |
Starts Vite web development server |
npm run desktop:dev |
Launches Electron desktop app in live-reload mode |
npm run build |
Builds web app production bundle |
npm run desktop:build |
Packages standalone Windows portable executable (.exe) |
npm run typecheck |
Validates TypeScript strict typing without emitting code |
npm run lint |
Runs ESLint 9 rules check |
npm run format:check |
Checks code formatting with Prettier |
npm run test |
Runs Vitest unit tests in watch mode |
npm run test:run |
Runs Vitest unit tests with v8 code coverage |
npm run test:e2e |
Runs Playwright E2E browser tests |
guitar-tuner/
├── .github/workflows/ # GitHub Actions CI configuration
├── electron/ # Main process entry point for desktop app
├── scripts/ # Build scripts for portable desktop packaging
├── src/
│ ├── audio/ # YIN pitch detection algorithm & audio math
│ ├── components/ # React components (Gauge, AudioPicker, StringStrip, etc.)
│ ├── domain/ # Tuning formulas, scale frequencies, cents calculation
│ ├── hooks/ # Web Audio API lifecycle hook (useGuitarTuner)
│ ├── App.tsx # Main tuner view
│ └── styles.css # Core styling & UI theme
├── vite.config.ts # Vite bundler configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Dependencies & scripts
To build a standalone, zero-installation .exe file for Windows:
npm run desktop:build
The output portable binary will be generated in release/Guitar-Tuner-0.1.0.exe.
Distributed under the MIT License. See LICENSE for details.