Skip to content

jags111/RagaNotate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎵 RagaNotate

Full-Stack Carnatic Music Notation Engine A human-readable, AI-compatible notation system for Carnatic classical music.

Version CI Status License Python TypeScript HuggingFace Author


What Is RagaNotate?

RagaNotate is evolving into the first Carnatic-native Generative Audio Workstation (GAW) — a DAW-ready platform where notation, AI composition, and vocal synthesis converge.

Current state (v0.5.9): a full desktop notation engine with gamaka audio engine (22 raga profiles, live note highlighting, kampita speed control) and a 20-composition HuggingFace dataset corpus. Target state (v1.0): a GAW with two JUCE VST3 plugins, AI phrase generation, Carnatic vocal synthesis, and a 7-layer mixing interface.

Why GAW? Tools like Synthesizer V and Vocaloid 6 dominate AI singing — but neither supports Indian classical music, gamaka ornaments, or tala grid alignment. RagaNotate fills that gap: open-source (AGPLv3), Carnatic-first, DAW-compatible.

  • ASCII notation format — human-readable, version-control friendly, AI-tokenizable
  • Python package (raganotate) — parse, export MIDI with Just Intonation tuning, tokenize for AI/ML
  • TypeScript library — identical features for browser and Node.js environments
  • Electron desktop app — 6-tab studio with live SVG, Web Audio, 287 ragas, 16 gamakas, 19 talas
  • Two JUCE VST3 plugins (planned): RagaNotate-DAW (notation in DAW) + RagaNotate-VocalSynth (Carnatic AI singing)
  • AI composition (planned): LLM phrase generator + vocal synthesis + video export

⚡ Quick Start — Four Ways to Run

Option 1 — Electron Studio App (New — Recommended for Desktop)

Full desktop app with live SVG notation preview, Web Audio playback, and 287-raga database:

git clone https://github.com/jags111/RagaNotate.git
cd RagaNotate
npm install
cd renderer && npm install && npm run build && cd ..
npm start        # launches Electron Studio

Six tabs:

  • Notation Editor — type notation, instant color-coded SVG preview, Play with note-blink highlight, Tambura drone + Mridangam/Ganjira percussion, Unicode display, raga linting, 6 sample pieces
  • Song Editor — multi-section (Pallavi/Anupallavi/Charanam) with per-section SVG
  • Lyrics ↔ Notation — tala-column two-row grid (notation + lyrics aligned per avartana), octave color-coded cells, playback
  • Raga Reference — search all 287 ragas (72 Melakarta + 211 Janya + 4 aliases), full aro/ava detail panel, ▶ Play Aro/Ava buttons, Example Phrases panel (notation strip + gamaka tags + per-phrase playback, sourced from data/examples.json)
  • Gamaka Guide — interactive gamaka reference with pitch contour SVGs and playback demos for all 16 gamakas
  • Help / FAQ — notation syntax guide, tala reference, keyboard shortcuts

Option 2 — Web Editor with Full Audio (Recommended for Browser)

Clone the repo and start the local server in one step:

git clone https://github.com/jags111/RagaNotate.git
cd RagaNotate
./serve.sh           # starts http://localhost:8000 and opens your browser

Why a server? The editor uses fetch() to load WAV audio samples (Tambura, Veena, Flute, Mridangam, Ganjira). Browsers block fetch() on file:// URLs. serve.sh auto-detects Python 3, Node.js, or uv and picks the best available server — no manual setup needed.


Option 3 — Web Editor (Synth-Only, No Server Needed)

If you just want to try the notation editor without audio samples, double-click:

web/raganotate_editor.html

The editor falls back to oscillator-based synthesis automatically. All notation, tala, playback, and export features work — just without the real WAV instrument samples.


Option 4 — Python Package (uv — one line)

# Install uv (if you don't have it)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone + install raganotate in one step
git clone https://github.com/jags111/RagaNotate.git
cd RagaNotate
uv pip install -e "packages/python[all]"

# Quick test
raganotate parse "| S R G M | P D N S' ||"
raganotate midi  "| S R G M |" --output test.mid

