Skip to content

Will-Turchin/MidiAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎶 LSTM Classical Music MIDI Generator

This project trains an LSTM model to generate short classical music melodies in MIDI format. It tokenizes MIDI files into pitch–duration sequences, learns musical structure, and then samples new melodies.

This is an experimental project I created to explore the intersection of machine learning and music.


Setup

Clone the repository:

Install dependencies:

  • Primary ones include pretty_midi and pytorch
  • Ensure you have a Python environment with at least version 3.8

Basics

  • Run the test.py program to generate 10 midi files (~200 tokens in length) into the generated songs folder
  • To modify how 'creative' the model is adjust the temperature parameter found inside test.py

Training the model

  • To retrain the model, use the test.py program, you can modify parameters such as the number of epochs to run inside of this program
  • To add/remove training data, add midi files into the training_data directory

Notes and Limitations

  • The model occasionally reproduces recognizable classical phrases if overtrained.
  • Output is monophonic (one note at a time).
  • This is a prototype and not intended for production use.

Future Work

  • Support for polyphonic melodies
  • Adding style‑conditioning (e.g., composer or era)
  • More robust evaluation metrics for creativity vs accuracy

About

Machine Learning Model to generate basic classical melodies

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages