Work / personal
RNN Pop Music Generation
PyTorch RNN that generates pop music as readable sheet music, using an interval-based token system that cuts vocabulary size by 80%.
- Kind
- personal
- Status
- complete
- Role
- solo
- Period
- Jan 2025 – Dec 2025
Problem
Symbolic music generation usually tokenizes absolute pitch, which means the model has to learn the same melodic shape separately in every key. That inflates the vocabulary, splits the training signal across redundant tokens and wastes capacity on a transformation that is musically trivial.
Data
- Source: POP909, 909 pop songs in MIDI, converted through an automated tokenization pipeline
- Representation: interval-based tokens: the distance between notes rather than absolute pitch
- Output format: generated tokens are piped back to sheet music via music21, so results are immediately readable and playable
Approach
A recurrent network over interval tokens. Instead of emitting the pitch directly, the sequence is re-expressed as the difference between consecutive notes:
Encoding transitions rather than positions makes the representation key-invariant: a phrase transposed into a different key is the same token sequence, so every training example teaches the model about every key at once. That change alone reduced vocabulary size by 80%.
The pipeline is end-to-end automated: MIDI in, packaged training sequences out, generated sheet music at the other end.
Experiments
| Metric | Dataset | Value | Baseline | Delta |
|---|---|---|---|---|
| vocabulary size reduction | MIDI training corpus | 80% | n/a | n/a |