Skip to content

sgmoorthy/DeepRaaga

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎡 DeepRaaga

An AI Framework for Learning and Generating Carnatic Ragas

UI Screenshot

Python 3.10+ React Vite TensorFlow CI/CD License: MIT

DeepRaaga is an open-source platform dedicated to modeling the intricate structural beauty of Carnatic music using Artificial Intelligence. By harmonizing traditional heritage with modern machine learning paradigms, we strive to build a computational bridge to India's rich musical legacy.


🌟 Vision: A National Knowledge Repository

Inspired by the visionary dialogue between PM Narendra Modi and veteran composer Ramesh Vinayakam on creating a "National Knowledge Repository" for Indian music, DeepRaaga stands as a foundational step toward that goal.

Carnatic music cannot be reduced to simple discrete notes; it is defined by the continuous, microtonal inflections (Gamakas), characteristic melodic pathways (Sancharas), and the strict grammatical constraints of ascending (Arohana) and descending (Avarohana) scales. Our mission is to encode this profound acoustic heritage into robust AI models, moving beyond Western-centric MIR (Music Information Retrieval) to create an open platform that respects, preserves, and innovates upon the grammar of Indian Classical Music.


πŸ—οΈ System Architecture

The project is decoupled into two primary subsystems to ensure scalability and rapid inference:

1. Neural Backend (Python)

  • Environment Requirement: Python 3.10+
  • Data Ingestion: Conversion of Carnatic compositions (MIDI, MusicXML) into NoteSequence and TFRecord formats holding deep arrays of pitch bends and timing.
  • Deep Learning Core: Training of sequence models (RNN/LSTM or Transformer-style) heavily conditioned on specific Raga constraints.
  • Microservices: A FastAPI/Flask REST layer to expose the .generate() methods via endpoints.

2. Interaction Layer (React + Vite)

  • Technology Stack: React 18, Vite 5, Material UI 3
  • Usage: A modern, glassmorphic Single Page Application (SPA) offering visual generation tools, Raga playback via WebMIDI/Tone.js, and an integrated technical blog.

πŸš€ Installation & Local Development

🐍 Backend setup (Python 3.10+)

git clone https://github.com/sgmoorthy/DeepRaaga.git
cd DeepRaaga

# Initialize virtual environment
python -m venv .venv

# Activate environment
source .venv/bin/activate       # Unix/macOS
.\.venv\Scripts\activate        # Windows

# Install ML Dependencies
pip install -r requirements.txt

(Dependencies include TensorFlow, Magenta, librosa, pretty-midi, and FastAPI)

βš›οΈ Frontend Setup (React)

# Install exact dependencies
npm install 

# Spin up high-speed local dev server
npm run dev

# Compile for production
npm run build

βš™οΈ CI/CD & Automated Deployment

DeepRaaga utilizes robust GitHub Actions pipelines to automate testing and deployments natively.

The Workflow (.github/workflows/deploy.yml):

  1. Trigger: Activated automatically upon merging code into the master branch.
  2. Environment: Spins up an ubuntu-latest container running Node.js.
  3. Build: Installs dependencies cleanly utilizing npm ci and compiles the React application utilizing npx vite build --base=/DeepRaaga/.
  4. Deploy: Artifacts are packaged and pushed directly to the gh-pages branch, instantly updating the lived production URL.

(Note: Contributors do not need to manually push a build. Simply open a PR against master and the CI/CD pipeline handles it!)


πŸ“– Documentation & The Keyword Blog

DeepRaaga ships with a fully integrated, beautifully stylized publishing platform structurally inspired by Google's "The Keyword" blog.

The frontend incorporates a dynamically mapped Client-Side Router that leverages raw .md (Markdown) data without requiring a dedicated backend database.

