Skip to content

Repository files navigation

Decomposer: Learning to Decompile Symbolic Music to Programs

📄 Paper | 🌐 Website | 🎹 Live Demo | 🤗 Model

Decomposer decompiles symbolic music (MIDI) into executable, editable Strudel programs. This repo contains the inference code for our post-trained model.

Setup

Requires uv A GPU with 24GB+ VRAM and CUDA xx is recommended

uv sync                  # transformers backend
uv sync --extra vllm     # vLLM backend

Usage (Inference)

We provide two inference backends with the same command-line interface:

  • generate_transformers.py — simpler setup, slower generation
  • generate_vllm.py — faster generation, heavier setup

Parameters

Parameter Default Description
--midi_path (required) input MIDI file (.mid)
--model haiyewon/Decomposer-Qwen3-8B HF model id or local path
--n_outputs 5 number of Strudel programs to sample
--start_sec file start start of the time window to decompile (seconds)
--duration_sec whole file length of the time window (seconds)
--instruments all comma-separated instruments to keep: GM program numbers (0–127), GM names (e.g. acoustic_bass), or drum
--list_instruments None print the instruments found in --midi_path and exit
--bpm from file tempo override
--meter from file beats-per-measure override
--temperature 1.0 sampling temperature
--max_new_tokens 4096 generation length cap
--output_root outputs/ directory for generation sessions
--log_prefix None session directory prefix: outputs/<log_prefix>_<midi_name>/; defaults to timestamp if None

Commands

# decompile a whole MIDI, sampling 5 candidate programs
uv run generate_transformers.py --midi_path assets/examples/1.mid --n_outputs 5

# decompile a specific 15-second window of your own MIDI
uv run generate_vllm.py --midi_path song.mid --start_sec 30 --duration_sec 15

# see which instruments a file contains
uv run generate_transformers.py --midi_path song.mid --list_instruments

# decompile only selected instruments (GM names, program numbers, or 'drum')
uv run generate_vllm.py --midi_path song.mid --instruments drum,acoustic_bass,4

Each run writes a session directory:

outputs/20260719_123456_song/
├── input_repr.txt   # the serialized MIDI the model saw
├── output_1.js      # generated Strudel programs …
├── …
└── args.json

Paste any output_*.js into the Strudel REPL to play and edit it.

Tips

  • The model is mostly trained on clips under 30 seconds; a range of 15–30 seconds would work best.
  • Very dense selections (many notes / many instruments) can exceed the model's input limit; shorten the window or filter instruments.
  • Sampling uses temperature 1.0 (the paper's evaluation setting); we recommend sampling multiple outputs (--n_outputs 5) and picking your favorite.

Citation

@article{kim2026decomposer,
  title   = {Decomposer: Learning to Decompile Symbolic Music to Programs},
  author  = {Kim, Yewon and Gandhi, Apurva and Chung, David and Neubig, Graham and Donahue, Chris},
  journal = {arXiv preprint arXiv:2607.01849},
  year    = {2026}
}

About

Official Implementation of Decomposer: Learning to Decompile Symbolic Music to Programs

Resources

Stars

11 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages