Use TensorFlow to generate short sequences of music with a Restricted Boltzmann Machine. This is the code for Generate Music in TensorFlow on YouTube.
- Tensorflow
- pandas
- numpy
- msgpack-python
- glob2
- tqdm
- python-midi
Use pip to install any missing dependencies (i.e pip install --upgrade msgpack)
pip3 install pandas
pip3 install msgpack-python
pip3 install numpy
pip3 install glob2
pip3 install tqdm
pip3 install git+https://github.com/vishnubob/python-midi@feature/python3
To train the model and create music, simply clone this directory and run
python rbm_chords.py
[Restricted Boltzmann Machine]_chords.py
The training data goes in the pop_music_midi folder. You have to use MIDI files. You can find some here. Training will take 5-10 minutes on a modern laptop. The output will be a collection of midi files. You can combine them together with a script if you'd like.
The challenge for this video is to create a happy/upbeat MIDI file using this script. You could play with the hyperparameters if you'd like to see what works, choose a happy/upbeat MIDI dataset, or do both. When you're done, upload your clone of this repository whether or not the code is modified with your generated MIDI files included in the repo. Post a link to your code in the comments of the video. I'll mention the winner (the most upbeat sounding MIDI, any of the snippets is fine or if you want you can combine them) in my next video. Good luck!!
The credit for this code goes to dshieble i've merely created a wrapper around his code to make it easier to get started.