MusaLCE Server Suite
Musa-DSL Live Coding Environment Server Suite 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.
Overview
The MusaLCE Server Suite system allows you to write Ruby code in your editor (Visual Studio Code) and have it executed in real-time, sending MIDI to tracks in your DAW. The typical workflow is:
- Start the MusaLCE Server Suite with/inside your DAW choice (Bitwig Studio or Ableton Live)
- Open your VS Code editor with the MusaLCE extension (MusaLCEforVSCode)
- Write and execute Musa-DSL code interactively
- The code controls MIDI instruments and transport in your DAW
Requirements
- 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 (not recommended because Atom is discontinued)
Installation
If you're using Bundler, add this line to your application's Gemfile:
gem 'musalce-server'
Otherwise:
gem install musalce-server
Quick Start
- Install the DAW controller extension for your DAW (for Bitwig: MusaLCE for Bitwig, for Ableton Live: MusaLCE for Live)
- Install the VSCode extension MusaLCE Client for VSCode
- Start your DAW and ensure the MusaLCE controller is loaded and configured
- Start the server (see below)
- Open VSCode and create a
.rbfile - Execute code using the MusaLCE extension commands (Ctrl+Alt+Return, Ctrl+Alt+M)
Starting the Server
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 Live
The server runs in the foreground and logs activity to the console. Use Ctrl+C or the shutdown command from the editor to stop it.
Running Environment
A complete MusaLCE Server Suite 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
Architecture
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 │
└─────────────────────┘
Communication Ports
| 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 |
REPL Commands Reference
The following commands are available in the REPL context (executed from your editor):
DAW Access
daw # Access the DAW controller object
daw.sequencer # Access the Musa-DSL sequencer
daw.clock # Access the Musa-DSL MIDI clock
daw.transport # Access the Musa-DSL transport
daw.tracks # Access all tracks on the daw by name
daw.surface # Access the control surface (currently elgato Stream Deck)
Persistent actions across DAW Stop/Play
Every DAW Stop wipes the sequencer (at, every, play, on :event
handlers are all cleared by the built-in transport.after_stop { sequencer.reset }).
Top-level Ruby state (methods, modules, constants) survives, but
anything you scheduled or subscribed to via the sequencer DSL does
not. To re-install those on every Play, register an on_start
callback on the transport:
daw.transport.on_start do
load 'persistent_actions.rb' # rehydrate on :event, every, at, …
end
on_start callbacks accumulate (they're an append-only list), so you
can register more from the REPL at any time. They run on every Start,
after the built-in before_begin. Use before_begin instead if you
want a callback that runs only on the very first Start of the
session.
Track Operations
# 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_off
Transport Controls
Transport controls send commands to the DAW. Only available for Bitwig Studio (Live's controller doesn't support transport control by now).
daw.play # Start playback
daw.stop # Stop playback
daw.continue # Continue from current position
daw.goto(5) # Go to bar 5
daw.record # Start recording
Sequencer (Musa-DSL)
All 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)
end
Controlling Playback
The 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"
end
Utility Commands
reload # Reload DAW controller extension
daw.sync # Re-synchronize track information
daw.panic! # Send All Notes Off to all tracks
shutdown # Stop the server
File Require
# Require files relative to your editor's current file
require_relative 'my_patterns'
Module Import
# Import additional modules into the REPL context
import(MyHelperModule)
DAW-Specific Notes
Bitwig Studio
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 should be configured in the Bitwig extension
Ableton Live
Requires MusaLCE for Live MIDI Remote Script.
- No transport control by now
- Multiple tracks can have the same name
- Use
daw.midi_sync('MIDI 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')
Related Projects
| 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 |
| MusaLCE Client for Atom | Atom plugin (discontinued) |
Author
License
MusaLCE Server Copyright (c) 2021-2026 Javier Sánchez Yeste, licensed under GPL 3.0 License