A deep belief net coupled with a recurrent LSTM network that composes original piano pieces. Implemented in TensorFlow. To see some sample generated songs, see the portfolio page of my website https://ericelmoznino.wixsite.com/work/portfolio (AI Musician - 2017)
- Python 3
- TensorFlow (confirmed working with version 1.4, but will likely work for ealier and more recent distributions as well)
- A midi file player (to listen to the training data and generated songs)
The process for how to train a model and generate music should be clear from looking at the template in 'main.py'. It consists of:
- Instantiating a
MusicGeneratorobject with the desired training and model configurations - Calling the
MusicGeneratorobject'strain(dataset_path)method on a folder of midi files - Calling the
MusicGeneratorobject'sgenerate(length, primer_song, save_folder, song_name)method. The method will both save the song at the path and return the generated music
Some datasets have been packaged with the repository to quickly make sure everything is working fine.
- MusicGenerator.py: Contains the principal class for model instantiation, training, and generation. All the session logic is in here. Training data must be music in .mid format, and composed music is in .mid as well.
- RNN_DBN.py: A deep belief net that is conditioned on the state of a recurrent net. The class is generalized and can work for a variety of appropriate tasks, not only music generation.
- DBN.py: Class implementation of a deep belief net (stacked RBM's).
- RBM.py: Class implementation of an RBM.
- Helpers.py: Convenience functions and classes.
- MidiManipulator.py: Logic to process .mid files into numpy arrays.
- main.py: An example of training the model and generating music with it.