PyTorch implementation of Performance RNN, inspired by Ian Simon and Sageev Oore. "Performance RNN: Generating Music with Expressive Timing and Dynamics." Magenta Blog, 2017. https://magenta.tensorflow.org/performance-rnn.
This model is not implemented in the official way!
- A sample on C Major Scale [MIDI, MP3]
- control option:
-c '1,0,1,0,1,1,0,1,0,1,0,1;4'
- control option:
- A sample on C Minor Scale [MIDI, MP3]
- control option:
-c '1,0,1,1,0,1,0,1,1,0,0,1;4'
- control option:
- A sample on C Major Pentatonic Scale [MIDI, MP3]
- control option:
-c '5,0,4,0,4,1,0,5,0,4,0,1;3'
- control option:
- A sample on C Minor Pentatonic Scale [MIDI, MP3]
- control option:
-c '5,0,1,4,0,4,0,5,1,0,4,0;3'
- control option:
.
├── dataset/
│ ├── midi/
│ │ ├── dataset1/
│ │ │ └── *.mid
│ │ └── dataset2/
│ │ └── *.mid
│ ├── processed/
│ │ └── dataset1/
│ │ └── *.data (preprocess.py)
│ └── scripts/
│ └── *.sh (dataset download scripts)
├── output/
│ └── *.mid (generate.py)
├── save/
│ └── *.sess (train.py)
└── runs/ (tensorboard logdir)
-
Download datasets
cd dataset/ bash scripts/NAME_scraper.sh midi/NAME
-
Preprocessing
# Preprocess all MIDI files under dataset/midi/NAME python3 preprocess.py dataset/midi/NAME dataset/processed/NAME
-
Training
# Train on .data files in dataset/processed/MYDATA, and save to save/myModel.sess every 10s python3 train.py -s save/myModel.sess -d dataset/processed/MYDATA -i 10 # Or... python3 train.py -s save/myModel.sess -d dataset/processed/MYDATA -p hidden_dim=1024 python3 train.py -s save/myModel.sess -d dataset/processed/MYDATA -b 128 -c 0.3 python3 train.py -s save/myModel.sess -d dataset/processed/MYDATA -w 100 -S 10
-
Generating
# Generate with control sequence from test.data and model from save/test.sess python3 generate.py -s save/test.sess -c test.data # Generate with pitch histogram and note density (C major scale) python3 generate.py -s save/test.sess -l 1000 -c '1,0,1,0,1,1,0,1,0,1,0,1;3' # Or... python3 generate.py -s save/test.sess -l 1000 -c ';3' # uniform pitch histogram python3 generate.py -s save/test.sess -l 1000 # no control # Use control sequence from processed data python3 generate.py -s save/test.sess -c dataset/processed/some/processed.data
- ecomp.sess
- default configuration
- dataset: International Piano-e-Competition, recorded MIDI files
- ecomp_w500.sess
- window_size: 500
- control_ratio: 0.7
- dataset: International Piano-e-Competition, recorded MIDI files
- pretty_midi
- numpy
- pytorch >= 0.4
- tensorboardX
- progress