musegan

An AI for Music Generation

https://github.com/salu133445/musegan

Science Score: 64.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
    2 of 12 committers (16.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.4%) to scientific vocabulary

Keywords

gan generative-adversarial-network machine-learning music music-generation tensorflow

Keywords from Contributors

music-information-retrieval midi interactive visulization mesh interpretability profiles sequences generic projection
Last synced: 6 months ago · JSON representation ·

Repository

An AI for Music Generation

Basic Info
Statistics
  • Stars: 1,966
  • Watchers: 49
  • Forks: 393
  • Open Issues: 21
  • Releases: 0
Topics
gan generative-adversarial-network machine-learning music music-generation tensorflow
Created over 8 years ago · Last pushed over 1 year ago
Metadata Files
Readme Funding License Citation

README.md

MuseGAN

MuseGAN is a project on music generation. In a nutshell, we aim to generate polyphonic music of multiple tracks (instruments). The proposed models are able to generate music either from scratch, or by accompanying a track given a priori by the user.

We train the model with training data collected from Lakh Pianoroll Dataset to generate pop song phrases consisting of bass, drums, guitar, piano and strings tracks.

Sample results are available here.

Important Notes

  • The latest implementation is based on the network architectures presented in BinaryMuseGAN, where the temporal structure is handled by 3D convolutional layers. The advantage of this design is its smaller network size, while the disadvantage is its reduced controllability, e.g., capability of feeding different latent variables for different measures or tracks.
  • The original code we used for running the experiments in the paper can be found in the v1 folder.
  • Looking for a PyTorch version? Check out this repository.

Prerequisites

Below we assume the working directory is the repository root.

Install dependencies

  • Using pipenv (recommended)

Make sure pipenv is installed. (If not, simply run pip install pipenv.)

sh # Install the dependencies pipenv install # Activate the virtual environment pipenv shell

  • Using pip

sh # Install the dependencies pip install -r requirements.txt

Prepare training data

The training data is collected from Lakh Pianoroll Dataset (LPD), a new multitrack pianoroll dataset.

```sh

Download the training data

./scripts/download_data.sh

Store the training data to shared memory

./scripts/process_data.sh ```

You can also download the training data manually (trainxlpd5phr.npz).

As pianoroll matrices are generally sparse, we store only the indices of nonzero elements and the array shape into a npz file to save space, and later restore the original array. To save some training data data into this format, simply run np.savez_compressed("data.npz", shape=data.shape, nonzero=data.nonzero())

Scripts

We provide several shell scripts for easy managing the experiments. (See here for a detailed documentation.)

Below we assume the working directory is the repository root.

Train a new model

  1. Run the following command to set up a new experiment with default settings.

sh # Set up a new experiment ./scripts/setup_exp.sh "./exp/my_experiment/" "Some notes on my experiment"

  1. Modify the configuration and model parameter files for experimental settings.

  2. You can either train the model:

    sh # Train the model ./scripts/run_train.sh "./exp/my_experiment/" "0"

or run the experiment (training + inference + interpolation):

 ```sh
 # Run the experiment
 ./scripts/run_exp.sh "./exp/my_experiment/" "0"
 ```

Collect training data

Run the following command to collect training data from MIDI files.

sh # Collect training data ./scripts/collect_data.sh "./midi_dir/" "data/train.npy"

Use pretrained models

  1. Download pretrained models

sh # Download the pretrained models ./scripts/download_models.sh

You can also download the pretrained models manually (pretrained_models.tar.gz).

  1. You can either perform inference from a trained model:

sh # Run inference from a pretrained model ./scripts/run_inference.sh "./exp/default/" "0"

or perform interpolation from a trained model:

sh # Run interpolation from a pretrained model ./scripts/run_interpolation.sh "./exp/default/" "0"

Outputs

By default, samples will be generated alongside the training. You can disable this behavior by setting save_samples_steps to zero in the configuration file (config.yaml). The generated will be stored in the following three formats by default.

  • .npy: raw numpy arrays
  • .png: image files
  • .npz: multitrack pianoroll files that can be loaded by the Pypianoroll package

You can disable saving in a specific format by setting save_array_samples, save_image_samples and save_pianoroll_samples to False in the configuration file.

The generated pianorolls are stored in .npz format to save space and processing time. You can use the following code to write them into MIDI files.

```python from pypianoroll import Multitrack

m = Multitrack('./test.npz') m.write('./test.mid') ```

Sample Results

Some sample results can be found in ./exp/ directory. More samples can be downloaded from the following links.

Citing

Please cite the following paper if you use the code provided in this repository.

Hao-Wen Dong*, Wen-Yi Hsiao*, Li-Chia Yang and Yi-Hsuan Yang, "MuseGAN: Multi-track Sequential Generative Adversarial Networks for Symbolic Music Generation and Accompaniment," AAAI Conference on Artificial Intelligence (AAAI), 2018. (*equal contribution)
[homepage] [arXiv] [paper] [slides] [code]

Papers

MuseGAN: Multi-track Sequential Generative Adversarial Networks for Symbolic Music Generation and Accompaniment
Hao-Wen Dong*, Wen-Yi Hsiao*, Li-Chia Yang and Yi-Hsuan Yang (*equal contribution)
AAAI Conference on Artificial Intelligence (AAAI), 2018.
[homepage] [arXiv] [paper] [slides] [code]

