View on GitHub

clap-mml-render-tui

clap-mml-render-tui

clap-mml-render-tui

Overview

An MML TUI DAW (of sorts). Enjoy the rich sound of Surge XT easily with MML. Written in Rust.

Usage

Technical Stack

Preparation

Install Surge XT.

winget install "Surge XT"

Install

cargo install --force --git https://github.com/cat2151/clap-mml-render-tui

Execution

cmrt

You can input MML and play around in the TUI screen.

Keyboard Screen

Press the v key to move to the keyboard screen.

Configuration

config.toml is automatically created on first launch. It’s located in the OS standard configuration directory:

In TUI / DAW NORMAL mode, pressing e opens config.toml in an editor. Restart the application after closing the editor.

Current configuration example:

# [Required] CLAP plugin to use
plugin_path = 'C:\Program Files\Common Files\CLAP\Surge Synth Team\Surge XT.clap'

# Editor candidates to open config.toml (tried in order from left)
editors = ["fresh", "zed", "code", "edit", "nano", "vim"]

input_midi  = "input.mid"

# output_midi, output_wav are automatically saved under
# clap-mml-render-tui/phrase/ or clap-mml-render-tui/daw/
# within the configuration directory.
# The following values are used internally.
output_midi = "output.mid"
output_wav  = "output.wav"

sample_rate = 48000
buffer_size = 512

# Number of concurrent offline renders for DAW (1-16)
offline_render_workers = 2

# Offline rendering backend
# in_process: Renders within the main cmrt process.
# render_server: Renders by POSTing to /render of a render-server child process.
offline_render_backend = "in_process"
offline_render_server_workers = 4
offline_render_server_port = 62153
offline_render_server_command = ""

# Real-time playback backend
realtime_audio_backend = "in_process"
realtime_play_server_port = 62154
realtime_play_server_command = ""

# Whether to autoplay on startup
# Notepad mode: Plays the current line immediately. DAW mode: Starts playback from the beginning of the song (measure 0).
autoplay_on_startup = true

# List of directories to search for Surge XT patches
patches_dirs = [
  'C:\ProgramData\Surge XT\patches_factory',
  'C:\ProgramData\Surge XT\patches_3rdparty',
]

# List of directories to search for WAV loops in the loop browser
loop_dirs = []

# List of categories that can be assigned to loop directories.
# The key for the category overlay is determined from unused English letters within the category name.
loop_categories = ["guitar", "drum", "bass", "spoken", "sequence"]

The configuration items are as follows:

Item Default Value Description
plugin_path OS-specific Surge XT CLAP standard path Path to the CLAP plugin to use.
editors ["fresh", "zed", "code", "edit", "nano", "vim"] Editor candidates, tried in order from left.
input_midi input.mid Input MIDI file name for internal processing.
output_midi output.mid Output MIDI file name for internal processing.
output_wav output.wav Output WAV file name for internal processing.
sample_rate 48000 Sample rate for rendering.
buffer_size 512 Buffer size for rendering.
offline_render_workers 2 Number of concurrent in_process renders.
offline_render_backend in_process Target for offline rendering.
offline_render_server_workers 4 Number of concurrent render_server instances.
offline_render_server_port 62153 Localhost port for render_server.
offline_render_server_command Empty string Command to launch render_server.
realtime_audio_backend in_process Target for real-time playback.
realtime_play_server_port 62154 Localhost port for play_server.
realtime_play_server_command Empty string Command to launch play_server.
autoplay_on_startup true Whether to autoplay immediately on startup.
patches_dirs OS-specific Surge XT patches standard directory List of directories to search for when selecting patches.
loop_dirs [] List of directories to search for in the WAV loop browser. After changing, run cmrt scan-loops.
loop_categories ["guitar", "drum", "bass", "spoken", "sequence"] List of categories to assign to loop directories. The key for the category overlay is determined from unused English letters within the category name.

OS-specific default plugin_path values are as follows:

OS-specific default patches_dirs values are as follows:

If offline_render_backend = "render_server", the TUI side does not directly load the CLAP plugin but instead sends MML to 127.0.0.1:<offline_render_server_port>/render and receives WAV data. If the connection to the render-server fails, cmrt will launch a child process and, in case of a communication error, will restart and retry once.

Update Command

cmrt update

Server Mode

cmrt --server

CLI Mode

cmrt cde
cmrt CM7

Breaking Changes

Future Plans

Concept Notes

Out of Scope