train and generate melody for pop music with recurrent neural networks
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


  • This repository implements melody generation model proposed in this paper.

  • The input is a two-hot vector in which the first 1 corresponds to a certain chord progression of 2-bar lengths (ex: C - Am), and the second 1 corresponds to the part annotation, e.g., verse, chorus, etc.

  • The output is a MIDI file with generated melody converted from generated strings. Generated strings are currently in the form of pitch;pos;duration.

  • This repository is a modification of NeuralTalk.



  • To train


  • To deactivate regularization on pitch range

    python --reg_range_coeff 0

  • To set pitch range for regularization (default is 60~72)

    python --reg_range_min your_min_val --reg_range_max your_max_val

  • To generate MIDI file

    python cv/checkpoint_file

  • To generate MIDI file with HMM-generated input (by default, song will be generated based on our pre-set test input)

    python cv/checkpoint_file --gen_chords True

  • Notes are inserted to MIDI files on a real-valued time instead of discrete musical lengths, so make sure to quantize it on any sequencer (e.g. GarageBand). 1/16 is recommended.

  • Check our demos


@article{andrew2017neuralmelody, author={Andrew Shin, Leopold Crestel, Hiroharu Kato, Kuniaki Saito, Katsunori Ohnishi, Masataka Yamaguchi, Masahiro Nakawaki, Yoshitaka Ushiku, Tatsuya Harada}, title={Melody Generation for Pop Music via Word Representation of Musical Properties}, journal={arXiv preprint arXiv:1710.11549}, year={2017} }


BSD license.