Writing a New Blog Post

  1. Create your Markdown file: Add your technical writing to docs/blog/your-new-post.md.
  2. Handle Media Natively: Use standard Markdown image syntax (![alt](/DeepRaaga/blog-images/img.png)). For YouTube videos, standard hyperlink anchor tags ([Video](https://www.youtube.com/watch?v=VIDEO_ID)) are dynamically intercepted by our custom React Markdown engine and converted into secure, auto-responsive <iframe> embeds.
  3. Register your Post: Open src/components/BlogViewer.jsx and add your metadata to the blogs manifest array:
import newPost from '../../docs/blog/your-new-post.md?raw';

{
  slug: 'your-new-post',
  title: 'Your Premium Title Here',
  category: 'Engineering',
  date: 'April 15, 2026',
  image: '/DeepRaaga/blog-images/feature.png', 
  description: 'A brief description that appears on the feed card.',
  content: newPost
}

Vite will automatically hot-reload your new post into the responsive grid feed!


πŸ’» The "Music-as-Code" Philosophy

DeepRaaga pioneeringly treats Indian Classical Music as Code. In this paradigm:

  • Ragas are Functional Constraints: They are not just melodies but logical schemas (Arohana/Avarohana) that act as validator functions for generative outputs.
  • Compositions are Verisonable Artifacts: Every Kriti or Sanchara is treated as a structured data artifact (MIDI/MusicXML) that can be linted for grammar, version-controlled, and audited.
  • Pedagogy as CI/CD: Learning is viewed as an iterative refinement process, where model weights are updated based on structured feedback from musicians, much like code reviews.

πŸ“Š Dataset Standardization: The "DeepRaaga-Dataset"

To solve the data bottleneck in Carnatic AI and allow for reproducible benchmarking, we have standardized the DeepRaaga-Dataset structure. This repository includes a high-fidelity folder hierarchy for all 72 Melakarta Ragas, treating each musical scale as a unique "Namespace."

Initializing the Music-as-Code Registry

We provide a utility script to instantly generate the standardized directory tree:

python data/melakarta_init.py

This creates the following structure under data/DeepRaaga-Dataset/:

  • Melakarta/
    • 01_Kanakangi/, 02_Ratnangi/, ... 72_Rasikapriya/
      • midi/: Standardized MIDI performance data (Melodic Artifacts).
      • musicxml/: Structured sheet music (Symbolic Code).
      • annotations/: Phrase-level metadata and Gamaka labels (Documentation).

Contributing to the Registry

Researchers and musicians can contribute high-quality musical code by placing it in the correct Raga namespace and submitting a Pull Request. This allows for a collective, open-source benchmark for Carnatic MIR.


🧠 ML Data Pipeline & Models

Preprocessing

Data must be grouped by raga under data/raw/ in MIDI format. To quantize and prepare the data for TensorFlow:

python data/convert_data.py

Raga-Conditioned Autoregressive Generation

Generation is performed by autoregressively sampling from the trained sequence model while conditioning on a specific Raga Latent Vector:

python generate.py --raga="Bhairavi" --duration=300 --temperature=0.8

πŸ—ΊοΈ Project Roadmap

Building the ultimate AI framework for Carnatic music is an ongoing journey:

  • Phase 1: Melakarta Integration: Map all 72 parent scales explicitly.
  • Phase 2: Rhythmic Tala-Awareness: Introduce chronological constraints so models respect the 8-beat structure of cycles like Adi Tala.
  • Phase 3: Transformer Infrastructure: Upgrade baseline RagaLSTM nodes to causal Transformers (e.g., MusicLM variants) for improved Alapana continuity.
  • Phase 4: Open API Sandbox: Offer a real-time web REST API for digital musicians.

🀝 Contributing

We rely on Musicologists, ML Engineers, and React Developers to build this repository. See our detailed breakdown of roles in How to Contribute to DeepRaaga.

  1. Fork the repo!
  2. Create your feature branch: git checkout -b feature/carnatic-magic
  3. Push to the branch: git push origin feature/carnatic-magic
  4. Submit a Pull Request.

πŸ“œ Academic Citation

If you use DeepRaaga in academic work, please cite the associated paper:

@inproceedings{swaminathan2025deepraaga,
  author = {Gurumurthy Swaminathan},
  title = {DeepRaaga: Learning and Generating Carnatic Ragas with Deep Neural Sequence Models},
  year = {2026},
  booktitle = {Proceedings of the Audio Engineering Society}
}

DeepRaaga is an open-source platform created and managed by Gurumurthy Swaminathan.

Released under the MIT License.

About

an effort to teach Indian carnatic music to AI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors