Code Monkey home page Code Monkey logo

SymphonyNet

Introduction

SymponyNet is an open-source project aiming to generate complex multi-track and multi-instrument music like symphony. Our method is fully compatible with other types of music like pop, piano, solo music..etc.

Schema.

Have fun with SymphonyNet !!

Installation guide

We highly recommend users to run this project under conda environment.

Prepare the environment:

conda create -n your_env_name python=3.8
conda activate your_env_name

cd path_to_your_env
git clone this_project

cd SymphonyNet
cat requirements.txt | xargs -n 1 -L 1 pip install

The reason for using cat requirements is we find out the pytorch-fast-transformers package needs to be built upon torch, directly pip install requirements may cause pytorch-fast-transformers built error.

Note: Building pytorch-fast-transformers takes a while, please wait patiently.

Training pipeline

Step 1:

  • Put your midi files into data/midis/

Step 2:

  • Run python3 src/preprocess/preprocess_midi.py under project root path

Quick note: The preprocess_midi.py multi-process all the Midis and convert them into a raw_corpus.txt file. In this file, each line of encoded text represents a full song.

Step 3 (optional):

  • Run python3 src/preprocess/get_bpe_data.py if you want to train the model with Music BPE. More details about fast BPE implementation could be found here Music BPE.
  • Set BPE=1 in config.sh file

Note: We only provide music_bpe_exec file for linux system usage, if you are using MacOS or Windows, please re-compile the music_bpe_exec file here by following the instruction.

Step 4:

  • Run python3 src/fairseq/make_data.py to convert the raw_corpus.txt into binary file for fairseq and create four vocabularies mentioned in the paper.

Step 5:

  • Run sh train_linear_chord.sh to train your own model!

Generation pipeline

  • Put your checkpoint file or download our pretrained model into ckpt/
  • Run python3 src/fairseq/gen_batch.py test.mid 5 0 1 to generate one symphony MIDI conditioned on the first 5 measures of test.mid, with no constraints of chord progression.
  • Or replace test.mid with your own prime MIDI and set how many measures of chords from the prime MIDI you may want to keep.
  • We provide a Google Colab file play_symphonynet.ipynb, where you could follow the generation guide.

License

SymphonyNet is released under the MIT license

symphonynet's Projects

symphonynet icon symphonynet

Symphony Generation with Permutation Invariant Language Model

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.