Python tools for using MedleyDB.
Created by Rachel Bittner rachel (dot) bittner (at) nyu (dot) edu and Justin Salamon justin (dot) salamon (at) nyu (dot) edu.
This code is released along with MedleyDB:
http://medleydb.weebly.com (or http://marl.smusic.nyu.edu/medleydb)
This code is a component of the work presented in the following publication:
R. Bittner, J. Salamon, M. Tierney, M. Mauch, C. Cannam and J. P. Bello, "MedleyDB: A Multitrack Dataset for Annotation-Intensive MIR Research", in 15th International Society for Music Information Retrieval Conference, Taipei, Taiwan, Oct. 2014.
First clone this repository:
git clone https://github.com/rabitt/medleydb.git
Next, set the environment variable MEDLEYDB_PATH to the local path where the MedleyDB directory (or MedleyDB_sample) lives:
export MEDLEYDB_PATH="path/to/your/copy/of/MedleyDB"
To avoid doing this step every time, copy the line above to .bash_profile
or .bash_rc
.
If you use pip and homebrew, you can install them by doing:
[sudo] pip install pyyaml
brew install sox
To load the module:
import medleydb as mdb
Load the dataset to a list of MultiTrack objects:
mtrack_list = mdb.load_all_multitracks()
Some attributes of a multitrack:
multitrack_1 = next(mtrack_list)
multitrack_2 = next(mtrack_list)
multitrack_1.has_bleed
multitrack_2.has_bleed
multitrack_1.artist
multitrack_2.artist
multitrack_1.is_instrumental
multitrack_2.is_instrumental
multitrack_1.melody1_annotation
Some attributes of a particular stem:
example_stem = multitrack_1.stems[0]
example_stem.instrument
example_stem.pitch_annotation
A subset of the dataset can be loaded by passing a list of track folder paths:
import glob
import os
import medleydb as mdb
example_list = glob.glob(os.path.join(mdb.AUDIO_DIR, 'ClaraBerry_*'))
dataset_subset = mdb.load_multitracks(example_list)
The following code will get a list of paths to stems that are labeled as a clarinet:
import medleydb as mdb
dataset = mdb.load_all_multitracks()
clarinet_files = mdb.get_files_for_instrument('clarinet')
To see a full list of possible instrument labels:
import medleydb as mdb
instruments = mdb.get_valid_instrument_labels()
print instruments