MusaDSL

A Ruby framework for algorithmic sound and musical thinking and composition

Open Source
LGPL 3.0 License
Free to use, modify & share
Musa-DSL code example

About MusaDSL

Musa-DSL is a domain-specific language based on Ruby designed for sonic and musical composition. It emphasizes the creation of complex temporal structures independently of the audio rendering engine, providing composers and developers with powerful tools for algorithmic composition, generative music, and musical notation.

The framework separates timing and compositional logic from sound production. Rather than coupling musical ideas to particular synthesizers or DAWs, Musa-DSL focuses on the deeper structures—sequences, rhythms, harmonic progressions, and formal compositional systems.

Who is it for?

  • Composers exploring algorithmic composition
  • Musicians interested in generative music systems
  • Developers building music applications
  • Researchers in computational musicology
  • Live coders and interactive music performers

New to MusaDSL? Start composing right away with RubyMine (free for non-commercial use) and the Nota plugin for Claude Code — an AI composition assistant that helps you learn, ideate, code, and analyze algorithmic music. Get started →

Ecosystem Components

Core Framework

Musa-DSL

The core Ruby framework for algorithmic sound and musical composition. Features include: advanced sequencer with microsecond precision for polyrhythmic and polytemporal structures, multiple clock sources (internal, MIDI, external), generative tools (Markov chains, Variatio, Rules, GenerativeGrammar, Darwin genetic algorithms), Neumalang text-based notation system, transcription to MIDI and MusicXML with ornament expansion, and comprehensive scale/tuning support.

Nota — Claude Code Plugin

nota-plugin-for-claude

A plugin for Claude Code that transforms Claude into an algorithmic composition assistant with deep knowledge of MusaDSL. Ask questions about the framework in natural language. Get creative ideas for compositions. Generate verified code from musical descriptions. Analyze your work and build a personal knowledge base that grows with your practice.

/nota:explain — ask any question about MusaDSL and get sourced answers with working code examples. /nota:think — creative ideation across configurable musical dimensions, drawing from your previous analyses and MusaDSL capabilities. /nota:code — describe your musical intention and get verified MusaDSL code. /nota:index — add your compositions to a personal knowledge base. /nota:analyze — structured musical analysis across configurable dimensions, stored as searchable knowledge that enriches future sessions. /nota:best-practices — consolidate recurring patterns from analyses into searchable best practices that are automatically applied when writing new code.

Each step feeds into the next: /nota:think/nota:code/nota:index/nota:analyze/nota:best-practices → back to /nota:think. The more you compose and analyze, the richer the assistant becomes.

Backed by two databases: knowledge.db (MusaDSL documentation, API, 23 demos) and private.db (your own compositions and their musical analyses). Uses sqlite-vec + Voyage AI embeddings for semantic search.

Live Coding Environment (MusaLCE)

MusaLCEServer

The processing server that interprets code and commands in real-time. It connects to your code editor and DAW, enabling live coding sessions where your code generates music instantly.

MusaLCE Client for VSCode

Visual Studio Code extension for live coding with MusaDSL. Provides a modern REPL interface connected to the MusaLCE server, allowing you to execute code and see results in real-time.

Musa-DSL Atom REPL

Atom editor plugin for live coding (maintenance mode since Atom's sunset in December 2022). Consider using the VSCode extension for new projects.

DAW Connectors

MusaLCE for Bitwig

MIDI Controller script for Bitwig Studio 4+. Enables seamless integration between MusaLCE live coding sessions and Bitwig Studio, sending MIDI messages directly to your tracks and instruments.

MusaLCE for Live

Ableton Live controller for MusaLCE. Built with Max/MSP, it establishes communication between Ableton Live 11+ and the MusaLCE server, routing MIDI messages to your Live session.

MIDI Libraries Suite

A comprehensive set of Ruby libraries for MIDI communication. This suite is based on Ari Russo's libraries with modifications and optimizations for use with Musa-DSL.

Library Function Repository Documentation API Docs
midi-events MIDI event representation and object-oriented message handling GitHub README API
midi-parser MIDI data parsing, converts raw bytes to event objects GitHub README API
midi-communications Cross-platform MIDI communication with instruments and control surfaces GitHub README API
midi-communications-macos Low-level MIDI interface for macOS (CoreMIDI) GitHub README API

Getting Started

Recommended Editor: RubyMine

RubyMine provides the best experience for MusaDSL development — intelligent autocomplete of methods and parameters, hover documentation, and type inference help you discover the API as you code.

Free licenses available:

VSCode with the Ruby LSP extension also works well, though Ruby autocomplete and hover documentation are less complete.

AI Composition Assistant: Nota

The fastest way to learn and compose with MusaDSL is through Nota — a plugin for Claude Code that helps you learn, ideate, code, and analyze algorithmic music:

  • /nota:explain — Ask any question about MusaDSL and get sourced answers with working code examples
  • /nota:think — Creative ideation across multiple musical dimensions
  • /nota:code — Describe your musical intention in natural language and get verified MusaDSL code
  • /nota:analyze — Structured analysis of your compositions across multiple musical dimensions
  • /nota:best-practices — Consolidate recurring patterns into searchable best practices

The plugin includes a semantic knowledge base covering all MusaDSL documentation, API reference, 22+ demo projects, and 12 built-in composition best practices. Your compositions, analyses, and practices become searchable knowledge that enriches future sessions.

Requirements: Ruby 3.4+ and a Voyage AI API key (free tier is sufficient for personal use).

Install in Claude Code:

First, add the Nota marketplace:

/plugin marketplace add javier-sy/nota-plugin-for-claude

Then install the plugin:

/plugin install nota@yeste.studio

Then add your Voyage AI API key to your shell profile:

export VOYAGE_API_KEY="your-key-here"

Run /nota:setup to verify the installation. See the Nota documentation for details.

Framework Installation

Requirements: Ruby 3.4+

Install the core Musa-DSL gem:

gem install musa-dsl

Live Coding Setup (MusaLCE)

For real-time coding sessions connected to a DAW, you can additionally set up the MusaLCE live coding environment:

Additional requirements: Ableton Live 11+ or Bitwig Studio 4+

  1. Install the MusaLCE Server: gem install musalce-server
  2. Install the connector for your DAW (Bitwig or Ableton Live)
  3. Install the VSCode extension

Documentation

For detailed documentation, see the README and API docs of each project:

Project README API Docs
Musa-DSL README API
midi-events README API
midi-parser README API
midi-communications README API
midi-communications-macos README API
MusaLCE Server README API
MusaLCE Client for VSCode README
Musa-DSL Atom REPL README
MusaLCE for Bitwig README
MusaLCE for Live README

Demo Projects

A comprehensive collection of 22+ working examples demonstrating MusaDSL capabilities, from basic setup to advanced multi-phase compositions:

  • Basic concepts: Setup, series, neumas, canon
  • Generative tools: Markov, Variatio, Darwin, Grammar, Rules, Matrix
  • DAW integration: MIDI sync, live coding, clock modes
  • External protocols: OSC with SuperCollider and Max/MSP
  • Advanced patterns: Event architecture, parameter automation, multi-phase compositions

Each demo is a complete, runnable project with documentation explaining the concepts demonstrated.

musadsl-demo Repository

Author

MusaDSL is created and maintained by yeste.studio, exploring the intersection of sound, music, technology, and algorithmic composition.

LGPL 3.0 License

You are welcome to use, try, modify, and contribute to any of the MusaDSL projects. All source code is available on GitHub.