Or use the unified installer script (handles Python + TypeScript):

./install.sh           # full stack
./install.sh --python  # Python only
./install.sh --js      # TypeScript only
./install.sh --dev     # with test/lint dependencies

Option 5 — TypeScript Library (npm)

cd packages/js
npm install
npm run build          # compiles to dist/
npm test

You'll get a full Carnatic composition environment with four tabs:

  • Notation Editor — live CodeMirror editor with real-time SVG preview; GKA-style swara keyboard for 3-octave note entry; tala beat clock; Tambura drone; ▶ Play with authentic Veena/Flute FFT synthesis; gamakam styles; raga-aware highlighting
  • 🎼 Song Editor — structured composition blocks (Pallavi/Anupallavi/Charanam); aligned notation + lyrics; SVG preview per section; pre-loaded with Jayakaru Geetam (Dhanyasi, Chaturashra Dhruvam)
  • 📝 Lyrics ↔ Notation — syllable-level pairing of lyrics and notation; auto-align with gamaka suggestions; visual alignment preview; one-click send to Notation Editor; playback
  • Raga Reference — searchable table of 287 entries (72 Melakarta + 211 Janya + 4 named aliases); filter Melakarta/Janya; arohanam/avarohanam with proper Ri₂/Ga₃ notation; ▶ play aro/ava; → select into editor

Type this into the editor and press ▶ Play Notation:

| S R~ G+ M | P D N+ S' | N+ D P M | G+ R S ||

That's the full Shankarabharanam scale, ascending and descending, in Adi Tala.


🌐 Companion Web Tools

Open these alongside the main editor (no install needed):

File Description
web/raganotate_editor.html Main editor — compose, play, export
web/gamaka_reference.html Interactive Gamaka Guide — 16 gamakas with pitch contours, play buttons, notation symbols
web/notation_guide.html Notation Guide — step-by-step syntax reference with live examples
web/swarasthana_explorer.html Swarasthana Explorer — 12-position interactive pitch reference

All four pages share the same dark/light theme and cross-link to each other.


Notation Format

Swaras (12 Positions, 3 Octaves)

MANDRA (low dot):  .S  .r  .R  .g  .G+ .m  .M  .P  .d  .D  .n  .N+
MADHYA (middle):    S   r   R   g   G+  m   M   P   d   D   n   N+
TARA (high prime): S'  r'  R'  g'  G+' m'  M'  P'  d'  D'  n'  N+'

Unicode display (dot-above = Tara, dot-below = Mandra):

Tara:   Ṡ  Ṙ  Ġ  Ṁ  Ṗ  Ḋ  Ṅ
Mandra: Ṣ  Ṛ  G̣  Ṃ  P̣  Ḍ  Ṇ

Duration

Symbol Meaning Example
S 1 akshara (one beat) S R G M
S; 2 aksharas (double) S;
S: ½ akshara (half-beat) S: R: G:
S:: ¼ akshara S:: R:: G:: M::

Beat Markers

Symbol Meaning
| Bar / beat boundary
|| Section end
, Half-beat gap
- Rest / silence

Gamakas (7 Playback Symbols)

Symbol Gamaka Description Synthesis
~ Kampita Oscillating vibrato ±1.8% freq, 8 steps
/ Etra Jaru Slide up to note 0.94× → 1.0× ramp
\ Irakka Jaru Slide down to note 1.07× → 1.0× ramp
^ Sphurita Sharp onset grace 1.05× → 1.0× snap
v Pratyaghata Downward grace 0.95× → 1.0×
w Andola Slow wide oscillation 3.5 Hz sinusoidal
* Nokku Stress accent sharp amplitude pulse

See web/gamaka_reference.html for detailed pitch contour diagrams and playback demos.

Full Notation Example

// Shankarabharanam — ascending with gamakas
| S  R~  G+  M   | P   D   N+  S'  ||
| S' N+\ D   P   | M   G+  R   S   ||
| S  R~  G+/ M   | P^  D   N+\ S' ||

The 12 Swarasthana Positions

