Inside Indian Patent No. 202621056495: Architecting AI Raag-Guided Lyric-to-Melody Generation
On July 3, 2026, our patent application was officially published in the Indian Patent Office Journal under Indian Patent No. 202621056495, bearing the title:
"Cloud-Based AI Raag-Guided Lyric-to-Melody Generation System and Architecture"
This patent represents over a year of rigorous engineering, musical scale mathematics, digital signal processing (DSP), and cloud architecture. In this article, I want to demystify the technical architecture behind our invention, explain the algorithmic problems we solved, and share what the patent drafting process taught me about software engineering rigor.
The Technical Problem: Why Western Generative Music Models Fail Indian Classical Raags
Modern generative audio models (such as Suno, Udio, or MusicLM) are trained predominantly on Western musical corpuses. Western music is overwhelmingly based on the 12-tone equal temperament (12-TET) tuning system, where octaves are divided into twelve equal logarithmic semitone steps.
Indian Classical Music does not conform to this model.
- Microtonality (Shrutis): An octave is divided into 22 distinct microtonal intervals (shrutis), meaning notes like Komal Gandhar or Tivra Madhyam have subtle pitch variations depending on the Raag.
- Grammatical Ascent and Descent: A Raag is not merely a scale—it is a melodic personality governed by strict directional rules: Aroha (permitted ascending notes), Avaroha (permitted descending notes), Vadi (sonant king note), and Samvadi (consonant queen note).
- Emotional Temporal Association: Raags are tied to circadian rhythms (Praharas) and moods (Rasas). A morning Raag like Bhairav evokes dawn devotion, while an evening Raag like Yaman conveys serenity.
When text-to-music models attempt to generate Indian melodies, they either flatten the swaras into chromatic Western pitches or produce chaotic melodies that violate fundamental Raag grammar.
The Three-Tier System Architecture
To solve this challenge while keeping the platform accessible over standard consumer web browsers, we architected Dhun AI across three distinct pipeline tiers:
+-------------------------------------------------------------------------+
| TIER 1: CADENCE EXTRACTION |
| User Lyric Input (Hindi / Sanskrit) ──► Groq AI LPU Llama-3.3-70B |
| - Syllable Stress Parsing (Guru/Laghu) |
| - Metric Matra Mapping (Keherwa, Teentaal) |
| - Sentiment & Rasa Classification (Bhakti, Shringar, Karuna) |
+------------------------------------+------------------------------------+
│ Structured JSON Cadence Vector
▼
+-------------------------------------------------------------------------+
| TIER 2: RAAG ALGORITHMIC MATRIX |
| - Raag Constraint Filtering (Aroha/Avaroha Swara Verification) |
| - Microtonal Pitch Ratio Calculation (22 Shrutis frequency table) |
| - Vadi / Samvadi Note Duration Weighting |
+------------------------------------+------------------------------------+
│ Lightweight Swara Frequency Stream
▼
+-------------------------------------------------------------------------+
| TIER 3: CLIENT BROWSER DSP ENGINE |
| Web Audio API AudioContext: |
| - OscillatorNode (Sawtooth & Triangle Wave blend) |
| - GainNode (Custom ADSR Attack-Decay-Sustain-Release Envelopes) |
| - BiquadFilterNode (Resonant Formant Filtering) |
| - Zero-Latency Real-Time Audio Buffer Playback (<15ms delay) |
+-------------------------------------------------------------------------+
1. Natural Language Cadence Parsing via Groq LPUs
Poetic meter in Indian languages is based on Matras (durational counts) rather than simple English syllable counts. Long syllables (Guru) receive two counts; short syllables (Laghu) receive one.
To achieve sub-second cadence extraction without GPU queuing bottlenecks, we integrated Groq AI Language Processing Units (LPUs) running optimized Llama 3.3 models. The model returns structured JSON containing the parsed cadence and recommended Raag mode:
{
"mood": "Devotional",
"detectedRaag": "Bhairav",
"rhythm": "Teentaal",
"phraseSequence": [
{ "syllable": "Jai", "swara": "Sa", "frequency": 261.63, "durationMs": 400 },
{ "syllable": "Jag", "swara": "Re_komal", "frequency": 277.18, "durationMs": 250 },
{ "syllable": "deesh", "swara": "Ga", "frequency": 329.63, "durationMs": 600 }
]
}
2. Browser-Native Web Audio API DSP Synthesis
A critical invention in our patent was eliminating heavy server-rendered audio streams (such as streaming 320kbps MP3 or WAV files from the backend). Server rendering incurs high cloud infrastructure costs and introduces 2 to 5 seconds of network buffering.
Instead, our backend transmits a tiny JSON payload (typically under 2 KB) containing frequency values and duration vectors. The client's browser synthesizes the musical waveforms on-the-fly using the native Web Audio API:
// Browser-side Real-time DSP Synthesis
export class RaagSynthesizer {
private ctx: AudioContext;
constructor() {
this.ctx = new (window.AudioContext || (window as any).webkitAudioContext)();
}
public playSwara(freq: number, durationMs: number, startTime: number) {
const osc = this.ctx.createOscillator();
const gain = this.ctx.createGain();
const filter = this.ctx.createBiquadFilter();
// Harmonic shape: sawtooth warm tone
osc.type = 'sawtooth';
osc.frequency.setValueAtTime(freq, startTime);
// Lowpass filter for acoustic richness
filter.type = 'lowpass';
filter.frequency.setValueAtTime(1800, startTime);
// ADSR Envelope: Fast attack, gradual exponential decay
const dur = durationMs / 1000;
gain.gain.setValueAtTime(0.001, startTime);
gain.gain.linearRampToValueAtTime(0.35, startTime + 0.04); // Attack
gain.gain.exponentialRampToValueAtTime(0.2, startTime + 0.15); // Decay
gain.gain.setValueAtTime(0.2, startTime + dur - 0.05); // Sustain
gain.gain.exponentialRampToValueAtTime(0.001, startTime + dur); // Release
osc.connect(filter);
filter.connect(gain);
gain.connect(this.ctx.destination);
osc.start(startTime);
osc.stop(startTime + dur);
}
}
What the Patent Process Taught Me as an Engineer
- Code is Cheap; Novelty Claims Require Rigor: When filing a patent, you cannot simply state that your code is 'faster' or 'better'. You must prove technical novelty through prior-art searches across global patent databases (WIPO, USPTO, Indian Patent Office).
- Separation of Mechanism from Implementation: Technologies evolve, but novel workflows endure. A good patent protects the underlying architectural process, not just a specific line of JavaScript.
- Academic Collaboration Accelerates Innovation: Working alongside research mentors at SAGE University demonstrated the power of combining academic domain expertise with modern software development skills.