Skip to content

cifkao/groove2groove

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Groove2Groove

This is the source code for the IEEE TASLP paper:

Ondřej Cífka, Umut Şimşekli and Gaël Richard. "Groove2Groove: One-Shot Music Style Transfer with Supervision from Synthetic Data." IEEE/ACM Transactions on Audio, Speech, and Language Processing, 28:2638–2650, 2020. doi: 10.1109/TASLP.2020.3019642.

If you use the code in your research, please reference the paper.

Links

🔬 Paper postprint [pdf]
🎹 Supplementary website with examples and a live demo
🎵 Examples on YouTube
📁 MIDI file dataset, containing almost 3000 different styles
🤖 Band-in-a-Box automation scripts for generating the dataset
🧠 Model parameters (to be extracted into experiments)

Looking around

  • code: the main codebase (a Python package called groove2groove)
  • data: scripts needed to prepare the datasets
  • experiments: experiment configuration files
  • experiments/eval: evaluation code (see the eval.ipynb notebook)
  • api: an API server for the web demo

Installation

Clone the repository, then run the following commands.

  1. Install the dependencies using one of the following options:

    • Create a new environment using conda:

      conda env create -f environment.yml

      This will also install the correct versions of Python and the CUDA and CuDNN libraries.

    • Using pip (a virtual environment is recommended):

      pip install -r requirements.txt

      You will need Python 3.6 because we use a version of TensorFlow which is not available from PyPI for more recent Python versions.

    The code has been tested with TensorFlow 1.12, CUDA 9.0 and CuDNN 7.6.0. Other versions of TensorFlow (1.x) may work too.

  2. Install the package with:

    pip install './code[gpu]'

Usage

The main entry point of the package is the groove2groove.models.roll2seq_style_transfer module, which takes care of training and running the model. Run python -m groove2groove.models.roll2seq_style_transfer -h to see the available command line arguments.

The train command runs the training:

python -m groove2groove.models.roll2seq_style_transfer --logdir $LOGDIR train

Replace $LOGDIR with the model directory, containing the model.yaml configuration file (e.g. one of the directories under experiments).

To run a trained model on a single pair of MIDI files, use the run-midi command, e.g.:

python -m groove2groove.models.roll2seq_style_transfer --logdir $LOGDIR run-midi \
    --sample --softmax-temperature 0.6 \
    content.mid style.mid output.mid

To run it on a whole pre-processed dataset (e.g. the one in data/bodhidharma), use the run-test command, e.g.:

python -m groove2groove.models.roll2seq_style_transfer --logdir $LOGDIR run-test \
    --sample --softmax-temperature 0.6 --batch-size 128 \
    content.db style.db keypairs.tsv output.db 

Here, keypairs.tsv lists on each line a key from content.db and a key from style.db to use as inputs. Note that content.db and style.db may be the same file.

Acknowledgment

This work has received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No. 765068.

Copyright notice

Copyright 2019–2020 Ondřej Cífka of Télécom Paris, Institut Polytechnique de Paris.
All rights reserved.