Carnatic music defines 16 swarasthana names but only 12 unique pitch positions — 4 enharmonic pairs share the same frequency. All frequencies use Just Intonation (5-limit), not equal temperament.

Pos Symbol Full Name Alias Ratio Hz @ Sa=240
1 S Shadjam (achala) 1/1 240.00
2 r Suddha Ri (R1) 16/15 256.00
3 R Chatusruti Ri (R2) = G1 Suddha Ga 9/8 270.00
4 g Sadharana Ga (R3/G2) 6/5 288.00
5 G+ Antara Ga (G3) 5/4 300.00
6 m Suddha Ma (M1) 4/3 320.00
7 M Prati Ma (M2) 45/32 337.50
8 P Panchamam (achala) 3/2 360.00
9 d Suddha Dha (D1) 8/5 384.00
10 D Chatusruti Dha (D2) = N1 Suddha Ni 5/3 400.00
11 n Kaisika Ni (D3/N2) 9/5 432.00
12 N+ Kakali Ni (N3) 15/8 450.00

🔊 Audio Synthesis (v0.4.1)

The Web Audio engine uses authentic FFT-measured PeriodicWave coefficients extracted from the carnaticsoftware.com GKA reference application:

Veena — 2 cross-fading PeriodicWave oscillators (attack + decay):

  • real1 = [0,2,40,50,80,70,60,40,30,30,25,20,10,5] — bright jivari pluck (3 ms attack)
  • realdec = [0,2,60,50,95,80,60,40,40,30,25,20,10,5] — warm resonating body sustain
  • Register-adaptive: mandra uses real3, tara uses real2, madhya uses real1

Flute (Venu) — PeriodicWave + breath noise:

  • flreal1 = [0,10] — fundamental-dominant flute shape
  • Bandpass breath noise at 1.3× fundamental, Q=4
  • Natural kampita (vibrato) applied by default

