This project implements two neural symbolic music generation models using recurrent neural networks (RNNs):
- An unconditioned LSTM model that generates piano sequences based only on learned musical patterns.
- A chord-conditioned LSTM model that generates melodies based on provided harmonic structures.
Both models were trained on the GiantMIDI-Piano dataset and generate symbolic MIDI sequences.
Deep learning has enabled models to learn patterns in music and generate new compositions. This project explores symbolic music generation, where music is represented as discrete events (notes, timing, and musical structure) rather than raw audio waveforms.
The project compares two approaches:
- Unconditioned generation: The model learns musical structure directly from piano performances.
- Conditioned generation: The model incorporates chord information to guide melodic generation and improve musical coherence.
The unconditioned model uses an LSTM-based architecture:
- MIDI files are tokenized using the REMI representation
- Musical events are converted into sequential tokens
- The LSTM predicts the next musical event based on previous context
Pipeline:
MIDI → REMI Tokens → LSTM → Predicted Tokens → MIDI Sequence
The conditioned model generates melodies while receiving chord information as additional context.
Pipeline:
MIDI → Chord/Melody Extraction → Chord Representation + Melody Tokens → LSTM → Generated Melody
This allows the model to produce music that follows a harmonic structure rather than generating notes independently.
- Python
- PyTorch
- LSTM Neural Networks
- REMI Tokenization
- GiantMIDI-Piano Dataset
- miditok
- miditoolkit
- MIDIUtil
- FluidSynth
A sample generated sequence from the chord-conditioned LSTM model:
Listen to generated conditioned sample
Generated MIDI:
symbolic_conditioned.mid
A sample generated sequence from the unconditioned LSTM model:
Listen to generated unconditioned sample
Generated MIDI:
symbolic_unconditioned.mid
The project includes:
- Training and validation loops
- Perplexity evaluation
- Comparison against n-gram baselines
- MIDI generation and export
This project was developed in Google Colab and expects access to the GiantMIDI-Piano dataset.
Required dependencies:
- PyTorch
- miditok
- miditoolkit
- midiutil
- FluidSynth
The notebook-style script includes dataset preparation, training, sampling, and MIDI export.
For local execution, dataset paths and Google Drive references should be updated.
This project was trained on the GiantMIDI-Piano dataset, a large-scale dataset of piano MIDI files used for symbolic music generation research.
Dataset: https://github.com/bytedance/GiantMIDI-Piano
The dataset is not included in this repository due to its size and licensing considerations.
This project was completed as part of the Machine Learning for Music course, exploring the application of deep learning techniques to symbolic music generation.
The repository contains the final implementation of two LSTM-based music generation models, along with example MIDI outputs generated by the trained systems.
- Kong, Q., Li, B., Chen, J., & Wang, Y. (2020). GiantMIDI-Piano: A large-scale MIDI dataset for classical piano music. ArXiv. https://arxiv.org/abs/2010.07061