yml2mid: YAML to MIDI Sequencer
Repository: gitlab.com/lf3/yml2mid
Thesis: UNQ Music Technology Bachelor’s Thesis (2019)
A text-based MIDI sequencer that generates music from YAML files. Developed as part of a Bachelor’s thesis in Music Technology at Universidad Nacional de Quilmes.
What it does
Reads YAML definitions of musical structures and outputs standard MIDI files. The entire composition workflow happens in plain text, version-controlled, and processable by any text tool.
YAML → PyYAML parser → Secuencia (logic) → MIDIUtil → MIDI file
Why plain text for music
Traditional music tools (DAWs, notation software) lock musical information into proprietary formats. They’re not version-controllable, difficult to automate, and couple representation to a specific application.
yml2mid treats musical information as plain text - portable, manipulable, and processable programmatically.
Language structure
Musical discourse organized as a tree:
- Pista (Track) - instrument part
- Sección (Section) - groups of units
- Segmento (Segment) - actual note data
- Articulación - individual notes/events
Property inheritance
Units inherit from parent units using YAML anchors:
base: &base
transportar: 60
registro: [0, 2, 4, 5, 7, 9, 11, 12]
a: &a
<<: *base
alturas: [5, 5, 6, 5]
duraciones: [.75, .25, 1, 1]
Registration system
Pitches are indices into a scale array, not absolute MIDI notes:
registro: [0, 2, 4, 5, 7, 9, 11, 12] # major scale intervals
alturas: [1, 3, 5, 8] # C, E, G, C'
Transposition works at two levels: transportar shifts MIDI note, transponer shifts index within scale.
Examples
Feliz Cumpleaños (single track):
- Hierarchical form structure
- Property inheritance across levels
- Transposition within registration
- Lyrics synchronized with notes
Billie Jean (bass, drums, keys):
- Multi-track MIDI output
- Drum programming using fixed registration
- Voice layering for chords
- Different registration per track
Plugin system
User plugins enable algorithmic transformations:
complementos: 'enchufes.py'
unidades:
a:
alturas: [5, 5, 6, 5]
fluctuar: # calls fluctuar() in enchufes.py
dinamicas: .5
Allows randomization, variation, generative patterns without modifying core system.
Tech stack
- Python 3 - implementation language
- PyYAML - YAML parsing
- MIDIUtil - MIDI encoding
- Spanish vocabulary - domain-specific language terms
Connection to other work
- UNIX Philosophy paper: Applies same plain-text, composable-process thinking
- COP paper: Structured text as primary reasoning medium
- article-boilerplate: Same documents-as-code philosophy
- National Innovation Award: MIDI controller builds on this thesis work