serkansulun / midi-emotion

Generates multi-instrument symbolic music (MIDI), based on user-provided emotions from valence-arousal plane.
Other
58 stars 8 forks source link
deep-learning emotion midi music-generation symbolic-music valence-arousal

Generates multi-instrument symbolic music (MIDI), based on user-provided emotions from valence-arousal plane. In simpler words, it can generate happy (positive valence, positive arousal), calm (positive valence, negative arousal), angry (negative valence, positive arousal) or sad (negative valence, negative arousal) music.

Source code for our paper "Symbolic music generation conditioned on continuous-valued emotions", Serkan Sulun, Matthew E. P. Davies, Paula Viana, 2022. https://ieeexplore.ieee.org/document/9762257

To cite: S. Sulun, M. E. P. Davies and P. Viana, "Symbolic music generation conditioned on continuous-valued emotions," in IEEE Access, doi: 10.1109/ACCESS.2022.3169744.

Required Python libraries: Numpy, Pytorch, Pandas, pretty_midi, Pypianoroll, tqdm, Spotipy, Pytables. Or run: pip install -r requirements.txt

To create the Lakh-Spotify dataset:

Lakh pianoroll 5 full dataset

MSD summary file http://labrosa.ee.columbia.edu/millionsong/sites/default/files/AdditionalFiles/msd_summary_file.h5

Echonest mapping dataset ftp://ftp.acousticbrainz.org/pub/acousticbrainz/acousticbrainz-labs/download/msdrosetta/millionsongdataset_echonest.tar.bz2 Alternatively: https://drive.google.com/file/d/17Exfxjtq7bI9EKtEZlOrBCkx8RBx7h77/view?usp=sharing

Lakh-MSD matching scores file http://hog.ee.columbia.edu/craffel/lmd/match_scores.json

To preprocess and create the training dataset:

To generate MIDI using pretrained models:

To train:

There are 4 different conditioning modes: none: No conditioning, vanilla model. discrete_token: Conditioning using discrete tokens, i.e. control tokens. continuous_token: Conditioning using continuous values embedded as vectors, then prepended to the other embedded tokens in sequence dimension. continuous_concat: Conditioning using continuous values embedded as vectors, then concatenated to all other embedded tokens in channel dimension.

See config.py for all options.