Skip to content

Cyxo/musenn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

MuseNN - When RNN meets music

Summary :

  1. Some compositions
  2. How does it work
  3. Contact MuseNN

Some composition

MuseNN was trained on different styles. The best results came from House melodies on piano and a Classical quatuor from Mozart.

The other styles I trained the RNN on resulted on complete mess of notes (almost like Black MIDIs), or were too close from the training models. So here are the best I could get (training on little data - around 250 chars -, with a minimal RNN, on my highschool's server) :

| ► NNHouse | 1:42 | 1 instrument (piano) | Trained on ten 15-seconds melodies |

| ► Moznn | 4:43 | 4 instruments (violin 1 and 2, viola, cello) | Trained on Mozart's String quartet n°1 in G |

Downloads :

MP3s :

Scores :

How does it work ?

First things first : What is MuseNN? As you probably read before on this page, MuseNN is a RNN, a Recurrent Neural Network. It's more precisely a Char-RNN (which works with characters). The concept is simple : it is trained on a text and tries to generate a similar text.

Characters in music? Well, I knew the power of Char-RNN, and I was a bit too lazy to create my own RNN specially for music, so I was looking for a way to make music into text. And then I found the ABC notation. So I decided to convert MIDI files into ABC notation and to train my Char-RNN.

Isn't training a long task? If you already heard of RNN or Deep/Machine Learning, you may also have heard that it requires strong computers (that's why Google is pretty involved in Deep Learning...). So you may wonder how was I able to train a 152 neurons network (it is actually small for a RNN) from my $600 laptop in my room ? First, I used Karpathy's Minimal Char-RNN (in Python), which doesn't use heavy libraries like TensorFlow, so it's not hard to train it on a small device. Then, I didn't run it on my poor computer . I used my highschool's server (in France, you can do your studies in a high school), which is not a bad UNIX machine. It took around 4 hours for each file (hopefully I could train all 4 instruments of Moznn simultaneously).

Can I train it on my own music? Sure! As the code is mainly not mine, I made MuseNN open source! You just have to clone the Git repository to your files. Then, here is how to train it :

  1. Find some good MIDI files (the more the better!) and convert them to ABC (I used EasyABC to do this).

  2. Copy only the notes lines (not the headers like "X:...", "K:..." or "V:...") and paste it in a text file in MuseNN's folder.

  3. Now you can train MuseNN like this:

    musenn.py -f your_file.txt -o output_folder -m 2e6

  4. After 2 million iterations, it should have generated many files, and one prefixed with "FINAL". You can copy its content in a .abc file or directly paste it in EasyABC.

  5. Then you'll have to correct several mistakes (depending on your computers' quality, and the loss of the file), but hopefully, EasyABC tells where they are (just ignore "Bad tie" and "Line under/overfull")

And... You're done ! You can now export it as MIDI so you can listen the creation.

Contact MuseNN

You can contact MuseNN (actually its creator, me, Paul Forveille, also known as Cyxo) by the following ways :

I'm French so if you want to speak French, you can

Je suis français !

Enjoy!

About

A music composing char-rnn

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages