{"id":13862448,"url":"https://github.com/daQuincy/DeepMusicvStyle","last_synced_at":"2025-07-14T12:30:42.089Z","repository":{"id":125222461,"uuid":"247077861","full_name":"daQuincy/DeepMusicvStyle","owner":"daQuincy","description":"Code repo for ICME 2020 paper \"Style-Conditioned Music Generation\". VAE model that allows style-conditioned music generation.","archived":false,"fork":false,"pushed_at":"2021-08-26T02:18:10.000Z","size":85,"stargazers_count":49,"open_issues_count":1,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-05T06:05:48.716Z","etag":null,"topics":["deep-learning","music-composition","music-generation","vae","variational-autoencoder"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daQuincy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-13T13:29:45.000Z","updated_at":"2024-04-20T16:15:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"73252215-85f9-43e3-b53d-1b37b0cfc154","html_url":"https://github.com/daQuincy/DeepMusicvStyle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daQuincy%2FDeepMusicvStyle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daQuincy%2FDeepMusicvStyle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daQuincy%2FDeepMusicvStyle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daQuincy%2FDeepMusicvStyle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daQuincy","download_url":"https://codeload.github.com/daQuincy/DeepMusicvStyle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225974467,"owners_count":17553958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","music-composition","music-generation","vae","variational-autoencoder"],"created_at":"2024-08-05T06:01:44.547Z","updated_at":"2024-11-22T22:31:09.382Z","avatar_url":"https://github.com/daQuincy.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# When Music Meets A.I.\n[Paper](https://ieeexplore.ieee.org/abstract/document/9302731) | [Music Samples (.mp3)](https://bit.ly/3b5QYKW) | [Supplementary Report](https://drive.google.com/file/d/1gV5LNfdKqRvXVQ3fTstOMq3qWrcmxNyg/view?usp=sharing)\n\n### Official TF implementation of the paper: \"Style-conditioned Music Generation\"\n\n#### IEEE Multimedia Magazine 2021 | ICME 2020 (oral)\n\nReleased on March 18, 2020.\n\n## Description\nThis is a joint work with the Department of Music (University of Malaya). It presents a refinement to the vanilla formulation of Variational Auto-Encoder (VAE) which allow users to condition the compositional style of music generated by the model. In our experiments, we trained our model on Bach chorales (JSB) and western folk tunes (NMD). At generation time, users can specify the model to generate music in the style of Bach or folk tunes. The datasets used in the experiment can be downloaded at [POP](http://www.ambrosepianotabs.com/page/library?pg=1), [JSB](http://kern.humdrum.org/search?s=t\u0026keyword=Bach%20Johann\u0026fbclid=IwAR39fsc8gUWjN6eYAUkewldNkeV499lX0Ew6VP8Nrrd_T1T7plaIIIb5nFQ) and [NMD](http://www-etud.iro.umontreal.ca/~boulanni/icml2012).\n\nCurious how music generated by our model sound? Feel free to visit [Generated Music Samples](https://bit.ly/3b5QYKW) and leave your feedbacks. \n\n## Dependencies\n- Python 3.6.8\n- tensorflow(gpu) 1.15.0\n- tensorflow-probability 0.8.0\n- pretty-midi 0.2.8  \n\nTested on Ubuntu 16.04.\n\n## Running the code\n### Setup\nCheck _dataset.py_ in the dataset folder and put in the correct folder path for the MIDI files. Change the train/test split ratio as you desire. The output should be train/test pickle files for each style, i.e. with 2 styles, you should have 4 pickle files, train/test for style 1 and train/test for style 2.\n\n### Training\nCheck _train.sh_ to tune the hyperparameters. For hyperparameters not in _train.sh_, please look into _model.py_. Those hyperparameters that are not in _train.sh_ are found to be have little impact on model's learning.\n\nDescription for hyperparameters (and values used in the paper) and options in _train.sh_:\n```\nsave_path=vae_model                       # model save path\ntrain_set=\"jsb_train.pkl nmd_train.pkl\"   # training dataset path, separate style with space\ntest_set=\"jsb_test.pkl nmd_test.pkl\"      # testing dataset path, make sure style sequence is same as above\nepoch=400                                 # training epoch\nenc_rnn=hyperlstm                         # encoder RNN: lstm, hyperlstm\nenc_rnn_dim=512                           # encoder RNN dimension\nenc_rnn_layer=1                           # number of encoder RNN layers\nenc_hyper_unit=256                        # number of hyper units if hyperlstm is chosen\nenc_dropout=0.5                           # encoder RNN dropout rate\ndec_rnn=hyperlstm                         # decoder RNN: lstm, hyperlstm\ndec_rnn_dim=512                           # decoder RNN dimension\ndec_hyper_unit=256                        # number of hyper units if hyperlstm is chosen\ndec_dropout=0.2                           # decoder RNN dropout rate\ndec_rnn_layer=1                           # number of decoder RNN layers\nattention=0                               # dimension for attention units for decoder self-attention (0: disable)\ncont_dim=120                              # latent space size for z_c \ncat_dim=2                                 # number of styles (categorical dimension)\ngumbel=0.02                               # Gumbel softmax temperature\nstyle_embed_dim=80                        # dimension for each style embeddings in z_s\nmu_force=1.3                              # beta in [mu_forcing](https://arxiv.org/abs/1905.10072)\nbatch_size=64                             # batch size\n```\n\n### Generating music\nRun _generate.sh_ to generate music. Options are described as follows.\n```\nckpt_path=vae_model/vae-epoch250          # path to saved model checkpoint\noutput_save_path=jsb_samples              # folder directory to save generated music\nn_generations=20                          # number of music samples to generate\nstyle=0                                   # style of music to generate, number corresponds to train_set style sequence in train.sh\noutput_type=all                           # output file type. midi=MIDI file, wav=WAV file, all=both\ntemperature=0.2                           # lower temperature gives more confident output\ncont_dim=120                              # latent space size for z_c \ncat_dim=2                                 # number of styles (categorical dimension)\n```\n\n## Feedback \nSuggestions and opinions of any sort are welcomed. Please contact the authors by sending emails to `yuquan95 at gmail.com` or `cs.chan at um.edu.my` or `loofy at um.edu.my`\n\n## License and Copyright\nThis project is open source under the BSD-3 license (see [`LICENSE`](./LICENSE)). Codes can be used freely only for academic purpose.\n\nFor commercial purpose usage, please contact Dr. Chee Seng Chan at `cs.chan at um.edu.my`\n\n\u0026#169;2020 Center of Image and Signal Processing, Faculty of Computer Science and Information Technology, University of Malaya.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FdaQuincy%2FDeepMusicvStyle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FdaQuincy%2FDeepMusicvStyle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FdaQuincy%2FDeepMusicvStyle/lists"}