rsy1026 / sketching_piano_expression

This repository is for an implementation of the accepted paper "Sketching the Expression: Flexible Rendering of Expressive Piano Performance with Self-Supervised Learning"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sketching the Expression: Flexible Rendering of Expressive Piano Performance with Self-Supervised Learning

Installation

Clone this repository, and install the required packages:

git clone https://github.com/rsy1026/sketching_piano_expression.git
pip install -r requirements.txt

Then run this command to make sketching_piano_expression a python package for importing inner functions easily:

pip install -e .

Parsing features for training

We should align three files to parse the features: score MusicXML, score MIDI and human performance MIDI. Raw data samples can be found in ./scripts/data/data_samples/raw_samples.

Please make sure that MusicXML data has no error:

  • Please check if any notes are hidden by some annotations (such as trills, glissandos, etc.) in the MusicXML score (You may check with the MuseScore software).
  • Trills should not be abbreviated as "tr." signs but all notes should appear within each trill.
  • Make sure that any complex techniques are not abbreviated as annotations but every single note should be written in the MusicXML score.
  • Functions to extract the features may be updated in the future for imperfectly aligned MusicXML-MIDI files. These functions may flexibly skip the unaligned notes.

Parsing a single set of file

python3 extract_features.py --xml [filename1].musicxml --score [filename2].mid --perform [filename3].mid --measures [num1] [num2]

Saving batches

Enter to 'scripts' directory, and run the following command:

python3 ./data/make_batches.py --input_dir ./data/data_samples/features

You can make h5 files using the following function in make_batches.py:

create_h5_datasets(dataset='train', savepath='./data/data_samples')

Training

Simply run the following command:

python3 train.py

You may change any settings within the code.

About

This repository is for an implementation of the accepted paper "Sketching the Expression: Flexible Rendering of Expressive Piano Performance with Self-Supervised Learning"


Languages

Language:Python 52.1%Language:C++ 47.6%Language:Shell 0.2%