Skip to content

nikolasborrel/dlmusic

Repository files navigation

dlmusic

Exploring the use of Deep Generative Models for live musical performance

How to run

Run run_lstm to train the LSTM and serialized the learned weights.

Run generate_lstm.py for generating a bass lines conditioned on an input melody loading the serialized network weights from running the script run_lstm.

Data should be pre-processed running the script create_subset_form_lakh.py. See also Section "Pre-process data".

Pre-process data

[see also chapter 6 in the book "Music generation with Magenta"]

Dependencies:

> pip install visual_midi
> pip install tables

For serializing data (not necessary at the moment)

> pip install magenta

Function for pre-processing data is found inside the directory data_prep/

The following LMD dataset is used

  • LMD-matched
  • LMD-matched metadata
  • Match scores

To get statistics:

Artist

python data_prep/01_artists_stats.py --sample_size=500 --path_dataset_dir="../midi_data/lmd_matched" --path_match_score="../midi_data/lmd_matched/match_scores.json"

Genre

python data_prep/02_genres_stats.py --sample_size=500 --path_dataset_dir="../midi_data/lmd_matched" --path_match_score="../midi_data/lmd_matched/match_scores.json" --last_fm_api_key="api_key"

Instrument

python data_prep/04_instrument_stats.py --sample_size=500 --path_dataset_dir="../midi_data/lmd_matched" --path_match_score="../midi_data/lmd_matched/match_scores.json"

Extract parts as midi, e,g. piano for jazz and blues genre, to output directory path_output_dir:

python data_prep/08_channel_extract_piano_tag.py --sample_size=500 --path_dataset_dir="../midi_data/lmd_matched" --path_match_score="../midi_data/lmd_matched/match_scores.json" --path_output_dir="../midi_data_out/piano_filtered" --last_fm_api_key="api_key" --tags="['jazz', 'blues']"

It is also possible to to write the extracted midi data as serialized NoteSequence data as Tensorflow -tf file for efficient storage and loading (can stil be used in e.g. pyTorch after loading - but let's wait with this and use our current loader)

convert_dir_to_note_sequences --input_dir="../midi_data_out/piano_filtered" --output_file="../midi_data_out/piano_filtered/notesequences.tfrecord" 

About

Exploring the use of Deep Generative Models for live musical performance

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages