mcpField
M
midi-synth

midi-synth

github.com/maystudiosCreative & media2674 installsUpdated 11w ago
Repository

About midi-synth

midi-synth is a skill for turning MIDI or MusicXML into Strudel patterns and rendered audio. It helps music creators clean notes using velocity, duration, and optional key analysis.

Key features

  1. 01MIDI and MusicXML input
  2. 02Strudel pattern generation
  3. 03WAV and MP3 rendering
  4. 04Ghost-note filtering by velocity and duration
  5. 05Key-aware note filtering

Use cases

  1. 01Generate Strudel code from a score
  2. 02Render MIDI as WAV or MP3
  3. 03Clean artifacts using analysis data

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/maystudios/claude-skills --skill midi-synth

After installing, type/midi-synthin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

scripts/
render.py
to_strudel.py
soundfonts/
README.md

Details

From the project README

MIDI Synth

Synthesize MIDI/MusicXML to audio and generate Strudel live-coding patterns. Uses analysis data for ghost-note cleaning, correct tempo, and key-aware filtering.

Scripts

  • scripts/to_strudel.py -- MIDI/MusicXML to Strudel patterns with duration-aware notation
  • scripts/render.py -- MIDI/MusicXML to WAV/MP3 with cleaning and modifications

Both scripts auto-detect *_analysis.json files from audio-to-midi for tempo, key, and dynamics.

Workflow

  1. Identify input: MIDI (.mid) or MusicXML (.musicxml)
  2. Auto-detect or specify the analysis JSON from audio-to-midi
  3. Choose workflow:
    • Creative: to_strudel.py generates Strudel code for strudel.cc
    • Rendering: render.py produces WAV/MP3
    • Both: run both on the same input
  4. Ghost notes are automatically cleaned using velocity, duration, and key filters

Strudel Code Generation

# Basic (auto-detects analysis JSON next to input)
py -3.12 scripts/to_strudel.py "song.mid"

# From MusicXML
py -3.12 scripts/to_strudel.py "song.musicxml"

# Explicit analysis file
py -3.12 scripts/to_strudel.py "song.mid" --analysis "song_analysis.json"

# Stricter ghost-note filtering
py -3.12 scripts/to_strudel.py "song.mid" --min-velocity 60 --min-duration 0.1

# Open in browser
py -3.12 scripts/to_strudel.py "song.mid" --open
FlagDefaultEffect
--analysisauto-detectPath to analysis JSON for tempo/key
--bars4Pattern length in bars
--resolution16Grid: 4/8/16/32
--min-velocity40Remove notes below this velocity (0-127)
--min-duration0.05Remove notes shorter than this (seconds)
--no-key-filteroffDisable key-based ghost note filtering
--tempofrom analysisOverride tempo BPM
--openoffOpen in strudel.cc in browser

Note durations are encoded with @N notation (e.g., c3@4 = held for 4 steps).

Audio Rendering

# Basic (auto-detects analysis, cleans ghost notes)
py -3.12 scripts/render.py "song.mid" --mp3

# From MusicXML
py -3.12 scripts/render.py "song.musicxml" --mp3

# With SoundFont
py -3.12 scripts/render.py "song.mid" --soundfont "GeneralUser_GS.sf2" --mp3

# Aggressive cleaning
py -3.12 scripts/render.py "song.mid" --min-velocity 60 --min-duration 0.1

# Skip cleaning entirely
py -3.12 scripts/render.py "song.mid" --no-clean

# Modifications
py -3.12 scripts/render.py "song.mid" --tempo 2.0 --transpose 3 --instrument 0
FlagDefaultEffect
--analysisauto-detectAnalysis JSON for tempo/key-based cleaning
--min-velocity40Ghost note velocity threshold
--min-duration0.05Ghost note duration threshold (seconds)
--no-cleanoffSkip ghost note removal
--no-key-filteroffDisable key-based filtering
--soundfontauto-detect.sf2 SoundFont path
--tempo1.0Tempo scale factor
--transpose0Semitones up/down
--instrumentoriginalOverride GM program (0-127)
--mp3offAlso produce MP3

Ghost Note Cleaning

Three filter layers (applied in order):

  1. Velocity filter: removes notes below --min-velocity (default: 40)
  2. Duration filter: removes notes shorter than --min-duration (default: 50ms)
  3. Key filter: if analysis provides a key, removes out-of-key notes that also have low velocity (<60)

The key filter only removes notes that are BOTH out-of-key AND below medium velocity, preserving intentional chromatic passages.

Dependencies

Auto-installed: pretty_midi, numpy, soundfile. For MusicXML input: music21 (installed by audio-to-midi skill). Optional: pyfluidsynth + .sf2 SoundFont for high-quality rendering. Runtime: Python 3.12 (py -3.12).

Comments

Markdown supported