Convolutional Generative Adversarial Networks with Binary Neurons for Polyphonic Music Generation
Hao-Wen Dong and Yi-Hsuan Yang
International Society for Music Information Retrieval Conference (ISMIR), 2018.
[homepage] [video] [paper] [slides] [slides (long)] [poster] [arXiv] [code]

MuseGAN: Demonstration of a Convolutional GAN Based Model for Generating Multi-track Piano-rolls
Hao-Wen Dong*, Wen-Yi Hsiao*, Li-Chia Yang and Yi-Hsuan Yang (*equal contribution)
ISMIR Late-Breaking Demos, 2017.
[paper] [poster]

Owner

  • Name: Hao-Wen (Herman) Dong 董皓文
  • Login: salu133445
  • Kind: user
  • Location: USA/Taiwan
  • Company: UC San Diego

Assistant Professor at University of Michigan | PhD from UC San Diego | Human-Centered Generative AI for Content Generation

Citation (CITATION.cff)

cff-version: 1.2.0
message: If you use this software, please cite it using these metadata.
authors:
  - family-names: Dong
    given-names: Hao-Wen
title: MuseGAN
preferred-citation:
  type: article
  authors:
    - family-names: Dong
      given-names: Hao-Wen
    - family-names: Hsiao
      given-names: Wen-Yi
    - family-names: Yang
      given-names: Li-Chia
    - family-names: Yang
      given-names: Yi-Hsuan
  title: "MuseGAN: Multi-track Sequential Generative Adversarial Networks for Symbolic Music Generation and Accompaniment"
  journal: Proceedings of the 32nd AAAI Conference on Artificial Intelligence (AAAI)
  year: 2018
date-released: 2017-11-09
license: MIT
url: "https://salu133445.github.io/musegan/"
repository-code: "https://github.com/salu133445/musegan"

GitHub Events

Total
  • Issues event: 1
  • Watch event: 145
  • Fork event: 22
Last Year
  • Issues event: 1
  • Watch event: 145
  • Fork event: 22

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 388
  • Total Committers: 12
  • Avg Commits per committer: 32.333
  • Development Distribution Score (DDS): 0.459
Past Year
  • Commits: 4
  • Committers: 1
  • Avg Commits per committer: 4.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
salu133445 s****5@g****m 210
salu133445 b****0@n****w 102
Hao-Wen Dong s****5@c****w 30
蕭文逸 s****9@g****m 26
George Ogden G****n@o****m 8
Nicholas Chiang n****g@g****m 5
dependabot[bot] 4****] 2
mohammad r****i@g****m 1
Vishwanath Seshagiri v****h@o****m 1
Trent Torkar 3****r 1
Taihsiang Ho (tai271828) t****8@g****m 1
Fábio Junqueira f****8@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 92
  • Total pull requests: 9
  • Average time to close issues: 29 days
  • Average time to close pull requests: 6 days
  • Total issue authors: 51
  • Total pull request authors: 7
  • Average comments per issue: 2.58
  • Average comments per pull request: 0.67
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • guanfaqian (10)
  • VladJamir (6)
  • blues-green (4)
  • Maokui-He (4)
  • iris03 (4)
  • zyoohv (3)
  • aaronrmm (3)
  • zzdang (3)
  • nicholaschiang (3)
  • MehakManiktala (3)
  • techcentaur (3)
  • fnyhy (2)
  • dianyo (2)
  • yang19941128 (2)
  • gxd1994 (2)
Pull Request Authors
  • nicholaschiang (2)
  • dependabot[bot] (2)
  • tai271828 (1)
  • vishwanath1306 (1)
  • fjunqueira (1)
  • ttorkar (1)
  • Razzaghnoori (1)
Top Labels
Issue Labels
question (14) duplicate (2) dependencies (1) bug (1)
Pull Request Labels
dependencies (2)

Dependencies

Pipfile pypi
  • black * develop
  • flake8 * develop
  • flake8-bugbear * develop
  • flake8-docstrings * develop
  • pylint * develop
  • Markdown ==2.6.11
  • Pillow ==6.2.0
  • PyYAML ==3.13
  • SharedArray ==3.0.0
  • Werkzeug ==0.15.3
  • absl-py ==0.4.1
  • astor ==0.7.1
  • gast ==0.2.0
  • grpcio ==1.14.2
  • imageio ==2.3.0
  • mido ==1.2.8
  • numpy ==1.14.5
  • pretty_midi ==0.2.8
  • protobuf ==3.6.1
  • pypianoroll ==0.4.6
  • scipy ==1.1.0
  • six ==1.11.0
  • tensorboard ==1.10.0
  • tensorflow-gpu ==1.10.1
  • termcolor ==1.1.0
requirements.txt pypi
  • Markdown ==2.6.11
  • Pillow ==5.2.0
  • PyYAML ==3.13
  • SharedArray ==3.0.0
  • Werkzeug ==0.14.1
  • absl-py ==0.4.1
  • astor ==0.7.1
  • gast ==0.2.0
  • grpcio ==1.14.2
  • imageio ==2.3.0
  • mido ==1.2.8
  • numpy ==1.14.5
  • pretty-midi ==0.2.8
  • protobuf ==3.6.1
  • pypianoroll ==0.4.6
  • scipy ==1.1.0
  • setuptools ==39.1.0
  • six ==1.11.0
  • tensorboard ==1.10.0
  • tensorflow-gpu ==1.10.1
  • termcolor ==1.1.0