Skip to content

suddensleep/midi_levelUp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project Kojak: Augmenting MIDI Files

I trained Markov Chain models on melodies and rhythms, and using them to augment existing MIDI files, adding new notes to the files to produce slightly more advanced arrangements.

Webapp (current version):

You can find a working version here. I'm still learning all sorts of things about hosting things on AWS so do please let me know if this link is broken at any point.

###Diary of my work so far:

  1. Scraping MIDI files from the internet

Requirements:

You may want to use a virtual environment to install the following Python packages:

Additionally, for the webapp to work, you'll want the following:

Executables:

From the (Mac or Linux) terminal, run the following commands.

# move to the source directory of the repo
$ cd path/to/midi_levelUp/src


# run midi_funcs for a short demo of 
# sequence extraction
$ python midi_funcs.py


# run markov_funcs for a short demo of 
# creating markov chains and producing
# pickled models
$ python markov_funcs.py

# in d3_model folder:
$ python play_notes.py

###Note on storage space for webapp: In order to clean up the wav files that get generated by play_notes.py, you can set up a cron job by opening the terminal and typing the following command:

# Edit the existing crontab file
$ sudo crontab -e

Once inside the editor, append the line

*/5 * * * * python /path/to/repo/d3_model/clear_static.py

and be sure to add a new line before EOF. The */5 will clear the files every five minutes, and you can change this at your own discretion (read more about cron files here).

###Note on persistence for webapp: Type python play_notes.py & to run the app in the background (i.e. you can still use your shell while the program runs). The program should persist, but in case something goes wrong, you can add a line like this to your crontab:

0 * * * * cd path/to/repo/ && . ./env/bin/activate && python d3_model/play_notes.py

The first two commands tell cron to change its default working directory from home to the right folder, and to activate the virtualenv (you can skip this middle command if you are running directly off your core machine).

The last command restarts the play_notes.py script. This script includes a line at the beginning to make sure it's the only instance of itself running, and exits if the app is already up. The line above will attempt this restart process once an hour at the top of the hour, and you can change it at your discretion.

About

Interpolating notes and rhythms onto existing MIDI tracks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published