Skip to content

dasari-mohana-zz/Music_Generation_Char_RNN_project

Repository files navigation

Music_Generation_Char_RNN_project

Music Format (Input)

Generally, Music is represented in 4 types:

  1. Sheet Music (https://en.wikipedia.org/wiki/Sheet_music)

  2. abc - notation (https://en.wikipedia.org/wiki/ABC_notation)

  3. MIDI (https://towardsdatascience.com/how-to-generate-music-using-a-lstm-neural-network-in-keras-68786834d4c5)

  4. 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

Requirements

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.

Data Source

All input data is placed in the data/ directory. The file input.txt is taken from the Nottingham Dataset (Cleaned) with total 340 tunes.

Files

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

Usage

To train the model with default settings:

python train.py

It took 3 hours for me to run the model in my local system (CPU).

To sample the model with 100 epochs :

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
The output can be tested in the below website where we input the abc - notation of music generated by Char-RNN model.

https://www.abcjs.net/abcjs-editor.html

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published