I have been learning Carnatic music for most of my life, and one thing that never changed no matter how much I practiced was how the theory got taught. You listen to your teacher, you try to reproduce what you heard, and slowly, over years, your ear learns to recognize swaras and ragas. There is no in-between step where you sing something and immediately get told what you just sang.
That gap is what led to Swarabodha.
The problem I wanted to solve
Most Carnatic music theory tools I found online were static reference charts. They tell you what a raga is supposed to sound like on paper, but they do not listen to you. If you are not sure whether the phrase you just sang actually maps to a real swara sequence, there is no quick way to check without a teacher sitting next to you.
I wanted something you could sing into and get instant feedback from, in the browser, without installing anything.
How it works
Swarabodha listens to live microphone input or an uploaded audio clip, detects pitch in real time using the Web Audio API, and maps each detected pitch to its exact swarasthana across the 16-note Carnatic scale. Those individual notes get sequenced into a swara pattern, and that pattern is matched against a raga database built from arohana, avarohana, and characteristic phrase data, all of it running client-side in the browser.
I also built a companion Python and PyQt desktop app, Swara Synth, that reimplements the same detection and raga-matching engine natively for offline use.
The hardest part: keeping pitch detection honest
Pitch detection sounds simple until you actually try to do it on a sustained, pure tone. My first version of the autocorrelation-based detector kept octave-jumping. It would lock onto a harmonic instead of the actual fundamental frequency, which meant a note sung cleanly could get reported an octave too high or too low.
The fix was to stop chasing the global maximum in the autocorrelation output and instead pick the first strong peak. I verified the change against a synthetic S-R2-G3-P-D2-S test phrase, checking that every note landed on its correct swarasthana before trusting the detector on real singing.
Porting the same logic to a second runtime
Building Swara Synth as a native Python and PyQt app, alongside the browser version, turned out to be one of the more useful parts of the project. Reimplementing the exact same pitch detection and raga-matching logic in a completely different runtime, Python and Qt instead of TypeScript in the browser, forced a lot of assumptions I had baked into the original implementation out into the open. Anything that only worked because of a JavaScript-specific quirk had to be rewritten properly.
What I learned
This project sat at an intersection I do not get to work in often: signal processing, music theory, and frontend engineering, all in service of something rooted in music I actually grew up performing. It reinforced that porting a system to a second environment is one of the best ways to find out what your code actually depends on versus what it just happens to get away with.
Try it
Swarabodha is live and open source. You can try the browser app or check the code on GitHub.
