Generally, Music is represented in 4 types:
-
Sheet Music (https://en.wikipedia.org/wiki/Sheet_music)
-
abc - notation (https://en.wikipedia.org/wiki/ABC_notation)
-
mp3 format (sound)
In this project, I am using abc-notion of Music as it is easy to train a RNN model on top of character sequences
This code is written in Python, and it requires the [Keras] deep learning library.
In this project, I will use the Keras library to create and train the LSTM model. Once the model is trained we will use it to generate the musical notation for our music.
All input data is placed in the data/
directory. The file input.txt
is taken from the Nottingham Dataset (Cleaned) with total 340 tunes.
train.py --> Creating Batches of data
model.py --> Creating weights and Building a sequence model
sample.py --> Sampling the trained model (with epochs, seed, len as arguments)
logs/training_log.csv --> Training loss/accuracy is stored in logs/training_log.csv
with Epochs, Training Loss and Accuracy.
model --> saved models and weights
data --> Input data in abc-notation form and Char_to_index file
output --> Training Data log file with detailed info of Model Architecture and training loss, accuracy at every batch and epochs
Visualization --> A notebook with Visualizing Training loss and Accuracy over number of Epochs
python train.py
It took 3 hours for me to run the model in my local system (CPU).
Here I did not gave argument for first character to start with, therefore the model pick a random character and generate output.
python sample.py 100