DEV Community

Swaram
Swaram

Posted on

I built a free AI chord finder with zero npm dependencies

I built Swaram, a free AI-powered chord finder. Upload any audio file and get the chord progression, key, and time signature detected automatically.

Try it: https://ecoliving-tips.github.io/chord-finder.html

Why I built it

I play guitar at my church in Kerala, India. Finding chords for Malayalam Christian songs is nearly impossible online. Paid chord finder subscriptions like Chordify Premium felt wrong for something that should be free.

So I built my own — and made it work for any song, any genre, any language.

Tech stack

  • Frontend: Vanilla HTML/CSS/JS — literally zero npm dependencies
  • Backend: Python (FastAPI + librosa) on Hugging Face Spaces
  • Hosting: GitHub Pages (free)
  • Build: Custom 300-line Node.js static site generator (no webpack, no bundler)
  • PWA: Full offline support with service worker
  • i18n: English + Malayalam

No React. No Next.js. No Tailwind. Just plain HTML and CSS variables for theming.

How the AI chord detection works

  1. Audio is resampled to 16kHz mono
  2. HPSS (Harmonic-Percussive Source Separation) isolates tonal content
  3. Chroma CQT features extract the 12-note harmonic profile per frame
  4. Template matching scores each frame against 48 chord templates
  5. Viterbi decoding smooths the raw chord sequence into musically coherent progressions
  6. Post-Viterbi key refinement detects whether the song is in a major or minor key

The hardest problem? Distinguishing minor keys from their relative major (e.g., C minor vs E-flat major). I'm using a scoring system that weighs dominant V7 presence, tonic resolution in the first/last chords, and diatonic chord membership.

What I learned

  1. You don't need a framework for most websites. Vanilla JS is fast, debuggable, and has zero build overhead.
  2. Hugging Face Spaces is incredible for deploying ML models for free. Git push and you have a live API.
  3. Chord detection is HARD. Music theory has so many edge cases — slash chords, split bars in 3/4 time, enharmonic spellings.
  4. GitHub Pages + a custom build script is an underrated hosting combo. Zero cost, instant deploys.

Try it out

Upload an MP3 of any song and tell me how accurate the chords are. I'm actively improving the detection algorithm and would love real-world test cases.

What songs should I test it with? Drop suggestions in the comments!

Top comments (0)