SYSTEM ARCHITECTURE · TYPESAFE JEV + ACOUSTIC DSP

How Swaraga Works

End-to-end signal and decision topology from raw vocal audio to calibrated Hindustani and Carnatic raga judgments.

Swaraga Hybrid DSP and TypeSafe System One Architecture Architecture diagram showing vocal audio passing through YIN pitch tracking and 12-swarasthana telemetry into the System One State Compiler, which dispatches 10 primitives to either TypeSafe Cloud API or OpenJev Browser WASM before combining probabilities in the Mathematical Routing Gate. 01 ACOUSTIC DSP TIER 02 SYSTEM ONE ORCHESTRATOR 03 INFERENCE & PRIMITIVES PCM 22KHZ F0 + SA HZ SWARA JSON BYOK API WASM GGUF 10 LOGITS PROBS + CONF GRAMMAR FIT INGEST Vocal Audio Input MP3 · WebAudio Mic · Saraga YT DSP / F0 YIN Pitch & Shadja Lock NSDF Autocorrelation · 7-pt Median TELEMETRY 12-Swara & Phrase Profiler 1200¢ Histogram · Arohana N-Grams CORE ENGINE System One State Compiler 10 Batched Primitives · JSON State ARBITER Probabilistic Routing Gate √(P(Thaat)×P(Raga)) · Harmonic Conf CLOUD API TypeSafe Jev Cloud API POST /v1/systemone · jev-latest LOCAL WASM OpenJev Browser Engine wllama GGUF · Qwen3 / MiniCPM PRIMITIVES choice() · score() · noul() Thaat/Raga Dist · Gamaka · Vadi LEGEND Synchronous Pipeline Local WASM / Prior Signal Focal Orchestrator Node Tier / Runtime Boundary

01 ACOUSTIC DSP & YIN F0 SCIENCE

Shadja-Locked F0 & 1200¢ Trajectory

  • Decodes vocal audio at 16 kHz via Web Audio API and computes the YIN cumulative mean normalized difference function d'(τ) = d(τ) / ((1/τ)∑d(j)) with parabolic interpolation.
  • Locks tonic Sa via harmonic fifth/fourth (Pa/Ma) pitch-class salience and maps frames to c = 1200 log₂(f₀ / f_Sa) mod 1200.
  • Applies a 7-point median filter and >350¢ transient consonant despiker to segment continuous Svara-Lipi note ribbons.

02 RAGA COMBINATORICS (962 NAMED + 34,848+ OPEN-SET)

Concert Repertoire vs. Mathematical Scales

  • Concert vs. Compendia: ~300–500 ragas are actively performed in concerts; classical encyclopedias (Sangita Sampradaya Pradarshini, Raga Nidhi) document ~1,000 named ragas.
  • 34,848 Upanga Janya Scales: Venkatamakhin's 72 Melakartas × 484 straight 5/6/7-note (Audava / Shadava / Sampurna) Aroha × Avaroha subsets yield 72 × 484 = 34,848 scales, plus open-ended Vakra & Bhashanga phrasing ("Ananta vai ragah").

03 TWO-STAGE FULL-CATALOG & OPEN-SET MATCHER

962 Catalogued Ragas + 13th Janya Hypothesis

  • 962 Named Ragas: Indexes 72 Melakartas, 807 Carnatic Janyas, 61 Hindustani Thaat ragas, and 22 Dual Hindustani–Carnatic pairs.
  • Stage 1 Shortlist: Scores all 962 ragas via 0.42·Recall − 1.15·VarjyaLeak + 0.32·Jaccard + 0.28·Pakad + VadiBonus to forward the top 12 candidates.
  • Stage 2 Open-Set (out_of_catalog): Adds a 13th hypothesis that synthesizes the exact Janya Jati, parent Melakarta, and nearest Thaat for any uncatalogued scale.

04 SYSTEM ONE PRIMITIVES & DUAL RUNTIME

10 Batched Judgments & Zero-Key Browser WASM

  • 10 Primitives: 4× choice() (Primary Raga, Parent Thaat, Idiom, Prahar), 2× score() (Gamaka & Rasa 0–3 rubrics), and 4× noul() (Pakad & Vadi verifiers).
  • Hierarchical Beam: Ranks candidates by geometric beam √(P(Thaat) × P(Raga)).
  • Cloud BYOK or Local WASM: Evaluates via POST /v1/systemone (jev-latest) or auto-loads OpenJev (@wllama/wllama Qwen3-0.6B) in-browser when no API key is present.