Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/frankykyaw/deepmelodylstm

An LSTM based music generation model trained on midi data. The model takes in a sequence of a certain length and learns to predict the next note.
https://github.com/frankykyaw/deepmelodylstm

deep-learning embedding-vectors lstm music-generation music-theory neural-network tensorflow

Last synced: about 1 month ago
JSON representation

An LSTM based music generation model trained on midi data. The model takes in a sequence of a certain length and learns to predict the next note.

Awesome Lists containing this project

README

        

# Deep Melody LSTM

This repository contains a Python implementation of a hierarchical LSTM (Long Short-Term Memory) model for generating music sequences. The project utilizes the music21 library for processing MIDI files and extracting musical information, such as notes, chords, and key signatures.
## Dataset
Around 200 choral pieces from Renaissance era scraped from https://www.cpdl.org
## Data Preprocessing:
Processes MIDI files and extracts sequences of notes and chords for each measure.
Then converts the extracted sequences into integer representations suitable for the neural network input. Mapping function generates mappings between musical elements (notes, chords) and their integer representations.
## Model Architecture:
The hierarchical_lstm_model function defines the architecture of the hierarchical LSTM model, which consists of two parallel LSTM branches for note sequences and chord sequences. The outputs of these branches are concatenated and fed into another LSTM layer, allowing the model to learn the relationship between notes and chords.
## Training:
The train function sets up the model and preprocessed data, and initiates the training process using the TensorFlow/Keras API. The trained model is saved for later use in generating music sequences.
## Generation:
Takes the trained model, chords, and generates a specified number of new notes by sampling from the model's predictions. The generation process occurs on a measure-by-measure basis, where the model first predicts the chord for the next measure, and then generates the sequence of notes based on the predicted chord and the previous sequence of notes and chords.
## Results:

https://github.com/FrankyKyaw/DeepMelodyLSTM/assets/73188846/1fd7a7b0-6366-4337-a9bd-2d2b2f160fd9

https://github.com/FrankyKyaw/DeepMelodyLSTM/assets/73188846/de4e4cbe-4752-4af3-9cc1-f21de413c267

## To do
- [X] Train on a larger dataset
- [X] Preprocess the dataset into beats instead of measures to have more granular training over the notes
- [ ] Explore different neural network architectures specifically multi-head attention mechanisms
- [ ] Incorporate additional musical features such as dynamics, meter and instrument combinations
- [ ] Deploy the model to a web application where users can input seed notes