Music Generator

1 0
  • 0 Collaborators

Music Generator is a Natural Language Processing based project that generates the notes and chords of the musical instrument that is used in the input music file. It uses an LSTM model deployed using Keras, Music21 and numpy library in Python. ...learn more

Project status: Under Development

Artificial Intelligence

Groups
Student Developers for AI

Intel Technologies
AI DevCloud / Xeon, Intel Python

Code Samples [1]

Overview / Usage

This project is used to predict the next sequence of notes and chords with their pitch based on the input music file. It basically uses a single layered LSTM layer coupled with other layers like Dense and Dropout. At the end, it produces a sweet melody!

Methodology / Approach

The language used is Python with Keras running on Tensorflow backed GPU platform. The first thing is to get a music file (preferable from a single musical instrument) as a .MID file. This will serve as the training file. Now using the Music21 library of Python, we get the sequence of notes and chords in the music file along with their pitch and octaves. Then we normalize the input dataset by dividing with the total length of the unique notes and chords.

Architecture of the model

The model used is a three layered LSTM model. We add a dropout layer following the first two LSTM layers followed by a Dense layer for the third LSTM layer. Following this we add a Dropout and Dense layer successively. The final layer is the Activation layer that uses the sigmoid activation function. We also add a checkpoint after it to save the trained weights in case we terminate in between training.

Prediction

Finally, after training 200 epochs with batch size 64, now it is the time to predict the generated music. We again use the Music21 library to convert the predicted notes and chords in the form of numbers to a .MID file that can be played. Now enjoy the melody!

Technologies Used

  1. Intel optimized Python
  2. Intel optimized Tensorflow
  3. Keras
  4. Music21
  5. Numpy
  6. Intel AI DevCloud

Repository

https://github.com/guptasamarth61/Music-Generation

Comments (0)