Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Symbolic Music Generator

This project implements two neural symbolic music generation models using recurrent neural networks (RNNs):

  1. An unconditioned LSTM model that generates piano sequences based only on learned musical patterns.
  2. 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.

Overview

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.

Models

Unconditioned Music Generator

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

Chord-Conditioned Music Generator

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.

Technologies

  • Python
  • PyTorch
  • LSTM Neural Networks
  • REMI Tokenization
  • GiantMIDI-Piano Dataset
  • miditok
  • miditoolkit
  • MIDIUtil
  • FluidSynth

Example Outputs

Conditioned Model

A sample generated sequence from the chord-conditioned LSTM model:

Listen to generated conditioned sample

Generated MIDI: symbolic_conditioned.mid

Unconditioned Model

A sample generated sequence from the unconditioned LSTM model:

Listen to generated unconditioned sample

Generated MIDI: symbolic_unconditioned.mid

Evaluation

The project includes:

  • Training and validation loops
  • Perplexity evaluation
  • Comparison against n-gram baselines
  • MIDI generation and export

Running the Project

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.

Dataset

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.

Project Status

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.

Reference

About

Developed two symbolic music generators in PyTorch using LSTM RNNs: an unconditioned model and a chord-conditioned model trained on the GiantMIDI-Piano dataset to generate expressive piano sequences.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages