Musa-DSL Live Coding Environment Server for Ableton Live 11+ and Bitwig Studio 5+
This server enables live coding music composition using Musa-DSL with your favorite DAW and code editor.
The MusaLCE system allows you to write Ruby code in your editor (Visual Studio Code recommended) and have it executed in real-time, sending MIDI to tracks in your DAW. The typical workflow is:
- Start the MusaLCE Server with your DAW choice
- Open your code editor with the MusaLCE extension
- Write and execute Musa-DSL code interactively
- The code controls MIDI instruments in your DAW
- Ruby 2.7+
- Musa-DSL (installed automatically as dependency)
- A supported DAW with its controller extension:
- Bitwig Studio 5+ with MusaLCE for Bitwig Controller Extension
- Ableton Live 11+ with MusaLCE for Live MIDI Remote Script
- A code editor with MusaLCE client extension:
- Visual Studio Code (recommended) with MusaLCE Client for VSCode
- Atom with MusaLCE Client for Atom (Atom is discontinued)
If you're using Bundler, add this line to your application's Gemfile:
gem 'musalce-server'Otherwise:
gem install musalce-server- Install the DAW controller extension for your DAW (Bitwig or Live)
- Install the VSCode extension MusaLCE Client for VSCode
- Start your DAW and ensure the MusaLCE controller is loaded
- Start the server (see below)
- Open VSCode and create a
.rbfile - Execute code using the MusaLCE extension commands
The musalce-server command starts the live coding server:
musalce-server <daw>Where <daw> is one of:
bitwig- for Bitwig Studiolive- for Ableton Live
Examples:
musalce-server bitwig # Start server for Bitwig Studio
musalce-server live # Start server for Ableton LiveThe server runs in the foreground and logs activity to the console. Use Ctrl+C or the shutdown command from the editor to stop it.
A complete MusaLCE live coding session requires three components running simultaneously:
-
Code Editor (Visual Studio Code with MusaLCE extension)
- Where you write and execute Ruby/Musa-DSL code
- Connects to musalce-server via TCP port 1327
-
MusaLCE Server (
musalce-servercommand)- Receives code from the editor and executes it
- Communicates with the DAW via OSC
- Manages MIDI routing and the Musa-DSL sequencer
-
DAW (Bitwig Studio or Ableton Live)
- With the corresponding MusaLCE controller extension loaded
- Receives transport and sync commands from the server
- Routes MIDI from the server to instruments/tracks
The MusaLCE system connects three components:
┌─────────────────────┐ TCP ┌─────────────────────┐
│ Code Editor │◄──────────────────►│ MusaLCE Server │
│ (VSCode + Plugin) │ port 1327 │ (Ruby + REPL) │
└─────────────────────┘ └─────────────────────┘
│ ▲
OSC │ │ OSC
port 10001 │ │ port 11011
▼ │
┌─────────────────────┐
│ DAW Controller │
│ Extension │
│ (Bitwig or Live) │
└─────────────────────┘
│
│ MIDI
▼
┌─────────────────────┐
│ DAW Tracks & │
│ Instruments │
└─────────────────────┘
| Port | Protocol | Direction | Purpose |
|---|---|---|---|
| 1327 | TCP | Editor ↔ Server | REPL code execution |
| 10001 | OSC/UDP | Server → DAW | Transport commands, sync requests |
| 11011 | OSC/UDP | DAW → Server | Track info, controller registration |
The following commands are available in the REPL context (executed from your editor):
daw # Access the DAW controller object
daw.sequencer # Access the Musa-DSL sequencer
daw.clock # Access the MIDI clock
daw.tracks # Access all tracks# Get a track by name
bass = daw.track('Bass')
# Get all tracks with a name (Live only, can have duplicates)
drums = daw.track('Drums', all: true)
# Send MIDI to a track
bass.out.note(60, velocity: 100, duration: 1)
bass.out.note_on(60, 100)
bass.out.note_off(60)
bass.out.control_change(1, 64)
bass.out.program_change(5)
bass.out.all_notes_offTransport controls send commands to the DAW. Only available for Bitwig Studio (Live's MIDI Remote Script API doesn't support transport control).
daw.play # Start playback
daw.stop # Stop playback
daw.continue # Continue from current position
daw.goto(5) # Go to bar 5
daw.record # Start recordingAll Musa-DSL sequencer methods are available:
# Schedule events at specific positions
at 1 do
bass.out.note(48, velocity: 80, duration: 0.5)
end
# Wait relative to current position
wait 2 do
bass.out.note(52, velocity: 80, duration: 0.5)
end
# Schedule repeating patterns (returns EveryControl)
pattern = every 4 do
drums.out.note(36, velocity: 100, duration: 0.25)
end
# Play a series (returns PlayControl)
serie = S(60, 62, 64, 65, 67)
melody = play serie do |note|
bass.out.note(note, velocity: 80, duration: 1)
end
# Animate values over time (returns MoveControl)
sweep = move from: 0, to: 127, duration: 4 do |value|
bass.out.control_change(1, value.to_i)
endThe play, every, and move methods return control objects that allow you to stop, pause, and monitor playback:
# Stop a pattern or playback
pattern.stop
melody.stop
# Check status
pattern.stopped? # true if stopped
melody.paused? # true if paused
# Pause and continue (for play)
melody.pause
melody.continue
# Callback when stopped
pattern.on_stop do
puts "Pattern stopped"
end
# Callback after play completes
melody.after(2) do
puts "2 bars after melody finished"
endreload # Reload DAW controller extension
daw.sync # Re-synchronize track information
daw.panic! # Send All Notes Off to all tracks
shutdown # Stop the server# Import additional modules into the REPL context
import(MyHelperModule)# Require files relative to your editor's current file
require_relative 'my_patterns'Requires MusaLCE for Bitwig controller extension.
- Full transport control support (play, stop, continue, goto, record)
- Track names must be unique
- MIDI clock sync from any controller marked as clock source
- Controllers and channels configured in the Bitwig extension
Requires MusaLCE for Live MIDI Remote Script.
- No transport control (Live's MIDI Remote Script API limitation)
- Multiple tracks can have the same name
- Use
daw.midi_sync('Device Name')to set MIDI clock source - Track routing configured in Live's preferences
# Set MIDI clock source for Live
daw.midi_sync('IAC Driver Bus 1')| Component | Description |
|---|---|
| Musa-DSL | Core music composition DSL |
| MusaLCE Server | Live coding server (this gem) |
| MusaLCE for Bitwig | Bitwig Studio controller extension |
| MusaLCE for Live | Ableton Live MIDI Remote Script |
| MusaLCE Client for VSCode | VSCode extension (recommended) |
| MusaLCE Client for Atom | Atom plugin (discontinued) |
API documentation is available via YARD:
bundle exec yard doc
bundle exec yard serverThen open http://localhost:8808 in your browser.
MusaLCE Server Copyright (c) 2021-2025 Javier Sánchez Yeste, licensed under GPL 3.0 License