Sruthi System — Indian Kattai naming:

  • 3 Kattai (E4 = 329.63 Hz) is the standard male vocal pitch ★ default
  • 1 Kt = C4 = 261.63 Hz · 6 Kt = A4 = 440 Hz (standard female)
  • Range: LO-7 Kt (B3) through 6.5 Kt (A#4)

🥁 35-Tala System

The full Suladi Sapta Tala system × 5 Jati = 35 talas, generated programmatically:

Jati Beats per Laghu
Tisra 3
Chatusra 4
Khanda 5
Misra 7
Sankeerna 9

7 Tala types × 5 Jati = 35 talas + Chapu talas (Thisra/Khanda/Misra).

All talas have a live beat clock, visual angas (Laghu/Drutam/Anudruta) and Mridangam/Bell/Harmonium percussion.


Python Package

Install

Recommended — uv (fast, isolated, no venv needed):

# Install uv once (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Core only (zero dependencies — pure stdlib)
uv pip install -e "packages/python"

# With MIDI export
uv pip install -e "packages/python[midi]"

# With audio processing
uv pip install -e "packages/python[audio]"

# With AI/HuggingFace dataset encoding
uv pip install -e "packages/python[ai]"

# Everything (recommended for development)
uv pip install -e "packages/python[all]"

# Full stack + dev tools (tests, lint, type-check)
uv pip install -e "packages/python[all,dev]"

Legacy pip:

cd packages/python
pip install -e ".[all]"

Note on MIDIUtil: The package name on PyPI is MIDIUtil (capital M, U). When using pip directly: pip install MIDIUtil. uv handles this automatically.

Parse notation

from raganotate import parse_notation

ast = parse_notation("| S R~ G+ M | P D N+ S' ||", tala="Adi")
for node in ast.nodes:
    print(node.type, node.symbol if hasattr(node,'symbol') else '')

Export MIDI with Just Intonation

from raganotate import parse_notation
from raganotate.midi_generator import ast_to_midi

ast = parse_notation("| S R G+ M | P D N+ S' | N+ D P M | G+ R S ||", tala="Adi")
ast_to_midi(ast, "shankarabharanam_scale.mid", sa_hz=329.63, bpm=80.0)
# Opens in GarageBand, Logic, Ableton, MuseScore, LMMS, VLC…

AI/HuggingFace tokenization

from raganotate import parse_notation
from raganotate.ai_encoder import ast_to_token_sequence, ast_to_dataset_record

ast = parse_notation("| S R G+ M | P D N+ S' ||", tala="Adi")
tokens = ast_to_token_sequence(ast)
record = ast_to_dataset_record(ast, title="Sa Re Ga Ma scale", raga="Shankarabharanam")

TypeScript / JavaScript

import { parse } from './src/parser';
import { renderSVG } from './src/renderer';
import { TalaEngine, TALAS } from './src/tala';

const ast = parse('| S R~ G+ M | P D N+ S\' ||');
const svg = renderSVG(ast);
document.getElementById('preview')!.innerHTML = svg;

const engine = new TalaEngine(TALAS['Adi'], 80);
engine.onBeat = (evt) => console.log(evt.label, evt.isSam ? '← SAM' : '');
engine.start();

Repository Structure

RagaNotate/
├── README.md
├── SPEC.md                      ← Full notation specification
├── ARCHITECTURE.md
├── CHANGELOG.md
├── SESSION_STATE.md             ← AI session recovery guide
│
├── packages/
│   ├── python/
│   │   └── raganotate/
│   │       ├── swara.py         ← 12-position JI ratios
│   │       ├── gamaka.py        ← 15 gamakas + pitch contours
│   │       ├── tala.py          ← TalaEngine (35 talas + chapu)
│   │       ├── parser.py        ← ASCII notation → NotationAST
│   │       ├── lyrics_mapper.py ← syllable-to-swara alignment
│   │       ├── ai_encoder.py    ← AST → token sequences + HF dataset
│   │       ├── raga_grammar.py  ← raga rules + validation
│   │       └── midi_generator.py← AST → MIDI with JI pitch bends
│   │
│   └── js/
│       └── src/
│           ├── types.ts, lexer.ts, parser.ts, renderer.ts
│           ├── gamaka.ts, tala.ts, audio.ts
│
├── web/
│   ├── raganotate_editor.html   ← ★ Main editor (single-file, ~2700 lines)
│   ├── gamaka_reference.html    ← Interactive gamaka guide (linked)
│   ├── notation_guide.html      ← Notation syntax guide (linked)
│   └── swarasthana_explorer.html← 12-swarasthana pitch explorer
│
├── spec/
│   ├── PHONETICS.md             ← Swarasthana phonetics + JI table
│   ├── GAMAKAS.md               ← 15 gamakas reference
│   └── TALAS.md                 ← 35-tala reference
│
├── References/
│   ├── RAGA_DATABASE.md         ← 72 Melakarta + 212 Janya (284 ragas)
│   └── skills/carnatic-raganotate/SKILL.md ← AI session skill file
│
├── dataset/
│   ├── compositions/            ← 20 JSON compositions, 20 ragas (Phase 3I-B)
│   ├── hf_export/               ← raganotate_corpus.jsonl + .parquet (20 rows)
│   ├── build_seed_compositions.py ← seed generator script
│   ├── explore_raganotate.ipynb ← EDA notebook (token stats, gamaka heatmap)
│   └── sawarsthanam.xlsx        ← Swarasthana ratios spreadsheet
├── push_to_hf.py                ← encode all compositions + push to HuggingFace
│
├── scripts/
│   └── export_midi.py       ← Python bridge: JSON stdin → MIDI via ast_to_midi
│
├── electron/
│   ├── main.js              ← BrowserWindow, IPC, File menu, all handlers
│   └── preload.js           ← contextBridge: MIDI/WAV export, save/load, menus
│
├── renderer/                ← Vite 6 + React 19 + TypeScript (Electron renderer)
│   ├── src/
│   │   ├── App.tsx          ← 6-tab layout (Radix UI Tabs)
│   │   ├── types/
│   │   │   └── electron.d.ts       ← ElectronAPI, RagaFile, MidiExportResult types
│   │   ├── components/
│   │   │   ├── NotationEditor.tsx  ← live SVG + Web Audio + MIDI/WAV export + note blink
│   │   │   ├── SwaraKeyboard.tsx   ← 3-octave gamaka keyboard (Phase 2C)
│   │   │   ├── SongEditor.tsx      ← multi-section (Pallavi/Anu/Charanam)
│   │   │   ├── LyricsNotation.tsx  ← two-row tala-column aligned grid + playback
│   │   │   ├── RagaReference.tsx   ← 287-raga grid + detail panel + Play Aro/Ava
│   │   │   ├── TalaClock.tsx       ← animated anga beat display (Phase 3A)
│   │   │   ├── GamakaReference.tsx ← interactive gamaka guide with audio demos
│   │   │   └── HelpPanel.tsx       ← notation syntax, tala ref, keyboard shortcuts
│   │   └── hooks/
│   │       ├── useRagaDB.ts        ← loads data/ragas.json
│   │       ├── useNotation.ts      ← parseNotation + renderSVG + kattaiToHz
│   │       ├── useAudioEngine.ts   ← AudioEngine wrapper + onNoteStart callback
│   │       ├── useGamakaPlayback.ts← 22-raga gamaka engine, playSection/playAll (Phase 3H)
│   │       ├── useRagaFile.ts      ← .raga file save/load/autosave (Phase 2B)
│   │       ├── useWavExport.ts     ← OfflineAudioContext → WAV render (Phase 2D)
│   │       ├── useTamburaDrone.ts  ← Sa/Pa/Ṡ drone synth with jivari LFO (Phase 3A)
│   │       ├── useTalaPercussion.ts← Mridangam+Ganjira noise-burst synth (Phase 3B)
│   │       └── useRagaLint.ts      ← aro/ava violation warnings
│   └── vite.config.ts
│
├── data/
│   ├── ragas.json           ← 287 entries (283 canonical + 4 aliases)
│   └── examples.json        ← 34 example phrases across 12 ragas (Phase 3F)
│
├── e2e/
│   ├── phase1a.spec.js      ← Playwright E2E: window, title, raga selector
│   ├── phase2a.spec.js      ← MIDI export IPC + button + script exists
│   ├── phase2b.spec.js      ← .raga save/load IPC + dirty indicator
│   └── phase2c.spec.js      ← swara keyboard toggle + insert + backspace
│
└── docs/
    ├── PHASES.md            ← Full phase plan & audit (T-PRE-01 → Phase 4D)
    ├── PHASE4.md            ← Detailed Phase 4A–4D master plan (GAW, vocal synth, pipeline)
    ├── JUCE_SETUP.md        ← JUCE VST3 CMake guide + AGPLv3 licensing decision
    ├── GAW_GUI_DESIGN.md    ← 7-layer GAW UI plan, ASCII wireframes, design tokens
    └── midi_test.md

Roadmap

Version What Status
v0.1.x Core spec, Python/TS engine, MIDI export ✅ Done
v0.2.0 72 Melakarta DB + Geetham Editor + SVG display ✅ Done
v0.3.x RAGA_DB 284 ragas, Alapana DB, Loop, Tambura ✅ Done
v0.4.0 GKA-style swara keyboard, 35-tala, Lyrics↔Notation ✅ Done
v0.4.1 Veena/Flute FFT PeriodicWave synthesis, Kattai sruthi, companion pages ✅ Done
v0.5.0-beta Electron Studio app (Vite+React renderer, live SVG, Web Audio, 283 ragas) ✅ Done
v0.5.1 MIDI export (Phase 2A), .raga file persistence (Phase 2B), Gamaka keyboard (Phase 2C) ✅ Done
v0.5.2 WAV audio export (Phase 2D), UI polish, color-coded SVG swaras, tala-driven rows ✅ Done
v0.5.3 Tala beat clock (Phase 3A), Tambura drone, Mridangam+Ganjira percussion (Phase 3B), SVG note-blink, Lyrics tala-column grid, Gamaka reference, Help FAQ, Unicode notation, Raga linting ✅ Done
v0.5.4 Gamaka pitch engine (tribhinna/misrita curves, // strong-ascent marker), pitch contour SVG in Gamaka Reference (16 gamakas), extended tala list (Thisra/Khanda/Misra jati variants — 19 talas total) ✅ Done
v0.5.5 Phase 3F: HuggingFace dataset pipeline — 12 seed compositions, encode_to_hf_record(), data/examples.json (34 phrases), RagaReference "Example Phrases" panel, EDA notebook ✅ Done
v0.5.6 Phase 3G: UI redesign (3 sprints) — Lyrics Review, tala column grid, percussion picker, section colour-coding, 8 song samples, gamaka guide, beat column numbers ✅ Done
v0.5.7 Phase 3H: SE-6 Gamaka audio engine — useGamakaPlayback.ts, 17 raga profiles (.gka corpus), sequential playAll, kampita/jaru/andola synthesis, Song Editor gamaka UI ✅ Done
v0.5.8 Phase 3I-A: Gamaka polish — 22 raga profiles (+Saveri/Varali/Charukesi/Nattai/Reethigowla), gamakaRate slider (0.5–1.5×), live note highlight (data-ni CSS injection), swara ordinal fix in audio.ts ✅ Done
v0.5.9 Phase 3I-B: Dataset expansion — 20 compositions (8 new ragas), push_to_hf.py, dataset/hf_export/ JSONL+Parquet (ready to push to 🤗 jags/RagaNotate-corpus) ✅ Done
v0.6.0 Phase 3I-C: Accessibility (keyboard nav, Space=play/stop), mobile-responsive SVG, Electron About dialog; Phase 3E: VST3 Plugin #1 (RagaNotate-DAW, JUCE) 🔲 Planned
v0.7.0 Phase 4A: GAW infrastructure (MIDI bridge, voice profiles, audio→notation); Phase 4D: design system + radial tala clock 🔲 Planned
v0.8.0 Phase 4B: AI vocal synthesis — VST3 Plugin #2 (RagaNotate-VocalSynth, JUCE); Synthesizer V .svp exporter 🔲 Planned
v1.0.0 Phase 4C: Full GAW pipeline — ComposeWorkflow tab, mixer, video export, dataset flywheel 🔲 Planned

Ragas (287 in Editor)

Category Count Notes
72 Melakarta 72 All chakras, M1 (Sa-Ma) + M2 (Sa-Ma#)
Janya ragas 211 Grouped by parent melakarta
Named aliases 4 Common alternate names (e.g. Kalyani for Mechakalyani)
Total 287 In dynamic dropdown, searchable

Popular ragas pre-loaded with alapana phrases, aro/ava sol-chip panels:

Raga Type Arohanam
Shankarabharanam 29 Mela S R₂ G₃ m P D₂ N₃
Kalyani (Mechakalyani) 65 Mela S R₂ G₃ M₂ P D₂ N₃
Bhairavi 20 Janya S R₁ G₂ m P D₁ N₂
Mohanam 28 Janya S R₂ G₃ P D₂
Hamsadhvani 29 Janya S R₂ G₃ P N₃
Todi (Subhapantuvarali) 45 Mela S R₁ G₂ m P D₁ N₃
Kharaharapriya 22 Mela S R₂ G₂ m P D₂ N₂
Dhanyasi 8 Janya S G₂ m P N₂

References


Author

Jags · @jags111 · 🤗 huggingface.co/jags · info@revsmartasia.com


License

AGPLv3 © 2026 Jags (jags111). See LICENSE and THIRD_PARTY_LICENSES.md.

This project uses JUCE under its AGPLv3 open-source tier — no commercial JUCE licence is required as long as the project remains open-source. The VST3 SDK (Steinberg) is used under GPLv3, compatible with AGPLv3. If you distribute a closed-source binary containing JUCE, you must obtain a JUCE commercial licence.

About

Full-Stack Carnatic Music Notation Engine A human-readable, AI-compatible notation system for Carnatic classical music.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors