This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| micromusic.py - A GPT that learns to compose melodies. | |
| Pure Python, zero dependencies, one file. | |
| Inspired by @karpathy's microgpt. Same algorithm, different domain. | |
| Instead of learning the pattern of names, it learns the pattern of music | |
| python micromusic.py trains on CPU, prints hallucinated melodies | |
| python micromusic.py --save same + saves MIDI files you can listen to | |
| @kaizenman |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| C3 q C3 q D3 q E3 q BAR G3 h | |
| F3 e G3 e A3 e B3 e BAR C4 e D4 e E4 e F4 e BAR E4 e D4 e C4 e B3 e BAR A3 e G3 e F3 e | |
| F4 e G4 e A4 q C5 q BAR D5 q | |
| F#4 q E4 q D4 q C#4 q | |
| F#3 e G#3 e A#3 e C#4 e BAR D#4 e F#3 e G#3 q | |
| C3 h G3 q F3 q F3 e BAR E3 e E3 h | |
| A4 q D5 q C5 q B4 q BAR A4 q | |
| F#3 q G#3 q A#3 q B3 q BAR C#4 q D#4 q F4 q F#4 q | |
| A4 q A4 q A#4 q C5 q BAR C5 q A#4 q A4 q | |
| G#3 q G#3 q A#3 q C4 q BAR A#3 q G#3 q G3 q G#3 q BAR A#3 q C4 q A#3 q G#3 q BAR A#3 q F3 h |