Initializing

mirdata.initialize(dataset_name, data_home=None, version='default')[source]

Load a mirdata dataset by name

Example

orchset = mirdata.initialize('orchset')  # get the orchset dataset
orchset.download()  # download orchset
orchset.validate()  # validate orchset
track = orchset.choice_track()  # load a random track
print(track)  # see what data a track contains
orchset.track_ids()  # load all track ids
Parameters
  • dataset_name (str) – the dataset’s name see mirdata.DATASETS for a complete list of possibilities

  • data_home (str or None) – path where the data lives. If None uses the default location.

  • version (str or None) – which version of the dataset to load. If None, the default version is loaded.

Returns

Dataset – a mirdata.core.Dataset object

mirdata.list_datasets()[source]

Get a list of all mirdata dataset names

Returns

list – list of dataset names as strings

Dataset Loaders

acousticbrainz_genre

Acoustic Brainz Genre dataset

class mirdata.datasets.acousticbrainz_genre.Dataset(data_home=None, version='default')[source]

The acousticbrainz genre dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

filter_index(search_key)[source]

Load from AcousticBrainz genre dataset the indexes that match with search_key.

Parameters

search_key (str) – regex to match with folds, mbid or genres

Returns

dict – {track_id: track data}

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_all_train()[source]

Load from AcousticBrainz genre dataset the tracks that are used for training across the four different datasets.

Returns

dict – {track_id: track data}

load_all_validation()[source]

Load from AcousticBrainz genre dataset the tracks that are used for validating across the four different datasets.

Returns

dict – {track_id: track data}

load_allmusic_train()[source]

Load from AcousticBrainz genre dataset the tracks that are used for validation in allmusic dataset.

Returns

dict – {track_id: track data}

load_allmusic_validation()[source]

Load from AcousticBrainz genre dataset the tracks that are used for validation in allmusic dataset.

Returns

dict – {track_id: track data}

load_discogs_train()[source]

Load from AcousticBrainz genre dataset the tracks that are used for training in discogs dataset.

Returns

dict – {track_id: track data}

load_discogs_validation()[source]

Load from AcousticBrainz genre dataset the tracks that are used for validation in tagtraum dataset.

Returns

dict – {track_id: track data}

load_extractor(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.acousticbrainz_genre.load_extractor

load_lastfm_train()[source]

Load from AcousticBrainz genre dataset the tracks that are used for training in lastfm dataset.

Returns

dict – {track_id: track data}

load_lastfm_validation()[source]

Load from AcousticBrainz genre dataset the tracks that are used for validation in lastfm dataset.

Returns

dict – {track_id: track data}

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tagtraum_train()[source]

Load from AcousticBrainz genre dataset the tracks that are used for training in tagtraum dataset.

Returns

dict – {track_id: track data}

load_tagtraum_validation()[source]

Load from AcousticBrainz genre dataset the tracks that are used for validating in tagtraum dataset.

Returns

dict – {track_id: track data}

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.acousticbrainz_genre.Track(track_id, data_home, dataset_name, index, metadata)[source]

AcousticBrainz Genre Dataset track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. If None, looks for the data in the default directory, ~/mir_datasets

Variables
  • track_id (str) – track id

  • genre (list) – human-labeled genre and subgenres list

  • mbid (str) – musicbrainz id

  • mbid_group (str) – musicbrainz id group

  • artist (list) – the track’s artist/s

  • title (list) – the track’s title

  • date (list) – the track’s release date/s

  • filename (str) – the track’s filename

  • album (list) – the track’s album/s

  • track_number (list) – the track number/s

  • tonal (dict) – dictionary of acousticbrainz tonal features

  • low_level (dict) – dictionary of acousticbrainz low-level features

  • rhythm (dict) – dictionary of acousticbrainz rhythm features

Other Parameters

acousticbrainz_metadata (dict) – dictionary of metadata provided by AcousticBrainz

property album

metadata album annotation

Returns

list – album

property artist

metadata artist annotation

Returns

list – artist

property date

metadata date annotation

Returns

list – date

property file_name

metadata file_name annotation

Returns

str – file name

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

property low_level

low_level track descriptors.

Returns

dict

  • ‘average_loudness’: dynamic range descriptor. It rescales average loudness, computed on 2sec windows with 1 sec overlap, into the [0,1] interval. The value of 0 corresponds to signals with large dynamic range, 1 corresponds to signal with little dynamic range. Algorithms: Loudness

  • ’dynamic_complexity’: dynamic complexity computed on 2sec windows with 1sec overlap. Algorithms: DynamicComplexity

  • ’silence_rate_20dB’, ‘silence_rate_30dB’, ‘silence_rate_60dB’: rate of silent frames in a signal for thresholds of 20, 30, and 60 dBs. Algorithms: SilenceRate

  • ’spectral_rms’: spectral RMS. Algorithms: RMS

  • ’spectral_flux’: spectral flux of a signal computed using L2-norm. Algorithms: Flux

  • ’spectral_centroid’, ‘spectral_kurtosis’, ‘spectral_spread’, ‘spectral_skewness’: centroid and central moments statistics describing the spectral shape. Algorithms: Centroid, CentralMoments

  • ’spectral_rolloff’: the roll-off frequency of a spectrum. Algorithms: RollOff

  • ’spectral_decrease’: spectral decrease. Algorithms: Decrease

  • ’hfc’: high frequency content descriptor as proposed by Masri. Algorithms: HFC

  • ’zerocrossingrate’ zero-crossing rate. Algorithms: ZeroCrossingRate

  • ’spectral_energy’: spectral energy. Algorithms: Energy

  • ’spectral_energyband_low’, ‘spectral_energyband_middle_low’, ‘spectral_energyband_middle_high’,

  • ’spectral_energyband_high’: spectral energy in frequency bands [20Hz, 150Hz], [150Hz, 800Hz], [800Hz, 4kHz], and [4kHz, 20kHz]. Algorithms EnergyBand

  • ’barkbands’: spectral energy in 27 Bark bands. Algorithms: BarkBands

  • ’melbands’: spectral energy in 40 mel bands. Algorithms: MFCC

  • ’erbbands’: spectral energy in 40 ERB bands. Algorithms: ERBBands

  • ’mfcc’: the first 13 mel frequency cepstrum coefficients. See algorithm: MFCC

  • ’gfcc’: the first 13 gammatone feature cepstrum coefficients. Algorithms: GFCC

  • ’barkbands_crest’, ‘barkbands_flatness_db’: crest and flatness computed over energies in Bark bands. Algorithms: Crest, FlatnessDB

  • ’barkbands_kurtosis’, ‘barkbands_skewness’, ‘barkbands_spread’: central moments statistics over energies in Bark bands. Algorithms: CentralMoments

  • ’melbands_crest’, ‘melbands_flatness_db’: crest and flatness computed over energies in mel bands. Algorithms: Crest, FlatnessDB

  • ’melbands_kurtosis’, ‘melbands_skewness’, ‘melbands_spread’: central moments statistics over energies in mel bands. Algorithms: CentralMoments

  • ’erbbands_crest’, ‘erbbands_flatness_db’: crest and flatness computed over energies in ERB bands. Algorithms: Crest, FlatnessDB

  • ’erbbands_kurtosis’, ‘erbbands_skewness’, ‘erbbands_spread’: central moments statistics over energies in ERB bands. Algorithms: CentralMoments

  • ’dissonance’: sensory dissonance of a spectrum. Algorithms: Dissonance

  • ’spectral_entropy’: Shannon entropy of a spectrum. Algorithms: Entropy

  • ’pitch_salience’: pitch salience of a spectrum. Algorithms: PitchSalience

  • ’spectral_complexity’: spectral complexity. Algorithms: SpectralComplexity

  • ’spectral_contrast_coeffs’, ‘spectral_contrast_valleys’: spectral contrast features. Algorithms: SpectralContrast

property rhythm

rhythm essentia extractor descriptors

Returns

dict

  • ‘beats_position’: time positions [sec] of detected beats using beat tracking algorithm by Degara et al., 2012. Algorithms: RhythmExtractor2013, BeatTrackerDegara

  • ’beats_count’: number of detected beats

  • ’bpm’: BPM value according to detected beats

  • ’bpm_histogram_first_peak_bpm’, ‘bpm_histogram_first_peak_spread’, ‘bpm_histogram_first_peak_weight’,

  • ’bpm_histogram_second_peak_bpm’, ‘bpm_histogram_second_peak_spread’, ‘bpm_histogram_second_peak_weight’: descriptors characterizing highest and second highest peak of the BPM histogram. Algorithms: BpmHistogramDescriptors

  • ’beats_loudness’, ‘beats_loudness_band_ratio’: spectral energy computed on beats segments of audio across the whole spectrum, and ratios of energy in 6 frequency bands. Algorithms: BeatsLoudness, SingleBeatLoudness

  • ’onset_rate’: number of detected onsets per second. Algorithms: OnsetRate

  • ’danceability’: danceability estimate. Algorithms: Danceability

property title

metadata title annotation

Returns

list – title

to_jams()[source]

the track’s data in jams format

Returns

jams.JAMS – return track data in jam format

property tonal

tonal features

Returns

dict

  • ‘tuning_frequency’: estimated tuning frequency [Hz]. Algorithms: TuningFrequency

  • ’tuning_nontempered_energy_ratio’ and ‘tuning_equal_tempered_deviation’

  • ’hpcp’, ‘thpcp’: 32-dimensional harmonic pitch class profile (HPCP) and its transposed version. Algorithms: HPCP

  • ’hpcp_entropy’: Shannon entropy of a HPCP vector. Algorithms: Entropy

  • ’key_key’, ‘key_scale’: Global key feature. Algorithms: Key

  • ’chords_key’, ‘chords_scale’: Global key extracted from chords detection.

  • ’chords_strength’, ‘chords_histogram’: : strength of estimated chords and normalized histogram of their progression; Algorithms: ChordsDetection, ChordsDescriptors

  • ’chords_changes_rate’, ‘chords_number_rate’: chords change rate in the progression; ratio of different chords from the total number of chords in the progression; Algorithms: ChordsDetection, ChordsDescriptors

property tracknumber

metadata tracknumber annotation

Returns

list – tracknumber

mirdata.datasets.acousticbrainz_genre.load_extractor(fhandle)[source]

Load a AcousticBrainz Dataset json file with all the features and metadata.

Parameters

fhandle (str or file-like) – path or file-like object pointing to a json file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

baf

BAF Loader

class mirdata.datasets.baf.Dataset(data_home=None, version='default')[source]

The BAF dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.baf.EventDataExtended(intervals, interval_unit, events, event_unit, tags, tag_unit)[source]

EventDataExtended class. Inherits from annotations.EventData class. An event is defined here as a match query-reference, and the time interval in the query. This class adds the possibility to attach tags to each event, useful if there’s a need to differenciate them. In BAF, tags are [single, majority, unanimity].

Variables
  • tags (list) – list of tag labels (as strings)

  • tag_unit (str) – tag units, one of TAG_UNITS

  • intervals (np.ndarray) – (n x 2) array of intervals

  • positive (in the form [start_time, end_time] Times should be) –

  • duration (and intervals should have non-negative) –

  • interval_unit (str) – unit of the time values in intervals. One

  • TIME_UNITS. (of) –

  • interval_unit – interval units, one of TIME_UNITS

  • events (list) – list of event labels (as strings)

  • event_unit (str) – event units, one of EVENT_UNITS

mirdata.datasets.baf.TAG_UNITS = {'open': 'no scrict schema or units'}

Tag units

class mirdata.datasets.baf.Track(track_id, data_home, dataset_name, index, metadata)[source]

BAF track class.

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. If None, looks for the data in the default directory, ~/mir_datasets/baf

Variables

audio_path (str) – audio path

Properties:

audio (Tuple[np.ndarray, float]): audio array country (str): country of emission channel (str): tv channel of the emission datetime (str): datetime of the TV emission in YYYY-MM-DD HH:mm:ssformat matches (list): list of matches for a specific query

Returns

Track – BAF dataset track

property audio: Tuple[numpy.ndarray, float]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.baf.load_audio(fpath: str) Tuple[numpy.ndarray, float][source]

Load a baf audio file.

Parameters

fpath (str) – path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.baf.load_matches(track_metadata: dict) Optional[mirdata.datasets.baf.EventDataExtended][source]

Load the matches corresponding to a query track.

Parameters

track_metadata (dict) – track’s metadata

Returns

Optional[EventDataExtended] – Track’s annotations in EvendDataExtended format

beatles

Beatles Dataset Loader

class mirdata.datasets.beatles.Dataset(data_home=None, version='default')[source]

The beatles dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.beatles.load_audio

load_beats(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.beatles.load_beats

load_chords(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.beatles.load_chords

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_sections(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.beatles.load_sections

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.beatles.Track(track_id, data_home, dataset_name, index, metadata)[source]

Beatles track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – path where the data lives

Variables
  • audio_path (str) – track audio path

  • beats_path (str) – beat annotation path

  • chords_path (str) – chord annotation path

  • keys_path (str) – key annotation path

  • sections_path (str) – sections annotation path

  • title (str) – title of the track

  • track_id (str) – track id

Other Parameters
  • beats (BeatData) – human-labeled beat annotations

  • chords (ChordData) – human-labeled chord annotations

  • key (KeyData) – local key annotations

  • sections (SectionData) – section annotations

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

the track’s data in jams format

Returns

jams.JAMS – return track data in jam format

mirdata.datasets.beatles.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Beatles audio file.

Parameters

fhandle (str or file-like) – path or file-like object pointing to an audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.beatles.load_beats(fhandle: TextIO) mirdata.annotations.BeatData[source]

Load Beatles format beat data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to a beat annotation file

Returns

BeatData – loaded beat data

mirdata.datasets.beatles.load_chords(fhandle: TextIO) mirdata.annotations.ChordData[source]

Load Beatles format chord data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to a chord annotation file

Returns

ChordData – loaded chord data

mirdata.datasets.beatles.load_key(fhandle: TextIO) mirdata.annotations.KeyData[source]

Load Beatles format key data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to a key annotation file

Returns

KeyData – loaded key data

mirdata.datasets.beatles.load_sections(fhandle: TextIO) mirdata.annotations.SectionData[source]

Load Beatles format section data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to a section annotation file

Returns

SectionData – loaded section data

beatport_key

beatport_key Dataset Loader

class mirdata.datasets.beatport_key.Dataset(data_home=None, version='default')[source]

The beatport_key dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False)[source]

Download the dataset

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_artist(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.beatport_key.load_artist

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.beatport_key.load_audio

load_genre(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.beatport_key.load_genre

load_key(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.beatport_key.load_key

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tempo(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.beatport_key.load_tempo

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.beatport_key.Track(track_id, data_home, dataset_name, index, metadata)[source]

beatport_key track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored.

Variables
  • audio_path (str) – track audio path

  • keys_path (str) – key annotation path

  • metadata_path (str) – sections annotation path

  • title (str) – title of the track

  • track_id (str) – track id

Other Parameters
  • key (list) – list of annotated musical keys

  • artists (list) – artists involved in the track

  • genre (dict) – genres and subgenres

  • tempo (int) – tempo in beats per minute

property audio

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.beatport_key.load_artist(fhandle)[source]

Load beatport_key tempo data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to metadata file

Returns

list – list of artists involved in the track.

mirdata.datasets.beatport_key.load_audio(fpath)[source]

Load a beatport_key audio file.

Parameters

fpath (str) – path to an audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.beatport_key.load_genre(fhandle)[source]

Load beatport_key genre data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to metadata file

Returns

dict – with the list with genres [‘genres’] and list with sub-genres [‘sub_genres’]

mirdata.datasets.beatport_key.load_key(fhandle)[source]

Load beatport_key format key data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to a key annotation file

Returns

list – list of annotated keys

mirdata.datasets.beatport_key.load_tempo(fhandle)[source]

Load beatport_key tempo data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to metadata file

Returns

str – tempo in beats per minute

billboard

McGill Billboard Dataset Loader

class mirdata.datasets.billboard.Dataset(data_home=None, version='default')[source]

The McGill Billboard dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.billboard.load_audio

load_chords(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.billboard.load_chords

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_named_sections(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.billboard.load_named_sections

load_sections(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.billboard.load_sections

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.billboard.Track(track_id, data_home, dataset_name, index, metadata)[source]

McGill Billboard Dataset Track class

Parameters

track_id (str) – track id of the track

Variables
  • track_id (str) – the index for the sample entry

  • audio_path (str) – audio path of the track

  • date (chart) – the date of the chart for the entry

  • rank (peak) – the desired rank on that chart

  • rank – the rank of the song actually annotated, which may be up to 2 ranks higher or lower than the target rank

  • title (str) – the title of the song annotated

  • artist (str) – the name of the artist performing the song annotated

  • rank – the highest rank the song annotated ever achieved on the Billboard Hot 100

  • chart (weeks on) – the number of weeks the song annotated spent on the Billboard Hot 100 chart in total

Other Parameters
  • chords_full (ChordData) – HTK-style LAB files for the chord annotations (full)

  • chords_majmin7 (ChordData) – HTK-style LAB files for the chord annotations (majmin7)

  • chords_majmin7inv (ChordData) – HTK-style LAB files for the chord annotations (majmin7inv)

  • chords_majmin (ChordData) – HTK-style LAB files for the chord annotations (majmin)

  • chords_majmininv (ChordData) – HTK-style LAB files for the chord annotations(majmininv)

  • chroma (np.array) – Array containing the non-negative-least-squares chroma vectors

  • tuning (list) – List containing the tuning estimates

  • sections (SectionData) – Letter-annotated section data (A,B,A’)

  • named_sections (SectionData) – Name-annotated section data (intro, verse, chorus)

  • salami_metadata (dict) – Metadata of the Salami LAB file

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

chroma

Non-negative-least-squares (NNLS) chroma vectors from the Chordino Vamp plug-in

Returns

np.ndarray - NNLS chroma vector

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

tuning

Tuning estimates from the Chordino Vamp plug-in

Returns

list - list of of tuning estimates []

mirdata.datasets.billboard.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Billboard audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.billboard.load_chords(fhandle: TextIO)[source]

Load chords from a Salami LAB file.

Parameters

fhandle (str or file-like) – path to audio file

Returns

ChordData – chord data

mirdata.datasets.billboard.load_named_sections(fpath: str)[source]

Load name-annotated sections from a Salami LAB file.

Parameters

fpath (str) – path to sections file

Returns

SectionData – section data

mirdata.datasets.billboard.load_sections(fpath: str)[source]

Load letter-annotated sections from a Salami LAB file.

Parameters

fpath (str) – path to sections file

Returns

SectionData – section data

candombe

Candombe Dataset Loader

class mirdata.datasets.candombe.Dataset(data_home=None, version='default')[source]

The candombe dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.candombe.Track(track_id, data_home, dataset_name, index, metadata)[source]

Candombe Track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – path to audio file

  • beats_path (str) – path to beats file

Other Parameters

beats (BeatData) – beat annotations

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

beats

The track’s beats

Returns

BeatData – loaded beat data

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.candombe.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a candombe audio file.

Parameters

fhandle (str or file-like) – path or file-like object pointing to an audio file

Returns

  • np.ndarray - the audio signal

  • float - The sample rate of the audio file

mirdata.datasets.candombe.load_beats(fhandle: TextIO) mirdata.annotations.BeatData[source]

Load a candombe beats file.

Parameters

fhandle (str or file-like) – path or file-like object pointing to an audio file

Returns

BeatData – loaded beat data

cante100

cante100 Loader

class mirdata.datasets.cante100.Dataset(data_home=None, version='default')[source]

The cante100 dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.cante100.load_audio

load_melody(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.cante100.load_melody

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_notes(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.cante100.load_notes

load_spectrogram(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.cante100.load_spectrogram

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.cante100.Track(track_id, data_home, dataset_name, index, metadata)[source]

cante100 track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. If None, looks for the data in the default directory, ~/mir_datasets/cante100

Variables
  • track_id (str) – track id

  • identifier (str) – musicbrainz id of the track

  • artist (str) – performing artists

  • title (str) – title of the track song

  • release (str) – release where the track can be found

  • duration (str) – duration in seconds of the track

Other Parameters
  • melody (F0Data) – annotated melody

  • notes (NoteData) – annotated notes

property audio: Tuple[numpy.ndarray, float]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

property spectrogram: Optional[numpy.ndarray]

spectrogram of The track’s audio

Returns

np.ndarray – spectrogram

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.cante100.load_audio(fpath: str) Tuple[numpy.ndarray, float][source]

Load a cante100 audio file.

Parameters

fpath (str) – path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.cante100.load_melody(fhandle: TextIO) Optional[mirdata.annotations.F0Data][source]

Load cante100 f0 annotations

Parameters

fhandle (str or file-like) – path or file-like object pointing to melody annotation file

Returns

F0Data – predominant melody

mirdata.datasets.cante100.load_notes(fhandle: TextIO) mirdata.annotations.NoteData[source]

Load note data from the annotation files

Parameters

fhandle (str or file-like) – path or file-like object pointing to a notes annotation file

Returns

NoteData – note annotations

mirdata.datasets.cante100.load_spectrogram(fhandle: TextIO) numpy.ndarray[source]

Load a cante100 dataset spectrogram file.

Parameters

fhandle (str or file-like) – path or file-like object pointing to an audio file

Returns

np.ndarray – spectrogram

cipi

Can I play it? (CIPI) Dataset Loader

class mirdata.datasets.cipi.Dataset(data_home=None, version='default')[source]

The Can I play it? (CIPI) dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.cipi.Track(track_id, data_home, dataset_name, index, metadata)[source]

Can I play it? (CIPI) track class

Parameters

track_id (str) – track id of the track

Variables
  • title (str) – title of the track

  • book (str) – book of the track

  • URI (str) – URI of the track

  • composer (str) – name of the author of the track

  • track_id (str) – track id

  • musicxml_paths (list) – path to musicxml score. If the music piece contains multiple movents the list will contain multiple paths.

  • difficulty_annotation (int) – annotated difficulty

  • fingering_path (tuple) – Path of fingering features from technique dimension computed with ArGNN fingering model. Return of two paths, the right hand and the ones of the left hand. Use torch.load(…) for loading the embeddings.

  • expressiveness_path (str) – Path of expressiveness features from sound dimension computed with virtuosoNet model.Use torch.load(…) for loading the embeddings.

  • notes_path (str) – Path of note features from notation dimension. Use torch.load(…) for loading the embeddings.

Other Parameters

scores (list[music21.stream.Score]) – music21 scores. If the work is splited in several movements the list will contain multiple scores.

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.cipi.load_score(fhandle: str, data_home: str = 'tests/resources/mir_datasets/cipi') music21.stream.Score[source]

Load cipi score in music21 stream

Parameters
  • fhandle (str) – path to MusicXML score

  • data_home (str) – path to cipi dataset

Returns

music21.stream.Score – score in music21 format

compmusic_carnatic_rhythm

CompMusic Carnatic Rhythm Dataset Loader

class mirdata.datasets.compmusic_carnatic_rhythm.Dataset(data_home=None, version='default')[source]

The compmusic_carnatic_rhythm dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.compmusic_carnatic_rhythm.Track(track_id, data_home, dataset_name, index, metadata)[source]

CompMusic Carnatic Music Rhythm class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. default=None If None, looks for the data in the default directory, ~/mir_datasets

Variables
  • audio_path (str) – path to audio file

  • beats_path (srt) – path to beats file

  • meter_path (srt) – path to meter file

Other Parameters
  • beats (BeatData) – beats annotation

  • meter (string) – meter annotation

  • mbid (string) – MusicBrainz ID

  • name (string) – name of the recording in the dataset

  • artist (string) – artists name

  • release (string) – release name

  • lead_instrument_code (string) – code for the load instrument

  • taala (string) – taala annotation

  • raaga (string) – raaga annotation

  • num_of_beats (int) – number of beats in annotation

  • num_of_samas (int) – number of samas in annotation

property audio

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.compmusic_carnatic_rhythm.load_audio(audio_path)[source]

Load an audio file.

Parameters

audio_path (str) – path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.compmusic_carnatic_rhythm.load_beats(fhandle)[source]

Load beats

Parameters

fhandle (str or file-like) – Local path where the beats annotation is stored.

Returns

BeatData – beat annotations

mirdata.datasets.compmusic_carnatic_rhythm.load_meter(fhandle)[source]

Load meter

Parameters

fhandle (str or file-like) – Local path where the meter annotation is stored.

Returns

float – meter annotation

compmusic_hindustani_rhythm

CompMusic Hindustani Rhythm Dataset Loader

class mirdata.datasets.compmusic_hindustani_rhythm.Dataset(data_home=None, version='default')[source]

The compmusic_hindustani_rhythm dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.compmusic_hindustani_rhythm.Track(track_id, data_home, dataset_name, index, metadata)[source]

CompMusic Hindustani Music Rhythm class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. default=None If None, looks for the data in the default directory, ~/mir_datasets

Variables
  • audio_path (str) – path to audio file

  • beats_path (srt) – path to beats file

  • meter_path (srt) – path to meter file

Other Parameters
  • beats (BeatData) – beats annotation

  • meter (string) – meter annotation

  • mbid (string) – MusicBrainz ID

  • name (string) – name of the recording in the dataset

  • artist (string) – artists name

  • release (string) – release name

  • lead_instrument_code (string) – code for the load instrument

  • taala (string) – taala annotation

  • raaga (string) – raaga annotation

  • laya (string) – laya annotation

  • num_of_beats (int) – number of beats in annotation

  • num_of_samas (int) – number of samas in annotation

  • median_matra_period (float) – median matra per period

  • median_matras_per_min (float) – median matras per minute

  • median_ISI (float) – median ISI

  • median_avarts_per_min (float) – median avarts per minute

property audio

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.compmusic_hindustani_rhythm.load_audio(audio_path)[source]

Load an audio file.

Parameters

audio_path (str) – path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.compmusic_hindustani_rhythm.load_beats(fhandle)[source]

Load beats

Parameters

fhandle (str or file-like) – Local path where the beats annotation is stored.

Returns

BeatData – beat annotations

mirdata.datasets.compmusic_hindustani_rhythm.load_meter(fhandle)[source]

Load meter

Parameters

fhandle (str or file-like) – Local path where the meter annotation is stored.

Returns

float – meter annotation

compmusic_indian_tonic

Indian Art Music Tonic Loader

class mirdata.datasets.compmusic_indian_tonic.Dataset(data_home=None, version='default')[source]

The compmusic_indian_tonic dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.compmusic_indian_tonic.Track(track_id, data_home, dataset_name, index, metadata)[source]

CompMusic Tonic Dataset track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored.

Variables
  • track_id (str) – track id

  • audio_path (str) – audio path

Other Parameters
  • tonic (float) – tonic annotation

  • artist (str) – performing artist

  • gender (str) – gender of the recording artists

  • mbid (str) – MusicBrainz ID of the piece (if available)

  • type (str) – type of piece (vocal, instrumental, etc.)

  • tradition (str) – tradition of the piece (Carnatic or Hindustani)

property audio

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.compmusic_indian_tonic.load_audio(audio_path)[source]

Load a Indian Art Music Tonic audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

compmusic_jingju_acappella

Jingju A Cappella Singing Dataset Loader

class mirdata.datasets.compmusic_jingju_acappella.Dataset(data_home=None, version='default')[source]

The compmusic_jingju_acappella dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_phonemes(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.jingju_acapella.load_phonemes

load_phrases(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.jingju_acapella.load_phrases

load_syllable(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.jingju_acapella.load_syllable

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.compmusic_jingju_acappella.Track(track_id, data_home, dataset_name, index, metadata)[source]

Jingju A Cappella Singing Track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. default=None If None, looks for the data in the default directory, ~/mir_datasets

Variables
  • audio_path (str) – local path where the audio is stored

  • phoneme_path (str) – local path where the phoneme annotation is stored

  • phrase_char_path (str) – local path where the lyric phrase annotation in chinese is stored

  • phrase_path (str) – local path where the lyric phrase annotation in western characters is stored

  • syllable_path (str) – local path where the syllable annotation is stored

  • work (str) – string referring to the work where the track belongs

  • details (float) – string referring to additional details about the track

Other Parameters
  • phoneme (EventData) – phoneme annotation

  • phrase_char (LyricsData) – lyric phrase annotation in chinese

  • phrase (LyricsData) – lyric phrase annotation in western characters

  • syllable (EventData) – syllable annotation

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.compmusic_jingju_acappella.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load Jingju A Cappella Singing audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.compmusic_jingju_acappella.load_phonemes(fhandle: TextIO) mirdata.annotations.LyricData[source]

Load phonemes

Parameters

fhandle (str or file-like) – path or file-like object pointing to a phoneme annotation file

Returns

LyricData – phoneme annotation

mirdata.datasets.compmusic_jingju_acappella.load_phrases(fhandle: TextIO) mirdata.annotations.LyricData[source]

Load lyric phrases annotation

Parameters

fhandle (str or file-like) – path or file-like object pointing to a lyric annotation file

Returns

LyricData – lyric phrase annotation

mirdata.datasets.compmusic_jingju_acappella.load_syllable(fhandle: TextIO) mirdata.annotations.LyricData[source]

Load syllable

Parameters

fhandle (str or file-like) – path or file-like object pointing to a syllable annotation file

Returns

LyricData – syllable annotation

compmusic_otmm_makam

OTMM Makam Recognition Dataset Loader

class mirdata.datasets.compmusic_otmm_makam.Dataset(data_home=None, version='default')[source]

The compmusic_otmm_makam dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_mb_tags(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.compmusic_otmm_makam.load_mb_tags

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_pitch(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.compmusic_otmm_makam.load_pitch

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.compmusic_otmm_makam.Track(track_id, data_home, dataset_name, index, metadata)[source]

OTMM Makam Track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. default=None If None, looks for the data in the default directory, ~/mir_datasets

Variables
  • pitch_path (str) – local path where the pitch annotation is stored

  • mb_tags_path (str) – local path where the MusicBrainz tags annotation is stored

  • makam (str) – string referring to the makam represented in the track

  • tonic (float) – tonic annotation

  • mbid (str) – MusicBrainz ID of the track

Other Parameters
  • pitch (F0Data) – pitch annotation

  • mb_tags (dict) – dictionary containing the raw editorial track metadata from MusicBrainz

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.compmusic_otmm_makam.load_mb_tags(fhandle: TextIO) dict[source]

Load track metadata

Parameters

fhandle (str or file-like) – path or file-like object pointing to musicbrainz metadata file

Returns

Dict – metadata of the track

mirdata.datasets.compmusic_otmm_makam.load_pitch(fhandle: TextIO) mirdata.annotations.F0Data[source]

Load pitch

Parameters

fhandle (str or file-like) – path or file-like object pointing to a pitch annotation file

Returns

F0Data – pitch annotation

compmusic_raga

CompMusic Raga Dataset Loader

class mirdata.datasets.compmusic_raga.Dataset(data_home=None, version='default')[source]

The compmusic_raga dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.compmusic_raga.Track(track_id, data_home, dataset_name, index, metadata)[source]

CompMusic Raga Dataset class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. default=None If None, looks for the data in the default directory, ~/mir_datasets

Variables
  • audio_path (str) – path to audio file

  • tonic_path (str) – path to tonic annotation

  • tonic_fine_tuned_path (str) – path to tonic fine-tuned annotation

  • pitch_path (str) – path to pitch annotation

  • pitch_post_processed_path (str) – path to processed pitch annotation

  • nyas_segments_path (str) – path to nyas segments annotation

  • tani_segments_path (str) – path to tani segments annotation

Other Parameters
  • tonic (float) – tonic annotation

  • tonic_fine_tuned (float) – tonic fine-tuned annotation

  • pitch (F0Data) – pitch annotation

  • pitch_post_processed (F0Data) – processed pitch annotation

  • nyas_segments (EventData) – nyas segments annotation

  • tani_segments (EventData) – tani segments annotation

  • recording (str) – name of the recording

  • concert (str) – name of the concert

  • artist (str) – name of the artist

  • mbid (str) – mbid of the recording

  • raga (str) – raga in the recording

  • ragaid (str) – id of the raga in the recording

  • tradition (str) – tradition name (carnatic or hindustani)

property audio

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.compmusic_raga.load_audio(audio_path)[source]

Load an audio file.

Parameters

audio_path (str) – path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.compmusic_raga.load_nyas_segments(fhandle)[source]

Load nyas segments

Parameters

fhandle (str or file-like) – Local path where the nyas segments annotation is stored.

Returns

EventData – segment annotation

mirdata.datasets.compmusic_raga.load_pitch(fhandle)[source]

Load pitch

Parameters

fhandle (str or file-like) – Local path where the pitch annotation is stored.

Returns

F0Data – pitch annotation

mirdata.datasets.compmusic_raga.load_tani_segments(fhandle)[source]

Load tani segments

Parameters

fhandle (str or file-like) – Local path where the tani segments annotation is stored.

Returns

EventData – segment annotation

mirdata.datasets.compmusic_raga.load_tonic(fhandle)[source]

Load track absolute tonic

Parameters

fhandle (str or file-like) – Local path where the tonic path is stored.

Returns

int – Tonic annotation in Hz

dagstuhl_choirset

Dagstuhl ChoirSet Dataset Loader

class mirdata.datasets.dagstuhl_choirset.Dataset(data_home=None, version='default')[source]

The Dagstuhl ChoirSet dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.dagstuhl_choirset.load_audio

load_beat(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.dagstuhl_choirset.load_beat

load_f0(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.dagstuhl_choirset.load_f0

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_score(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.dagstuhl_choirset.load_score

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.dagstuhl_choirset.MultiTrack(mtrack_id, data_home, dataset_name, index, track_class, metadata)[source]

Dagstuhl ChoirSet multitrack class

Parameters
  • mtrack_id (str) – multitrack id

  • data_home (str) – Local path where the dataset is stored. If None, looks for the data in the default directory, ~/mir_datasets/dagstuhl_choirset

Variables
  • audio_stm_path (str) – path to room mic (mono mixdown) audio file

  • audio_str_path (str) – path to room mic (right channel) audio file

  • audio_stl_path (str) – path to room mic (left channel) audio file

  • audio_rev_path (str) – path to room mic with artifical reverb (mono mixdown) audio file

  • audio_spl_path (str) – path to piano accompaniment (left channel) audio file

  • audio_spr_path (str) – path to piano accompaniement (right channel) audio file

  • beat_path (str) – path to beat annotation file

Other Parameters
  • beat (annotations.BeatData) – Beat annotation

  • notes (annotations.NoteData) – Note annotation

  • multif0 (annotations.MultiF0Data) – Aggregate of f0 annotations for tracks

property audio_rev: Optional[Tuple[numpy.ndarray, float]]

The audio for the room mic with artifical reverb (mono mixdown)

Returns

  • np.ndarray - audio signal

  • float - sample rate

property audio_spl: Optional[Tuple[numpy.ndarray, float]]

The audio for the piano accompaniment DI (left channel)

Returns

  • np.ndarray - audio signal

  • float - sample rate

property audio_spr: Optional[Tuple[numpy.ndarray, float]]

The audio for the piano accompaniment DI (right channel)

Returns

  • np.ndarray - audio signal

  • float - sample rate

property audio_stl: Optional[Tuple[numpy.ndarray, float]]

The audio for the room mic (left channel)

Returns

  • np.ndarray - audio signal

  • float - sample rate

property audio_stm: Optional[Tuple[numpy.ndarray, float]]

The audio for the room mic (mono mixdown)

Returns

  • np.ndarray - audio signal

  • float - sample rate

property audio_str: Optional[Tuple[numpy.ndarray, float]]

The audio for the room mic (right channel)

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_mix()[source]

Create a linear mixture given a subset of tracks.

Parameters

track_keys (list) – list of track keys to mix together

Returns

np.ndarray – mixture audio with shape (n_samples, n_channels)

get_path(key)[source]

Get absolute path to multitrack audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

get_random_target(n_tracks=None, min_weight=0.3, max_weight=1.0)[source]

Get a random target by combining a random selection of tracks with random weights

Parameters
  • n_tracks (int or None) – number of tracks to randomly mix. If None, uses all tracks

  • min_weight (float) – minimum possible weight when mixing

  • max_weight (float) – maximum possible weight when mixing

Returns

  • np.ndarray - mixture audio with shape (n_samples, n_channels)

  • list - list of keys of included tracks

  • list - list of weights used to mix tracks

get_target(track_keys, weights=None, average=True, enforce_length=True)[source]

Get target which is a linear mixture of tracks

Parameters
  • track_keys (list) – list of track keys to mix together

  • weights (list or None) – list of positive scalars to be used in the average

  • average (bool) – if True, computes a weighted average of the tracks if False, computes a weighted sum of the tracks

  • enforce_length (bool) – If True, raises ValueError if the tracks are not the same length. If False, pads audio with zeros to match the length of the longest track

Returns

np.ndarray – target audio with shape (n_channels, n_samples)

Raises

ValueError – if sample rates of the tracks are not equal if enforce_length=True and lengths are not equal

to_jams()[source]

Jams: the track’s data in jams format

class mirdata.datasets.dagstuhl_choirset.Track(track_id, data_home, dataset_name, index, metadata)[source]

Dagstuhl ChoirSet Track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_dyn_path (str) – dynamic microphone audio path

  • audio_hsm_path (str) – headset microphone audio path

  • audio_lrx_path (str) – larynx microphone audio path

  • f0_crepe_dyn_path (str) – crepe f0 annotation for dynamic microphone path

  • f0_crepe_hsm_path (str) – crepe f0 annotation for headset microphone path

  • f0_crepe_lrx_path (str) – crepe f0 annotation for larynx microphone path

  • f0_pyin_dyn_path (str) – pyin f0 annotation for dynamic microphone path

  • f0_pyin_hsm_path (str) – pyin f0 annotation for headset microphone path

  • f0_pyin_lrx_path (str) – pyin f0 annotation for larynx microphone path

  • f0_manual_lrx_path (str) – manual f0 annotation for larynx microphone path

  • score_path (str) – score annotation path

Other Parameters
  • f0_crepe_dyn (F0Data) – algorithm-labeled (crepe) f0 annotations for dynamic microphone

  • f0_crepe_hsn (F0Data) – algorithm-labeled (crepe) f0 annotations for headset microphone

  • f0_crepe_lrx (F0Data) – algorithm-labeled (crepe) f0 annotations for larynx microphone

  • f0_pyin_dyn (F0Data) – algorithm-labeled (pyin) f0 annotations for dynamic microphone

  • f0_pyin_hsn (F0Data) – algorithm-labeled (pyin) f0 annotations for headset microphone

  • f0_pyin_lrx (F0Data) – algorithm-labeled (pyin) f0 annotations for larynx microphone

  • f0_manual_lrx (F0Data) – manually labeled f0 annotations for larynx microphone

  • score (NoteData) – time-aligned score representation

property audio_dyn: Optional[Tuple[numpy.ndarray, float]]

The audio for the track’s dynamic microphone (if available)

Returns

  • np.ndarray - audio signal

  • float - sample rate

property audio_hsm: Optional[Tuple[numpy.ndarray, float]]

The audio for the track’s headset microphone (if available)

Returns

  • np.ndarray - audio signal

  • float - sample rate

property audio_lrx: Optional[Tuple[numpy.ndarray, float]]

The audio for the track’s larynx microphone (if available)

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Jams: the track’s data in jams format

mirdata.datasets.dagstuhl_choirset.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Dagstuhl ChoirSet audio file.

Parameters

audio_path (str) – path pointing to an audio file

Returns

  • np.ndarray - the audio signal

  • float - The sample rate of the audio file

mirdata.datasets.dagstuhl_choirset.load_beat(fhandle: TextIO) mirdata.annotations.BeatData[source]

Load a Dagstuhl ChoirSet beat annotation.

Parameters

fhandle (str or file-like) – File-like object or path to beat annotation file

Returns

BeatData Object - the beat annotation

mirdata.datasets.dagstuhl_choirset.load_f0(fhandle: TextIO) mirdata.annotations.F0Data[source]

Load a Dagstuhl ChoirSet F0-trajectory.

Parameters

fhandle (str or file-like) – File-like object or path to F0 file

Returns

F0Data Object - the F0-trajectory

mirdata.datasets.dagstuhl_choirset.load_score(fhandle: TextIO) mirdata.annotations.NoteData[source]

Load a Dagstuhl ChoirSet time-aligned score representation.

Parameters

fhandle (str or file-like) – File-like object or path to score representation file

Returns

NoteData Object - the time-aligned score representation

dali

DALI Dataset Loader

class mirdata.datasets.dali.Dataset(data_home=None, version='default')[source]

The dali dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_annotations_class(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.dali.load_annotations_class

load_annotations_granularity(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.dali.load_annotations_granularity

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.dali.load_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.dali.Track(track_id, data_home, dataset_name, index, metadata)[source]

DALI melody Track class

Parameters

track_id (str) – track id of the track

Variables
  • album (str) – the track’s album

  • annotation_path (str) – path to the track’s annotation file

  • artist (str) – the track’s artist

  • audio_path (str) – path to the track’s audio file

  • audio_url (str) – youtube ID

  • dataset_version (int) – dataset annotation version

  • ground_truth (bool) – True if the annotation is verified

  • language (str) – sung language

  • release_date (str) – year the track was released

  • scores_manual (int) – manual score annotations

  • scores_ncc (float) – ncc score annotations

  • title (str) – the track’s title

  • track_id (str) – the unique track id

  • url_working (bool) – True if the youtube url was valid

Other Parameters
  • notes (NoteData) – vocal notes

  • words (LyricData) – word-level lyrics

  • lines (LyricData) – line-level lyrics

  • paragraphs (LyricData) – paragraph-level lyrics

  • annotation-object (DALI.Annotations) – DALI annotation object

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.dali.load_annotations_class(annotations_path)[source]

Load full annotations into the DALI class object

Parameters

annotations_path (str) – path to a DALI annotation file

Returns

DALI.annotations – DALI annotations object

mirdata.datasets.dali.load_annotations_granularity(annotations_path, granularity)[source]

Load annotations at the specified level of granularity

Parameters
  • annotations_path (str) – path to a DALI annotation file

  • granularity (str) – one of ‘notes’, ‘words’, ‘lines’, ‘paragraphs’

Returns

NoteData for granularity=’notes’ or LyricData otherwise

mirdata.datasets.dali.load_audio(fhandle: BinaryIO) Optional[Tuple[numpy.ndarray, float]][source]

Load a DALI audio file.

Parameters

fhandle (str or file-like) – path or file-like object pointing to an audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

da_tacos

Da-TACOS Dataset Loader

class mirdata.datasets.da_tacos.Dataset(data_home=None, version='default')[source]

The Da-TACOS dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

benchmark_tracks()[source]

Load from Da-TACOS dataset the benchmark subset tracks.

Returns

dict – {track_id: track data}

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

coveranalysis_tracks()[source]

Load from Da-TACOS dataset the coveranalysis subset tracks.

Returns

dict – {track_id: track data}

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

filter_index(search_key)[source]

Load from Da-TACOS genre dataset the indexes that match with search_key.

Parameters

search_key (str) – regex to match with folds, mbid or genres

Returns

dict – {track_id: track data}

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_cens(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.da_tacos.load_cens

load_crema(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.da_tacos.load_crema

load_hpcp(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.da_tacos.load_hpcp

load_key(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.da_tacos.load_key

load_madmom(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.da_tacos.load_madmom

load_mfcc(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.da_tacos.load_mfcc

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tags(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.da_tacos.load_tags

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.da_tacos.Track(track_id, data_home, dataset_name, index, metadata)[source]

da_tacos track class

Parameters

track_id (str) – track id of the track

Variables
  • subset (str) – subset which the track belongs to

  • work_id (str) – id of work’s original track

  • label (str) – alias of work_id

  • performance_id (str) – id of cover track

  • cens_path (str) – cens annotation path

  • crema_path (str) – crema annotation path

  • hpcp_path (str) – hpcp annotation path

  • key_path (str) – key annotation path

  • madmom_path (str) – madmom annotation path

  • mfcc_path (str) – mfcc annotation path

  • tags_path (str) – tags annotation path

Properties:

work_title (str): title of the work work_artist (str): original artist of the work performance_title (str): title of the performance performance_artist (str): artist of the performance release_year (str): release year is_instrumental (bool): True if the track is instrumental performance_artist_mbid (str): musicbrainz id of the performance artist mb_performances (dict): musicbrainz ids of performances

Other Parameters
  • cens (np.ndarray) – chroma-cens features

  • hpcp (np.ndarray) – hpcp features

  • key (dict) – key data, with keys ‘key’, ‘scale’, and ‘strength’

  • madmom (dict) – dictionary of madmom analysis features

  • mfcc (np.ndarray) – mfcc features

  • tags (list) – list of tags

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams() jams.JAMS[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.da_tacos.load_cens(fhandle: BinaryIO)[source]

Load Da-TACOS cens features from a file

Parameters

fhandle (str or file-like) – File-like object or path to chroma-cens file

Returns

np.ndarray – cens features

mirdata.datasets.da_tacos.load_crema(fhandle: BinaryIO)[source]

Load Da-TACOS crema features from a file

Parameters

fhandle (str or file-like) – File-like object or path to crema file

Returns

np.ndarray – crema features

mirdata.datasets.da_tacos.load_hpcp(fhandle: BinaryIO)[source]

Load Da-TACOS hpcp features from a file

Parameters

fhandle (str or file-like) – File-like object or path to hpcp file

Returns

np.ndarray – hpcp features

mirdata.datasets.da_tacos.load_key(fhandle: BinaryIO)[source]

Load Da-TACOS key features from a file.

Parameters

fhandle (str or file-like) – File-like object or path to key file

Returns

dict – key, mode and confidence

Examples

{‘key’: ‘C’, ‘scale’: ‘major’, ‘strength’: 0.8449875116348267}

mirdata.datasets.da_tacos.load_madmom(fhandle: BinaryIO)[source]

Load Da-TACOS madmom features from a file

Parameters

fhandle (str or file-like) – File-like object or path to madmom file

Returns

dict – madmom features, with keys ‘novfn’, ‘onsets’, ‘snovfn’, ‘tempos

mirdata.datasets.da_tacos.load_mfcc(fhandle: BinaryIO)[source]

Load Da-TACOS mfcc from a file

Parameters

fhandle (str or file-like) – File-like object or path to mfcc file

Returns

np.ndarray – array of mfccs over time

mirdata.datasets.da_tacos.load_tags(fhandle: BinaryIO)[source]

Load Da-TACOS tags from a file

Parameters

fhandle (str or file-like) – File-like object or path to tags file

Returns

list – tags, in the form [(tag, confidence), …]

Example

[(‘rock’, ‘0.127’), (‘pop’, ‘0.014’), …]

egfxset

EGFxSet Dataset Loader

class mirdata.datasets.egfxset.Dataset(data_home=None, version='default')[source]

The EGFxSet dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.egfxset.Track(track_id, data_home, dataset_name, index, metadata)[source]

EGFxSet Track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – path to the track’s audio file

  • stringfret_tuple (list) – an array with the tuple of the note recorded

  • pickup_configuration (string) – the pickup used in the recording

  • effect (str) – the effect recorded

  • model (str) – the model of the hardware used

  • effect_type (str) the type of effect used (distortion, modulation, delay or reverb) –

  • knob_names (list) – an array with the knob names of the effect used or “None” when the recording is a clean effect sound

  • knob_type (list) – an array with the type of knobs of the effect used or “None” when the recording is a clean effect sound

  • setting (list) – the setting of the effect recorded or “None” when the recording is a clean effect sound

Other Parameters
  • note_name (ndarray) – a list with the note name annotation of the audio file (e.g. “Ab5”, “C6”, etc.)

  • midinote (NoteData) – the midinote annotation of the audio file

property audio: Optional[Tuple[numpy.ndarray, float]]

Solo guitar audio (mono)

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.egfxset.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load EGFxSet guitar audio

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - audio signal

  • float - sample rate

filosax

Filosax Dataset Loader

class mirdata.datasets.filosax.Dataset(data_home=None, version='default')[source]

The Filosax dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.filosax.MultiTrack(mtrack_id, data_home, dataset_name, index, track_class, metadata)[source]

Filosax multitrack class

Parameters
  • mtrack_id (str) – multitrack id

  • data_home (str) – Local path where the dataset is stored. If None, looks for the data in the default directory, ~/mir_datasets/Filosax

Variables
  • mtrack_id (str) – track id

  • tracks (dict) – {track_id: Track}

  • track_audio_property (str) – the name of the attribute of Track which returns the audio to be mixed

  • name (str) – the name of the tune

  • duration (float) – the duration, in seconds

  • beats (list, Observation) – the time and beat numbers of bars and chord changes

  • chords (list, Observation) – the time of chord changes

  • segments (list, Observation) – the time of segment changes

  • bass_drums (Track) – the associated bass/drums track

  • piano_drums (Track) – the associated piano/drums track

  • sax (list, Track) – a list of associated sax tracks

Other Parameters

annotation (jams.JAMS) – a .jams file containing the annotations

annotation

.jams file

Type

output type

property bass_drums

The associated bass/drums track

Returns

  • Track

property beats

The times of downbeats and chord changes

Returns

  • (SortedKeyList, Observation) - timestamp, duration (seconds), beat

property chords

The times and values of chord changes

Returns

  • (SortedKeyList, Observation) - timestamp, duration (seconds), chord symbol

property duration

The track’s duration

Returns

  • float - track duration (in seconds)

get_mix()[source]

Create a linear mixture given a subset of tracks.

Parameters

track_keys (list) – list of track keys to mix together

Returns

np.ndarray – mixture audio with shape (n_samples, n_channels)

get_path(key)[source]

Get absolute path to multitrack audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

get_random_target(n_tracks=None, min_weight=0.3, max_weight=1.0)[source]

Get a random target by combining a random selection of tracks with random weights

Parameters
  • n_tracks (int or None) – number of tracks to randomly mix. If None, uses all tracks

  • min_weight (float) – minimum possible weight when mixing

  • max_weight (float) – maximum possible weight when mixing

Returns

  • np.ndarray - mixture audio with shape (n_samples, n_channels)

  • list - list of keys of included tracks

  • list - list of weights used to mix tracks

get_target(track_keys, weights=None, average=True, enforce_length=True)[source]

Get target which is a linear mixture of tracks

Parameters
  • track_keys (list) – list of track keys to mix together

  • weights (list or None) – list of positive scalars to be used in the average

  • average (bool) – if True, computes a weighted average of the tracks if False, computes a weighted sum of the tracks

  • enforce_length (bool) – If True, raises ValueError if the tracks are not the same length. If False, pads audio with zeros to match the length of the longest track

Returns

np.ndarray – target audio with shape (n_channels, n_samples)

Raises

ValueError – if sample rates of the tracks are not equal if enforce_length=True and lengths are not equal

property name

The track’s name

Returns

  • str - track name

property piano_drums

The associated piano/drums track

Returns

  • Track

property sax

The associated sax tracks (1-5)

Returns

  • (list, Track)

property segments

The times of segment changes (values are ‘head’, ‘written solo’, ‘improvised solo’)

Returns

  • (SortedKeyList, Observation) - timestamp, duration (seconds), beat

to_jams()[source]

Jams: the track’s data in jams format

class mirdata.datasets.filosax.Note(input_dict)[source]

Filosax Note class - dictionary wrapper to give dot properties

Parameters

input_dict (dict) – dictionary of attributes

Variables
  • a_start_time (float) – the time stamp of the note start, in seconds

  • a_end_time (float) – the time stamp of the note end, in seconds

  • a_duration (float) – the duration of the note, in seconds

  • a_onset_time (float) – the onset time (compared to a_start_time) (filosax_full only, 0.0 otherwise)

  • midi_pitch (int) – the quantised midi pitch

  • crochet_num (int) – the number of sub-divisions which define a crochet (always 24)

  • musician (int) – the participant ID

  • bar_num (int) – the bar number of the start of the note

  • s_start_time (float) – the time stamp of the score note start, in seconds

  • s_duration (float) – the duration of the score note, in seconds

  • s_end_time (float) – the time stamp of the score note end, in seconds

  • s_rhythmic_duration (int) – the duration of the score note (compared to crochet_num)

  • s_rhythmic_position (int) – the position in the bar of the score note start (compared to crochet_num)

  • tempo (float) – the tempo at the start of the note, in beats per minute

  • bar_type (int) – the section annotation where 0 = head, 1 = written solo, 2 = improvised solo

  • is_grace (bool) – is the note a grace note, associated with the following note

  • chord_changes (dict) – the chords, where the key is the rhythmic position of the chord (using crochet_num, relative to s_rhythmic_position) and the value a JAMS chord annotation (An additional chord is added in the case of a quaver at the end of the bar, followed by a rest on the downbeat)

  • num_chord_changes (int) – the number of chords which accompany the note (usually 1, sometimes >1 for long notes)

  • main_chord_num (int) – usually 0, sometimes 1 in the quaver case described above

  • scale_changes (list, int) – the degree of the chromatic scale when midi_pitch is compared to chord_root

  • loudness_max_val (float) – the value (db) of the maximum loudness

  • loudness_max_time (float) – the time (seconds) of the maximum loudness (compared to a_start_time)

  • loudness_curve (list, float) – the inter-note loudness values, 1 per millisecond

  • pitch_average_val (float) – the value (midi) of the average pitch and

  • pitch_average_time (float) – the time (seconds) of the average pitch (compared to a_start_time)

  • pitch_curve (list, float) – the inter-note pitch values, 1 per millisecond

  • pitch_vib_freq (float) – the vibrato frequency (Hz), 0.0 if no vibrato detected

  • pitch_vib_ext (float) – the vibrato extent (midi), 0.0 if no vibrato detected

  • spec_cent (float) – the spectral centroid value at the time of the maximum loudness

  • spec_flux (float) – the spectral flux value at the time of the maximum loudness

  • spec_cent_curve (list, float) – the inter-note spectral centroid values, 1 per millisecond

  • spec_flux_curve (list, float) – the inter-note spectral flux values, 1 per millisecond

  • seq_len (int) – the length of the phrase in which the note falls (filosax_full only, -1 otherwise)

  • seq_num (int) – the note position in the phrase (filosax_full only, -1 otherwise)

class mirdata.datasets.filosax.Track(track_id, data_home, dataset_name, index, metadata)[source]

Filosax track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – path to audio file

  • annotation_path (str) – path to annotation file

  • midi_path (str) – path to MIDI file

  • musicXML_path (str) – path to musicXML file

  • pdf_path (str) – path to PDF file

Other Parameters

notes (list, Note) – an ordered list of Note objects

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

notes

The track’s note list - only for Sax files

Returns

  • [Note] - ordered list of Note objects (empty if Backing file)

mirdata.datasets.filosax.load_annotation(fhandle: TextIO) List[mirdata.datasets.filosax.Note][source]

Load a Filosax annotation file.

Parameters

fhandle (str or file-like) – path or file-like object pointing to an audio file

Returns

** (list, Note)* – an ordered list of Note objects

mirdata.datasets.filosax.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Filosax audio file.

Parameters

fhandle (str or file-like) – path or file-like object pointing to an audio file

Returns

  • np.ndarray - the audio signal

  • float - The sample rate of the audio file

four_way_tabla

Four-Way Tabla Stroke Transcription and Classification Loader

class mirdata.datasets.four_way_tabla.Dataset(data_home=None, version='default')[source]

The Four-Way Tabla dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.four_way_tabla.Track(track_id, data_home, dataset_name, index, metadata)[source]

Four-Way Tabla track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored.

Variables
  • track_id (str) – track id

  • audio_path (str) – audio path

  • onsets_b_path (str) – path to B onsets

  • onsets_d_path (str) – path to D onsets

  • onsets_rb_path (str) – path to RB onsets

  • onsets_rt_path (str) – path to RT onsets

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

property onsets_b: Optional[mirdata.annotations.BeatData]

Onsets for stroke B

Returns

  • annotations.BeatData - onsets annotation

property onsets_d: Optional[mirdata.annotations.BeatData]

Onsets for stroke D

Returns

  • annotations.BeatData - onsets annotation

property onsets_rb: Optional[mirdata.annotations.BeatData]

Onsets for stroke RB

Returns

  • annotations.BeatData - onsets annotation

property onsets_rt: Optional[mirdata.annotations.BeatData]

Onsets for stroke RT

Returns

  • annotations.BeatData - onsets annotation

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.four_way_tabla.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Mridangam Stroke Dataset audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.four_way_tabla.load_onsets(fhandle)[source]

Load stroke onsets

Parameters

fhandle (str or file-like) – Local path where the pitch annotation is stored.

Returns

EventData – onset annotations

freesound_one_shot_percussive_sounds

Freesound One-Shot Percussive Sounds Dataset Loader

class mirdata.datasets.freesound_one_shot_percussive_sounds.Dataset(data_home=None, version='default')[source]

The Freesound One-Shot Percussive Sounds dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.freesound_one_shot_percussive_sounds.load_audio

load_file_metadata(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.freesound_one_shot_percussive_sounds.load_f ile_metadata

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.freesound_one_shot_percussive_sounds.Track(track_id, data_home, dataset_name, index, metadata)[source]

Freesound one-shot percussive sounds track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. If None, looks for the data in the default directory, ~/mir_datasets/freesound_one_shot_percussive_sounds

Variables
  • file_metadata_path (str) – local path where the analysis file is stored and from where we get the file metadata

  • audio_path (str) – local path where audio file is stored

  • track_id (str) – track id

  • filename (str) – filename of the track

  • username (str) – username of the Freesound uploader of the track

  • license (str) – link to license of the track file

  • tags (list) – list of tags of the track

  • freesound_preview_urls (dict) – dict of Freesound previews urls of the track

  • freesound_analysis (str) – dict of analysis parameters computed in Freesound using Essentia extractor

  • audiocommons_analysis (str) – dict of analysis parameters computed using AudioCommons Extractor

Other Parameters

file_metadata (dict) – metadata parameters of the track file in form of Python dictionary

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.freesound_one_shot_percussive_sounds.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load the track audio file.

Parameters

fhandle (str) – path to an audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.freesound_one_shot_percussive_sounds.load_file_metadata(fhandle: TextIO) Optional[dict][source]

Extract file metadata from analysis json file

Parameters

fhandle (str or file-like) – path or file-like object pointing to f0 annotation file

Returns

analysis – track analysis dict

giantsteps_key

giantsteps_key Dataset Loader

class mirdata.datasets.giantsteps_key.Dataset(data_home=None, version='default')[source]

The giantsteps_key dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_artist(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.giantsteps_key.load_artist

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.giantsteps_key.load_audio

load_genre(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.giantsteps_key.load_genre

load_key(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.giantsteps_key.load_key

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tempo(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.giantsteps_key.load_tempo

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.giantsteps_key.Track(track_id, data_home, dataset_name, index, metadata)[source]

giantsteps_key track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – track audio path

  • keys_path (str) – key annotation path

  • metadata_path (str) – sections annotation path

  • title (str) – title of the track

  • track_id (str) – track id

Other Parameters
  • key (str) – musical key annotation

  • artists (list) – list of artists involved

  • genres (dict) – genres and subgenres

  • tempo (int) – crowdsourced tempo annotations in beats per minute

property audio: Tuple[numpy.ndarray, float]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.giantsteps_key.load_artist(fhandle: TextIO) List[str][source]

Load giantsteps_key tempo data from a file

Parameters

fhandle (str or file-like) – File-like object or path pointing to metadata annotation file

Returns

list – list of artists involved in the track.

mirdata.datasets.giantsteps_key.load_audio(fpath: str) Tuple[numpy.ndarray, float][source]

Load a giantsteps_key audio file.

Parameters

fpath (str) – str pointing to an audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.giantsteps_key.load_genre(fhandle: TextIO) Dict[str, List[str]][source]

Load giantsteps_key genre data from a file

Parameters

fhandle (str or file-like) – File-like object or path pointing to metadata annotation file

Returns

dict{‘genres’: […], ‘subgenres’: […]}

mirdata.datasets.giantsteps_key.load_key(fhandle: TextIO) str[source]

Load giantsteps_key format key data from a file

Parameters

fhandle (str or file-like) – File like object or string pointing to key annotation file

Returns

str – loaded key data

mirdata.datasets.giantsteps_key.load_tempo(fhandle: TextIO) str[source]

Load giantsteps_key tempo data from a file

Parameters

fhandle (str or file-like) – File-like object or string pointing to metadata annotation file

Returns

str – loaded tempo data

giantsteps_tempo

giantsteps_tempo Dataset Loader

class mirdata.datasets.giantsteps_tempo.Dataset(data_home=None, version='default')[source]

The giantsteps_tempo dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.giantsteps_tempo.load_audio

load_genre(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.giantsteps_tempo.load_genre

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tempo(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.giantsteps_tempo.load_tempo

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.giantsteps_tempo.Track(track_id, data_home, dataset_name, index, metadata)[source]

giantsteps_tempo track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – track audio path

  • title (str) – title of the track

  • track_id (str) – track id

  • annotation_v1_path (str) – track annotation v1 path

  • annotation_v2_path (str) – track annotation v2 path

Other Parameters
  • genre (dict) – Human-labeled metadata annotation

  • tempo (list) – List of annotations.TempoData, ordered by confidence

  • tempo_v2 (list) – List of annotations.TempoData for version 2, ordered by confidence

property audio: Tuple[numpy.ndarray, float]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

to_jams_v2()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.giantsteps_tempo.load_audio(fhandle: str) Tuple[numpy.ndarray, float][source]

Load a giantsteps_tempo audio file.

Parameters

fhandle (str or file-like) – path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.giantsteps_tempo.load_genre(fhandle: TextIO) str[source]

Load genre data from a file

Parameters

path (str) – path to metadata annotation file

Returns

str – loaded genre data

mirdata.datasets.giantsteps_tempo.load_tempo(fhandle: TextIO) mirdata.annotations.TempoData[source]

Load giantsteps_tempo tempo data from a file ordered by confidence

Parameters

fhandle (str or file-like) – File-like object or path to tempo annotation file

Returns

annotations.TempoData – Tempo data

good_sounds

Good-Sounds Dataset Loader

class mirdata.datasets.good_sounds.Dataset(data_home=None, version='default')[source]

The GOOD-SOUNDS dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.good_sounds.load_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.good_sounds.Track(track_id, data_home, dataset_name, index, metadata)[source]

GOOD-SOUNDS Track class

Parameters

track_id (str) – track id of the track

Variables

audio_path (str) – Path to the audio file

Other Parameters
  • ratings_info (dict) – A dictionary containing the entity Ratings.

  • Some musicians self-rated their performance in a 0-10 goodness scale for the user evaluation of the first project

  • prototype. Please read the paper for more detailed information.

    • id

    • mark: the rate or score.

    • type: the klass of the sound. Related to the tags of the sound.

    • created_at

    • comments

    • sound_id

    • rater: the musician who rated the sound.

  • pack_info (dict) – A dictionary containing the entity Pack. A pack is a group of sounds from the same recording session. The audio files are organised in the sound_files directory in subfolders with the pack name to which they belong. The following metadata is associated with the entity Pack. - id - name - description

  • sound_info (dict) – A dictionary containing the entity Sound. A sound can have several takes as some of them were recorded using different microphones at the same time. The following metadata is associated with the entity Sound. - id - instrument: flute, cello, clarinet, trumpet, violin, sax_alto, sax_tenor, sax_baritone, sax_soprano, oboe, piccolo, bass - note - octave - dynamics: for some sounds, the musical notation of the loudness level (p, mf, f..) - recorded_at: recording date and time - location: recording place - player: the musician who recorded. For detailed information about the musicians contact us. - bow_velocity: for some string instruments the velocity of the bow (slow, medieum, fast) - bridge_position: for some string instruments the position of the bow (tasto, middle, ponticello) - string: for some string instruments the number of the string in which the sound it’s played (1: lowest in pitch) - csv_file: used for creation of the DB - csv_id: used for creation of the DB - pack_filename: used for creation of the DB - pack_id: used for creation of the DB - attack: for single notes, manual annotation of the onset in samples. - decay: for single notes, manual annotation of the decay in samples. - sustain: for single notes, manual annotation of the beginnig of the sustained part in samples. - release: for single notes, manual annotation of the beginnig of the release part in samples. - offset: for single notes, manual annotation of the offset in samples - reference: 1 if sound was used to create the models in the good-sounds project, 0 if not. - Other tags regarding tonal characteristics are also available. - comments: if any - semitone: midi note - pitch_reference: the reference pitch - klass: user generated tags of the tonal qualities of the sound. They also contain information about the exercise, that could be single note or scale. * “good-sound”: good examples of single note * “bad”: bad example of one of the sound attributes defined in the project (please read the papers for a detailed explanation) * “scale-good”: good example of a one octave scale going up and down (15 notes). If the scale is minor a tagged “minor” is also available. * “scale-bad”: bad example scale of one of the sounds defined in the project. (15 notes up and down).

  • take_info (dict) – A dictionary containing the entity Take. A sound can have several takes as some of them were recorded using different microphones at the same time. Each take has an associated audio file. The annotations. Each take has an associated audio file. The following metadata is associated with the entity Sound. - id - microphone - filename: the name of the associated audio file - original_filename: - freesound_id: for some sounds uploaded to freesound.org - sound_id: the id of the sound in the DB - goodsound_id: for some of the sounds available in good-sounds.org

  • microphone (str) – the microphone used to record the take.

  • instrument (str) – the instrument recorded (flute, cello, clarinet, trumpet, violin, sax_alto, sax_tenor, sax_baritone, sax_soprano, oboe, piccolo, bass).

  • klass (str) – user generated tags of the tonal qualities of the sound. They also contain information about the exercise, that could be single note or scale. * “good-sound”: good examples of single note * “bad”: bad example of one of the sound attributes defined in the project (please read the papers for a detailed explanation) * “scale-good”: good example of a one octave scale going up and down (15 notes). If the scale is minor a tagged “minor” is also available. * “scale-bad”: bad example scale of one of the sounds defined in the project. (15 notes up and down).

  • semitone (int) – midi note

  • pitch_reference (int) – the reference pitch

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

mirdata.datasets.good_sounds.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a GOOD-SOUNDS audio file.

Parameters

fhandle (str or file-like) – path or file-like object pointing to an audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

groove_midi

Groove MIDI Loader

class mirdata.datasets.groove_midi.Dataset(data_home=None, version='default')[source]

The groove_midi dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.groove_midi.load_audio

load_beats(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.groove_midi.load_beats

load_drum_events(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.groove_midi.load_drum_events

load_midi(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.groove_midi.load_midi

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.groove_midi.Track(track_id, data_home, dataset_name, index, metadata)[source]

Groove MIDI Track class

Parameters

track_id (str) – track id of the track

Variables
  • drummer (str) – Drummer id of the track (ex. ‘drummer1’)

  • session (str) – Type of session (ex. ‘session1’, ‘eval_session’)

  • track_id (str) – track id of the track (ex. ‘drummer1/eval_session/1’)

  • style (str) – Style (genre, groove type) of the track (ex. ‘funk/groove1’)

  • tempo (int) – track tempo in beats per minute (ex. 138)

  • beat_type (str) – Whether the track is a beat or a fill (ex. ‘beat’)

  • time_signature (str) – Time signature of the track (ex. ‘4-4’, ‘6-8’)

  • midi_path (str) – Path to the midi file

  • audio_path (str) – Path to the audio file

  • duration (float) – Duration of the midi file in seconds

  • split (str) – Whether the track is for a train/valid/test set. One of ‘train’, ‘valid’ or ‘test’.

Other Parameters
  • beats (BeatData) – Machine-generated beat annotations

  • drum_events (EventData) – Annotated drum kit events

  • midi (pretty_midi.PrettyMIDI) – object containing MIDI information

property audio: Tuple[Optional[numpy.ndarray], Optional[float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.groove_midi.load_audio(path: str) Tuple[Optional[numpy.ndarray], Optional[float]][source]

Load a Groove MIDI audio file.

Parameters

path – path to an audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.groove_midi.load_beats(midi_path, midi=None)[source]

Load beat data from the midi file.

Parameters
  • midi_path (str) – path to midi file

  • midi (pretty_midi.PrettyMIDI) – pre-loaded midi object or None if None, the midi object is loaded using midi_path

Returns

annotations.BeatData – machine generated beat data

mirdata.datasets.groove_midi.load_drum_events(midi_path, midi=None)[source]

Load drum events from the midi file.

Parameters
  • midi_path (str) – path to midi file

  • midi (pretty_midi.PrettyMIDI) – pre-loaded midi object or None if None, the midi object is loaded using midi_path

Returns

annotations.EventData – drum event data

mirdata.datasets.groove_midi.load_midi(fhandle: BinaryIO) Optional[pretty_midi.PrettyMIDI][source]

Load a Groove MIDI midi file.

Parameters

fhandle (str or file-like) – File-like object or path to midi file

Returns

midi_data (pretty_midi.PrettyMIDI) – pretty_midi object

gtzan_genre

GTZAN-Genre Dataset Loader

class mirdata.datasets.gtzan_genre.Dataset(data_home=None, version='default')[source]

The gtzan_genre dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.gtzan_genre.load_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.gtzan_genre.Track(track_id, data_home, dataset_name, index, metadata)[source]

gtzan_genre Track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – path to the audio file

  • genre (str) – annotated genre

  • track_id (str) – track id

Other Parameters
  • beats (BeatData) – human-labeled beat annotations

  • tempo (float) – global tempo annotations

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.gtzan_genre.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a GTZAN audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.gtzan_genre.load_beats(fhandle: TextIO) mirdata.annotations.BeatData[source]

Load GTZAN format beat data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to a beat annotation file

Returns

BeatData – loaded beat data

mirdata.datasets.gtzan_genre.load_tempo(fhandle: TextIO) float[source]

Load GTZAN format tempo data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to a beat annotation file

Returns

tempo (float) – loaded tempo data

guitarset

GuitarSet Loader

class mirdata.datasets.guitarset.Dataset(data_home=None, version='default')[source]

The guitarset dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.guitarset.load_audio

load_beats(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.guitarset.load_beats

load_chords(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.guitarset.load_chords

load_key_mode(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.guitarset.load_key_mode

load_multitrack_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.guitarset.load_multitrack_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_notes(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.guitarset.load_notes

load_pitch_contour(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.guitarset.load_pitch_contour

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.guitarset.Track(track_id, data_home, dataset_name, index, metadata)[source]

guitarset Track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_hex_cln_path (str) – path to the debleeded hex wave file

  • audio_hex_path (str) – path to the original hex wave file

  • audio_mic_path (str) – path to the mono wave via microphone

  • audio_mix_path (str) – path to the mono wave via downmixing hex pickup

  • jams_path (str) – path to the jams file

  • mode (str) – one of [‘solo’, ‘comp’] For each excerpt, players are asked to first play in ‘comp’ mode and later play a ‘solo’ version on top of the already recorded comp.

  • player_id (str) – ID of the different players. one of [‘00’, ‘01’, … , ‘05’]

  • style (str) – one of [‘Jazz’, ‘Bossa Nova’, ‘Rock’, ‘Singer-Songwriter’, ‘Funk’]

  • tempo (float) – BPM of the track

  • track_id (str) – track id

Other Parameters
  • beats (BeatData) – beat positions

  • leadsheet_chords (ChordData) – chords as written in the leadsheet

  • inferred_chords (ChordData) – chords inferred from played transcription

  • key_mode (KeyData) – key and mode

  • pitch_contours (dict) – Pitch contours per string - ‘E’: F0Data(…) - ‘A’: F0Data(…) - ‘D’: F0Data(…) - ‘G’: F0Data(…) - ‘B’: F0Data(…) - ‘e’: F0Data(…)

  • multif0 (MultiF0Data) – all pitch contour data as one multif0 annotation

  • notes (dict) – Notes per string - ‘E’: NoteData(…) - ‘A’: NoteData(…) - ‘D’: NoteData(…) - ‘G’: NoteData(…) - ‘B’: NoteData(…) - ‘e’: NoteData(…)

  • notes_all (NoteData) – all note data as one note annotation

property audio_hex: Optional[Tuple[numpy.ndarray, float]]

Hexaphonic audio (6-channels) with one channel per string

Returns

  • np.ndarray - audio signal

  • float - sample rate

property audio_hex_cln: Optional[Tuple[numpy.ndarray, float]]
Hexaphonic audio (6-channels) with one channel per string

after bleed removal

Returns

  • np.ndarray - audio signal

  • float - sample rate

property audio_mic: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

property audio_mix: Optional[Tuple[numpy.ndarray, float]]

Mixture audio (mono)

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.guitarset.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Guitarset audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.guitarset.load_beats(fhandle: TextIO) mirdata.annotations.BeatData[source]

Load a Guitarset beats annotation.

Parameters

fhandle (str or file-like) – File-like object or path of the jams annotation file

Returns

BeatData – Beat data

mirdata.datasets.guitarset.load_chords(jams_path, leadsheet_version)[source]

Load a guitarset chord annotation.

Parameters
  • jams_path (str) – path to the jams annotation file

  • leadsheet_version (Bool) – Whether or not to load the leadsheet version of the chord annotation If False, load the infered version.

Returns

ChordData – Chord data

mirdata.datasets.guitarset.load_key_mode(fhandle: TextIO) mirdata.annotations.KeyData[source]

Load a Guitarset key-mode annotation.

Parameters

fhandle (str or file-like) – File-like object or path of the jams annotation file

Returns

KeyData – Key data

mirdata.datasets.guitarset.load_multitrack_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Guitarset multitrack audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.guitarset.load_notes(jams_path, string_num)[source]

Load a guitarset note annotation for a given string

Parameters
  • jams_path (str) – path to the jams annotation file

  • string_num (int), in range(6) – Which string to load. 0 is the Low E string, 5 is the high e string.

Returns

NoteData – Note data for the given string

mirdata.datasets.guitarset.load_pitch_contour(jams_path, string_num)[source]

Load a guitarset pitch contour annotation for a given string

Parameters
  • jams_path (str) – path to the jams annotation file

  • string_num (int), in range(6) – Which string to load. 0 is the Low E string, 5 is the high e string.

Returns

F0Data – Pitch contour data for the given string

haydn_op20

haydn op20 Dataset Loader

class mirdata.datasets.haydn_op20.Dataset(data_home=None, version='default')[source]

The haydn op20 dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_chords(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.haydn_op20.load_chords

load_chords_music21(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.haydn_op20.load_chords_music21

load_key(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.haydn_op20.load_key

load_key_music21(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.haydn_op20.load_key_music21

load_midi_path(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.haydn_op20.convert_and_save_to_midi

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_roman_numerals(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.haydn_op20.load_roman_numerals

load_score(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.haydn_op20.load_score

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.haydn_op20.Track(track_id, data_home, dataset_name, index, metadata)[source]

haydn op20 track class

Parameters

track_id (str) – track id of the track

Variables
  • title (str) – title of the track

  • track_id (str) – track id

  • humdrum_annotated_path (str) – path to humdrum annotated score

Other Parameters
  • keys (KeyData) – annotated local keys.

  • keys_music21 (list) – annotated local keys.

  • roman_numerals (list) – annotated roman_numerals.

  • chords (ChordData) – annotated chords.

  • chords_music21 (list) – annotated chords.

  • duration (int) – relative duration

  • midi_path (str) – path to midi

  • score (music21.stream.Score) – music21 score

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.haydn_op20.convert_and_save_to_midi(fpath: TextIO)[source]

convert to midi file and return the midi path

Parameters

fpath (str or file-like) – path to score file

Returns

str – midi file path

Deprecated since version 0.3.4: convert_and_save_to_midi is deprecated and will be removed in a future version

mirdata.datasets.haydn_op20.load_chords(fhandle: TextIO, resolution: int = 28)[source]

Load haydn op20 chords data from a file

Parameters
  • fhandle (str or file-like) – path to chord annotations

  • resolution (int) – the number of pulses, or ticks, per quarter note (PPQ)

Returns

ChordData – chord annotations

mirdata.datasets.haydn_op20.load_chords_music21(fhandle: TextIO, resolution: int = 28)[source]

Load haydn op20 chords data from a file in music21 format

Parameters
  • fhandle (str or file-like) – path to chord annotations

  • resolution (int) – the number of pulses, or ticks, per quarter note (PPQ)

Returns

list – musical chords data and relative time (offset (Music21Object.offset) * resolution) [(time in PPQ, chord)]

mirdata.datasets.haydn_op20.load_key(fhandle: TextIO, resolution=28)[source]

Load haydn op20 key data from a file

Parameters
  • fhandle (str or file-like) – path to key annotations

  • resolution (int) – the number of pulses, or ticks, per quarter note (PPQ)

Returns

KeyData – loaded key data

mirdata.datasets.haydn_op20.load_key_music21(fhandle: TextIO, resolution=28)[source]

Load haydn op20 key data from a file in music21 format

Parameters
  • fhandle (str or file-like) – path to key annotations

  • resolution (int) – the number of pulses, or ticks, per quarter note (PPQ)

Returns

list – musical key data and relative time (offset (Music21Object.offset) * resolution) [(time in PPQ, local key)]

mirdata.datasets.haydn_op20.load_roman_numerals(fhandle: TextIO, resolution=28)[source]

Load haydn op20 roman numerals data from a file

Parameters
  • fhandle (str or file-like) – path to roman numeral annotations

  • resolution (int) – the number of pulses, or ticks, per quarter note (PPQ)

Returns

list – musical roman numerals data and relative time (offset (Music21Object.offset) * resolution) [(time in PPQ, roman numerals)]

mirdata.datasets.haydn_op20.load_score(fhandle: TextIO)[source]

Load haydn op20 score with annotations from a file with music21 format (music21.stream.Score).

Parameters

fhandle (str or file-like) – path to score

Returns

music21.stream.Score – score in music21 format

idmt_smt_audio_effects

IDMT-SMT-Audio-Effects Dataset Loader

class mirdata.datasets.idmt_smt_audio_effects.Dataset(data_home=None, version='default')[source]

The IDMT-SMT-Audio Effect dataset.

Parameters
  • data_home (str) – Directory where the dataset is located or will be downloaded.

  • version (str) – Dataset version. Default is “default”.

Variables
  • name (str) – Name of the dataset.

  • track_class (Type[core.Track]) – Track type.

  • bibtex (str or None) – BibTeX citation.

  • indexes (dict or None) – Available versions.

  • remotes (dict or None) – Data to be downloaded.

  • download_info (str) – Instructions for downloading the dataset.

  • license_info (str) – Dataset license.

  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name – the identifier of the dataset

  • bibtex – dataset citation/s in bibtex format

  • indexes

  • remotes – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.idmt_smt_audio_effects.Track(track_id, data_home, dataset_name, index, metadata)[source]

IDMT-SMT-Audio-Effects track class.

Parameters
  • track_id (str) – track id of the track.

  • data_home (str) – Local path where the dataset is stored.

  • dataset_name (str) – Name of the dataset.

  • index (Dict) – Index dictionary.

  • metadata (Dict) – Metadata dictionary.

Variables
  • audio_path (str) – path to audio file.

  • instrument (str) – instrument used to record the track.

  • midi_nr (int) – midi number of the note.

  • fx_group (int) – effect group number.

  • fx_type (int) – effect type number.

  • fx_setting (int) – effect setting number.

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.idmt_smt_audio_effects.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a IDMT-SMT-Audio Effect track.

Parameters

fhandle (Union[str, BinaryIO]) – Path to audio file or file-like object.

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

ikala

iKala Dataset Loader

class mirdata.datasets.ikala.Dataset(data_home=None, version='default')[source]

The ikala dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_f0(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.ikala.load_f0

load_instrumental_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.ikala.load_instrumental_audio

load_lyrics(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.ikala.load_lyrics

load_mix_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.ikala.load_mix_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_notes(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.ikala.load_notes

load_pronunciations(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.ikala.load_pronunciations

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

load_vocal_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.ikala.load_vocal_audio

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.ikala.Track(track_id, data_home, dataset_name, index, metadata)[source]

ikala Track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – path to the track’s audio file

  • f0_path (str) – path to the track’s f0 annotation file

  • notes_pyin_path (str) – path to the note annotation file

  • lyrics_path (str) – path to the track’s lyric annotation file

  • section (str) – section. Either ‘verse’ or ‘chorus’

  • singer_id (str) – singer id

  • song_id (str) – song id of the track

  • track_id (str) – track id

Other Parameters
  • f0 (F0Data) – human-annotated singing voice pitch

  • notes_pyin (NoteData) – notes estimated by the pyin algorithm

  • lyrics (LyricsData) – human-annotated lyrics

  • pronunciations (LyricsData) – human-annotation lyric pronunciations

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

property instrumental_audio: Optional[Tuple[numpy.ndarray, float]]

instrumental audio (mono)

Returns

  • np.ndarray - audio signal

  • float - sample rate

property mix_audio: Optional[Tuple[numpy.ndarray, float]]

mixture audio (mono)

Returns

  • np.ndarray - audio signal

  • float - sample rate

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

property vocal_audio: Optional[Tuple[numpy.ndarray, float]]

solo vocal audio (mono)

Returns

  • np.ndarray - audio signal

  • float - sample rate

mirdata.datasets.ikala.load_f0(fhandle: TextIO) mirdata.annotations.F0Data[source]

Load an ikala f0 annotation

Parameters

fhandle (str or file-like) – File-like object or path to f0 annotation file

Raises

IOError – If f0_path does not exist

Returns

F0Data – the f0 annotation data

mirdata.datasets.ikala.load_instrumental_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load ikala instrumental audio

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - audio signal

  • float - sample rate

mirdata.datasets.ikala.load_lyrics(fhandle: TextIO) mirdata.annotations.LyricData[source]

Load an ikala lyrics annotation

Parameters

fhandle (str or file-like) – File-like object or path to lyric annotation file

Raises

IOError – if lyrics_path does not exist

Returns

LyricData – lyric annotation data

mirdata.datasets.ikala.load_mix_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load an ikala mix.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - audio signal

  • float - sample rate

mirdata.datasets.ikala.load_notes(fhandle: TextIO) Optional[mirdata.annotations.NoteData][source]

load a note annotation file

Parameters

fhandle (str or file-like) – str or file-like to note annotation file

Raises

IOError – if file doesn’t exist

Returns

NoteData – note annotation

mirdata.datasets.ikala.load_pronunciations(fhandle: TextIO) mirdata.annotations.LyricData[source]

Load an ikala pronunciation annotation

Parameters

fhandle (str or file-like) – File-like object or path to lyric annotation file

Raises

IOError – if lyrics_path does not exist

Returns

LyricData – pronunciation annotation data

mirdata.datasets.ikala.load_vocal_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load ikala vocal audio

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - audio signal

  • float - sample rate

irmas

IRMAS Loader

class mirdata.datasets.irmas.Dataset(data_home=None, version='default')[source]

The irmas dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.irmas.load_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_pred_inst(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.irmas.load_pred_inst

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.irmas.Track(track_id, data_home, dataset_name, index, metadata)[source]

IRMAS track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. If None, looks for the data in the default directory, ~/mir_datasets/Mridangam-Stroke

Variables
  • track_id (str) – track id

  • predominant_instrument (list) – Training tracks predominant instrument

  • train (bool) – flag to identify if the track is from the training of the testing dataset

  • genre (str) – string containing the namecode of the genre of the track.

  • drum (bool) – flag to identify if the track contains drums or not.

  • split (str) – data split (“train” or “test”)

Other Parameters

instrument (list) – list of predominant instruments as str

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio signal

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

the track’s data in jams format

Returns

jams.JAMS – return track data in jam format

mirdata.datasets.irmas.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a IRMAS dataset audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.irmas.load_pred_inst(fhandle: TextIO) List[str][source]

Load predominant instrument of track

Parameters

fhandle (str or file-like) – File-like object or path where the test annotations are stored.

Returns

list(str) – test track predominant instrument(s) annotations

mtg_jamendo_autotagging_moodtheme

MTG jamendo autotagging moodtheme Dataset Loader

class mirdata.datasets.mtg_jamendo_autotagging_moodtheme.Dataset(data_home=None, version='default')[source]

The MTG jamendo autotagging moodtheme dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_ids_for_split(split_number)[source]

Load a MTG jamendo autotagging moodtheme pre-defined split. There are five different train/validation/tests splits. :Parameters: split_number (int) – split to be retrieved from 0 to 4

Returns

** dict* – {“train”: […], “validation”: […], “test”: […]} - the train split

Deprecated since version 0.3.6: Use mirdata.datasets.mtg_jamendo_autotagging_moodtheme.get_track _splits

get_track_splits(split_number=0)[source]

Get predetermined track splits released alongside this dataset

Parameters

split_number (int) – which split split_number to use (0, 1, 2, 3 or 4)

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.mtg_jamendo_autotagging_moodtheme.load_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.mtg_jamendo_autotagging_moodtheme.Track(track_id, data_home, dataset_name, index, metadata)[source]

MTG jamendo autotagging moodtheme Track class

Parameters

track_id (str) – track id of the track (JAMENDO track id)

Variables

audio_path (str) – Path to the audio file

Other Parameters
  • artist_id (str) – JAMENDO artist id

  • album_id (str) – JAMENDO album id

  • duration (float) – track duration

  • tags (str) – autotagging moodtheme annotations

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

mirdata.datasets.mtg_jamendo_autotagging_moodtheme.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a MTG jamendo autotagging moodtheme audio file.

Parameters

fhandle (str or file-like) – path or file-like object pointing to an audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

maestro

MAESTRO Dataset Loader

class mirdata.datasets.maestro.Dataset(data_home=None, version='default')[source]

The maestro dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False)[source]

Download the dataset

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.maestro.load_audio

load_midi(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.io.load_midi

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_notes(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.io.load_notes_from_midi

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.maestro.Track(track_id, data_home, dataset_name, index, metadata)[source]

MAESTRO Track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – Path to the track’s audio file

  • canonical_composer (str) – Composer of the piece, standardized on a single spelling for a given name.

  • canonical_title (str) – Title of the piece. Not guaranteed to be standardized to a single representation.

  • duration (float) – Duration in seconds, based on the MIDI file.

  • midi_path (str) – Path to the track’s MIDI file

  • split (str) – Suggested train/validation/test split.

  • track_id (str) – track id

  • year (int) – Year of performance.

Cached Property:

midi (pretty_midi.PrettyMIDI): object containing MIDI annotations notes (NoteData): annotated piano notes

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.maestro.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a MAESTRO audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

medley_solos_db

Medley-solos-DB Dataset Loader.

class mirdata.datasets.medley_solos_db.Dataset(data_home=None, version='default')[source]

The medley_solos_db dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.medley_solos_db.load_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.medley_solos_db.Track(track_id, data_home, dataset_name, index, metadata)[source]

medley_solos_db Track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – path to the track’s audio file

  • instrument (str) – instrument encoded by its English name

  • instrument_id (int) – instrument encoded as an integer

  • song_id (int) – song encoded as an integer

  • subset (str) – either equal to ‘train’, ‘validation’, or ‘test’

  • track_id (str) – track id

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.medley_solos_db.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Medley Solos DB audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

medleydb_melody

MedleyDB melody Dataset Loader

class mirdata.datasets.medleydb_melody.Dataset(data_home=None, version='default')[source]

The medleydb_melody dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.medleydb_melody.load_audio

load_melody(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.medleydb_melody.load_melody

load_melody3(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.medleydb_melody.load_melody3

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.medleydb_melody.Track(track_id, data_home, dataset_name, index, metadata)[source]

medleydb_melody Track class

Parameters

track_id (str) – track id of the track

Variables
  • artist (str) – artist

  • audio_path (str) – path to the audio file

  • genre (str) – genre

  • is_excerpt (bool) – True if the track is an excerpt

  • is_instrumental (bool) – True of the track does not contain vocals

  • melody1_path (str) – path to the melody1 annotation file

  • melody2_path (str) – path to the melody2 annotation file

  • melody3_path (str) – path to the melody3 annotation file

  • n_sources (int) – Number of instruments in the track

  • title (str) – title

  • track_id (str) – track id

Other Parameters
  • melody1 (F0Data) – the pitch of the single most predominant source (often the voice)

  • melody2 (F0Data) – the pitch of the predominant source for each point in time

  • melody3 (MultiF0Data) – the pitch of any melodic source. Allows for more than one f0 value at a time

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.medleydb_melody.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a MedleyDB audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.medleydb_melody.load_melody(fhandle: TextIO) mirdata.annotations.F0Data[source]

Load a MedleyDB melody1 or melody2 annotation file

Parameters

fhandle (str or file-like) – File-like object or path to a melody annotation file

Raises

IOError – if melody_path does not exist

Returns

F0Data – melody data

mirdata.datasets.medleydb_melody.load_melody3(fhandle: TextIO) mirdata.annotations.MultiF0Data[source]

Load a MedleyDB melody3 annotation file

Parameters

fhandle (str or file-like) – File-like object or melody 3 melody annotation path

Raises

IOError – if melody_path does not exist

Returns

MultiF0Data – melody 3 annotation data

medleydb_pitch

MedleyDB pitch Dataset Loader

class mirdata.datasets.medleydb_pitch.Dataset(data_home=None, version='default')[source]

The medleydb_pitch dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.medleydb_pitch.load_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_notes(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.medleydb_pitch.load_notes

load_pitch(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.medleydb_pitch.load_pitch

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.medleydb_pitch.Track(track_id, data_home, dataset_name, index, metadata)[source]

medleydb_pitch Track class

Parameters

track_id (str) – track id of the track

Variables
  • artist (str) – artist

  • audio_path (str) – path to the audio file

  • genre (str) – genre

  • instrument (str) – instrument of the track

  • notes_pyin_path (str) – path to the pyin note annotation file

  • pitch_path (str) – path to the pitch annotation file

  • title (str) – title

  • track_id (str) – track id

Other Parameters
  • pitch (F0Data) – human annotated pitch

  • notes_pyin (NoteData) – notes estimated by the pyin algorithm. Not available in version 2.0

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.medleydb_pitch.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a MedleyDB audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.medleydb_pitch.load_notes(fhandle: TextIO) Optional[mirdata.annotations.NoteData][source]

load a note annotation file

Parameters

fhandle (str or file-like) – str or file-like to note annotation file

Raises

IOError – if file doesn’t exist

Returns

NoteData – note annotation

mirdata.datasets.medleydb_pitch.load_pitch(fhandle: TextIO) mirdata.annotations.F0Data[source]

load a MedleyDB pitch annotation file

Parameters

fhandle (str or file-like) – str or file-like to pitch annotation file

Raises

IOError – if the path doesn’t exist

Returns

F0Data – pitch annotation

mridangam_stroke

Mridangam Stroke Dataset Loader

class mirdata.datasets.mridangam_stroke.Dataset(data_home=None, version='default')[source]

The mridangam_stroke dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.mridangam_stroke.load_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.mridangam_stroke.Track(track_id, data_home, dataset_name, index, metadata)[source]

Mridangam Stroke track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored.

Variables
  • track_id (str) – track id

  • audio_path (str) – audio path

  • stroke_name (str) – name of the Mridangam stroke present in Track

  • tonic (str) – tonic of the stroke in the Track

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.mridangam_stroke.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Mridangam Stroke Dataset audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

orchset

ORCHSET Dataset Loader

class mirdata.datasets.orchset.Dataset(data_home=None, version='default')[source]

The orchset dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio_mono(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.orchset.load_audio_mono

load_audio_stereo(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.orchset.load_audio_stereo

load_melody(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.orchset.load_melody

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.orchset.Track(track_id, data_home, dataset_name, index, metadata)[source]

orchset Track class

Parameters

track_id (str) – track id of the track

Variables
  • alternating_melody (bool) – True if the melody alternates between instruments

  • audio_path_mono (str) – path to the mono audio file

  • audio_path_stereo (str) – path to the stereo audio file

  • composer (str) – the work’s composer

  • contains_brass (bool) – True if the track contains any brass instrument

  • contains_strings (bool) – True if the track contains any string instrument

  • contains_winds (bool) – True if the track contains any wind instrument

  • excerpt (str) – True if the track is an excerpt

  • melody_path (str) – path to the melody annotation file

  • only_brass (bool) – True if the track contains brass instruments only

  • only_strings (bool) – True if the track contains string instruments only

  • only_winds (bool) – True if the track contains wind instruments only

  • predominant_melodic_instruments (list) – List of instruments which play the melody

  • track_id (str) – track id

  • work (str) – The musical work

Other Parameters

melody (F0Data) – melody annotation

property audio_mono: Optional[Tuple[numpy.ndarray, float]]

the track’s audio (mono)

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

property audio_stereo: Optional[Tuple[numpy.ndarray, float]]

the track’s audio (stereo)

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.orchset.load_audio_mono(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load an Orchset audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.orchset.load_audio_stereo(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load an Orchset audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the stereo audio signal

  • float - The sample rate of the audio file

mirdata.datasets.orchset.load_melody(fhandle: TextIO) mirdata.annotations.F0Data[source]

Load an Orchset melody annotation file

Parameters

fhandle (str or file-like) – File-like object or path to melody annotation file

Raises

IOError – if melody_path doesn’t exist

Returns

F0Data – melody annotation data

phenicx_anechoic

PHENICX-Anechoic Dataset Loader

class mirdata.datasets.phenicx_anechoic.Dataset(data_home=None, version='default')[source]

The Phenicx-Anechoic dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.phenicx_anechoic.load_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_score(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.phenicx_anechoic.load_score

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.phenicx_anechoic.MultiTrack(mtrack_id, data_home, dataset_name, index, track_class, metadata)[source]

Phenicx-Anechoic MultiTrack class

Parameters
  • mtrack_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. If None, looks for the data in the default directory, ~/mir_datasets/Phenicx-Anechoic

Variables
  • track_audio_property (str) – the attribute of track which is used for mixing

  • mtrack_id (str) – multitrack id

  • piece (str) – the classical music piece associated with this multitrack

  • tracks (dict) – dict of track ids and the corresponding Tracks

  • instruments (dict) – dict of instruments and the corresponding track

  • sections (dict) – dict of sections and the corresponding list of tracks for each section

get_audio_for_instrument(instrument)[source]

Get the audio for a particular instrument

Parameters

instrument (str) – the instrument to get audio for

Returns

np.ndarray – instrument audio with shape (n_samples, n_channels)

get_audio_for_section(section)[source]

Get the audio for a particular section

Parameters

section (str) – the section to get audio for

Returns

np.ndarray – section audio with shape (n_samples, n_channels)

get_mix()[source]

Create a linear mixture given a subset of tracks.

Parameters

track_keys (list) – list of track keys to mix together

Returns

np.ndarray – mixture audio with shape (n_samples, n_channels)

get_notes_for_instrument(instrument, notes_property='notes')[source]

Get the notes for a particular instrument

Parameters
  • instrument (str) – the instrument to get the notes for

  • notes_property (str) – the attribute associated with NoteData, notes or notes_original

Returns

NoteData – Note data for the instrument

get_notes_for_section(section, notes_property='notes')[source]

Get the notes for a particular section

Parameters
  • section (str) – the section to get the notes for

  • notes_property (str) – the attribute associated with NoteData, notes or notes_original

Returns

NoteData – Note data for the section

get_notes_target(track_keys, notes_property='notes')[source]

Get the notes for all the tracks

Parameters
  • track_keys (list) – list of track keys to get the NoteData for

  • notes_property (str) – the attribute associated with NoteData, notes or notes_original

Returns

NoteData – Note data for the tracks

get_path(key)[source]

Get absolute path to multitrack audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

get_random_target(n_tracks=None, min_weight=0.3, max_weight=1.0)[source]

Get a random target by combining a random selection of tracks with random weights

Parameters
  • n_tracks (int or None) – number of tracks to randomly mix. If None, uses all tracks

  • min_weight (float) – minimum possible weight when mixing

  • max_weight (float) – maximum possible weight when mixing

Returns

  • np.ndarray - mixture audio with shape (n_samples, n_channels)

  • list - list of keys of included tracks

  • list - list of weights used to mix tracks

get_target(track_keys, weights=None, average=True, enforce_length=True)[source]

Get target which is a linear mixture of tracks

Parameters
  • track_keys (list) – list of track keys to mix together

  • weights (list or None) – list of positive scalars to be used in the average

  • average (bool) – if True, computes a weighted average of the tracks if False, computes a weighted sum of the tracks

  • enforce_length (bool) – If True, raises ValueError if the tracks are not the same length. If False, pads audio with zeros to match the length of the longest track

Returns

np.ndarray – target audio with shape (n_channels, n_samples)

Raises

ValueError – if sample rates of the tracks are not equal if enforce_length=True and lengths are not equal

class mirdata.datasets.phenicx_anechoic.Track(track_id, data_home, dataset_name, index, metadata)[source]

Phenicx-Anechoic Track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (list) – path to the audio files

  • notes_path (list) – path to the score files

  • notes_original_path (list) – path to the original score files

  • instrument (str) – the name of the instrument

  • piece (str) – the name of the piece

  • n_voices (int) – the number of voices in this instrument

  • track_id (str) – track id

Other Parameters
  • notes (NoteData) – notes annotations that have been time-aligned to the audio

  • notes_original (NoteData) – original score representation, not time-aligned

property audio: Optional[Tuple[numpy.ndarray, float]]

the track’s audio

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

get_audio_voice(id_voice: int) Optional[Tuple[numpy.ndarray, float]][source]

the track’s audio

Parameters

id_voice (int) – The integer identifier for the voice e.g. 2 for bassoon-2

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

notes

the track’s notes corresponding to the score aligned to the audio

Returns

NoteData – Note data for the track

notes_original

the track’s notes corresponding to the original score

Returns

NoteData – Note data for the track

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.phenicx_anechoic.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Phenicx-Anechoic audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the audio signal

  • float - The sample rate of the audio file

mirdata.datasets.phenicx_anechoic.load_score(fhandle: TextIO) mirdata.annotations.NoteData[source]

Load a Phenicx-Anechoic score file.

Parameters

fhandle (str or file-like) – File-like object or path to score file

Returns

NoteData – Note data for the given track

queen

Queen Dataset Loader

class mirdata.datasets.queen.Dataset(data_home=None, version='default')[source]

Queen dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.queen.load_audio

load_chords(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.queen.load_chords

load_key(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.queen.load_key

load_sections(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.queen.load_sections

class mirdata.datasets.queen.Track(track_id, data_home, dataset_name, index, metadata)[source]

Queen track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – track audio path

  • chords_path (str) – chord annotation path

  • keys_path (str) – key annotation path

  • sections_path (str) – sections annotation path

  • title (str) – title of the track

  • track_id (str) – track id

Other Parameters
  • chords (ChordData) – human-labeled chord annotations

  • key (KeyData) – local key annotations

  • sections (SectionData) – section annotations

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

to_jams()[source]

the track’s data in jams format

Returns

jams.JAMS – return track data in jam format

mirdata.datasets.queen.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Queen audio file.

Parameters

fhandle (str) – path to an audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.queen.load_chords(fhandle: TextIO) mirdata.annotations.ChordData[source]

Load Queen format chord data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to a chord file

Returns

(ChordData) – loaded chord data

mirdata.datasets.queen.load_key(fhandle: TextIO) mirdata.annotations.KeyData[source]

Load Queen format key data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to a key file

Returns

(KeyData) – loaded key data

mirdata.datasets.queen.load_sections(fhandle: TextIO) mirdata.annotations.SectionData[source]

Load Queen format section data from a file

Parameters

fhandle (str or file-like) – path or file-like object pointing to a section file

Returns

(SectionData) – loaded section data

rwc_classical

RWC Classical Dataset Loader

class mirdata.datasets.rwc_classical.Dataset(data_home=None, version='default')[source]

The rwc_classical dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.rwc_classical.load_audio

load_beats(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.rwc_classical.load_beats

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_sections(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.rwc_classical.load_sections

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.rwc_classical.Track(track_id, data_home, dataset_name, index, metadata)[source]

rwc_classical Track class

Parameters

track_id (str) – track id of the track

Variables
  • artist (str) – the track’s artist

  • audio_path (str) – path of the audio file

  • beats_path (str) – path of the beat annotation file

  • category (str) – One of ‘Symphony’, ‘Concerto’, ‘Orchestral’, ‘Solo’, ‘Chamber’, ‘Vocal’, or blank.

  • composer (str) – Composer of this Track.

  • duration (float) – Duration of the track in seconds

  • piece_number (str) – Piece number of this Track, [1-50]

  • sections_path (str) – path of the section annotation file

  • suffix (str) – string within M01-M06

  • title (str) – Title of The track.

  • track_id (str) – track id

  • track_number (str) – CD track number of this Track

Other Parameters
  • sections (SectionData) – human-labeled section annotations

  • beats (BeatData) – human-labeled beat annotations

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.rwc_classical.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a RWC audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.rwc_classical.load_beats(fhandle: TextIO) mirdata.annotations.BeatData[source]

Load rwc beat data from a file

Parameters

fhandle (str or file-like) – File-like object or path to beats annotation file

Returns

BeatData – beat data

mirdata.datasets.rwc_classical.load_sections(fhandle: TextIO) Optional[mirdata.annotations.SectionData][source]

Load rwc section data from a file

Parameters

fhandle (str or file-like) – File-like object or path to sections annotation file

Returns

SectionData – section data

rwc_jazz

RWC Jazz Dataset Loader.

class mirdata.datasets.rwc_jazz.Dataset(data_home=None, version='default')[source]

The rwc_jazz dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.rwc_jazz.load_audio

load_beats(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.rwc_jazz.load_beats

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_sections(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.rwc_jazz.load_sections

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.rwc_jazz.Track(track_id, data_home, dataset_name, index, metadata)[source]

rwc_jazz Track class

Parameters

track_id (str) – track id of the track

Variables
  • artist (str) – Artist name

  • audio_path (str) – path of the audio file

  • beats_path (str) – path of the beat annotation file

  • duration (float) – Duration of the track in seconds

  • instruments (str) – list of used instruments.

  • piece_number (str) – Piece number of this Track, [1-50]

  • sections_path (str) – path of the section annotation file

  • suffix (str) – M01-M04

  • title (str) – Title of The track.

  • track_id (str) – track id

  • track_number (str) – CD track number of this Track

  • variation (str) – style variations

Other Parameters
  • sections (SectionData) – human-labeled section data

  • beats (BeatData) – human-labeled beat data

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

salami

SALAMI Dataset Loader

class mirdata.datasets.salami.Dataset(data_home=None, version='default')[source]

The salami dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.salami.load_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_sections(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.salami.load_sections

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.salami.Track(track_id, data_home, dataset_name, index, metadata)[source]

salami Track class

Parameters

track_id (str) – track id of the track

Variables
  • annotator_1_id (str) – number that identifies annotator 1

  • annotator_1_time (str) – time that the annotator 1 took to complete the annotation

  • annotator_2_id (str) – number that identifies annotator 1

  • annotator_2_time (str) – time that the annotator 1 took to complete the annotation

  • artist (str) – song artist

  • audio_path (str) – path to the audio file

  • broad_genre (str) – broad genre of the song

  • duration (float) – duration of song in seconds

  • genre (str) – genre of the song

  • sections_annotator1_lowercase_path (str) – path to annotations in hierarchy level 1 from annotator 1

  • sections_annotator1_uppercase_path (str) – path to annotations in hierarchy level 0 from annotator 1

  • sections_annotator2_lowercase_path (str) – path to annotations in hierarchy level 1 from annotator 2

  • sections_annotator2_uppercase_path (str) – path to annotations in hierarchy level 0 from annotator 2

  • source (str) – dataset or source of song

  • title (str) – title of the song

Other Parameters
  • sections_annotator_1_uppercase (SectionData) – annotations in hierarchy level 0 from annotator 1

  • sections_annotator_1_lowercase (SectionData) – annotations in hierarchy level 1 from annotator 1

  • sections_annotator_2_uppercase (SectionData) – annotations in hierarchy level 0 from annotator 2

  • sections_annotator_2_lowercase (SectionData) – annotations in hierarchy level 1 from annotator 2

property audio: Tuple[numpy.ndarray, float]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.salami.load_audio(fpath: str) Tuple[numpy.ndarray, float][source]

Load a Salami audio file.

Parameters

fpath (str) – path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.salami.load_sections(fhandle: TextIO) mirdata.annotations.SectionData[source]

Load salami sections data from a file

Parameters

fhandle (str or file-like) – File-like object or path to section annotation file

Returns

SectionData – section data

saraga_carnatic

Saraga Dataset Loader

class mirdata.datasets.saraga_carnatic.Dataset(data_home=None, version='default')[source]

The saraga_carnatic dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_carnatic.load_audio

load_metadata(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_carnatic.load_metadata

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_phrases(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_carnatic.load_phrases

load_pitch(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_carnatic.load_pitch

load_sama(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_carnatic.load_sama

load_sections(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_carnatic.load_sections

load_tempo(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_carnatic.load_tempo

load_tonic(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_carnatic.load_tonic

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.saraga_carnatic.Track(track_id, data_home, dataset_name, index, metadata)[source]

Saraga Track Carnatic class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. default=None If None, looks for the data in the default directory, ~/mir_datasets

Variables
  • audio_path (str) – path to audio file

  • audio_ghatam_path (str) – path to ghatam audio file

  • audio_mridangam_left_path (str) – path to mridangam left audio file

  • audio_mridangam_right_path (str) – path to mridangam right audio file

  • audio_violin_path (str) – path to violin audio file

  • audio_vocal_s_path (str) – path to vocal s audio file

  • audio_vocal_pat (str) – path to vocal pat audio file

  • ctonic_path (srt) – path to ctonic annotation file

  • pitch_path (srt) – path to pitch annotation file

  • pitch_vocal_path (srt) – path to vocal pitch annotation file

  • tempo_path (srt) – path to tempo annotation file

  • sama_path (srt) – path to sama annotation file

  • sections_path (srt) – path to sections annotation file

  • phrases_path (srt) – path to phrases annotation file

  • metadata_path (srt) – path to metadata file

Other Parameters
  • tonic (float) – tonic annotation

  • pitch (F0Data) – pitch annotation

  • pitch_vocal (F0Data) – vocal pitch annotation

  • tempo (dict) – tempo annotations

  • sama (BeatData) – sama section annotations

  • sections (SectionData) – track section annotations

  • phrases (SectionData) – phrase annotations

  • metadata (dict) – track metadata with the following fields:

    • title (str): Title of the piece in the track

    • mbid (str): MusicBrainz ID of the track

    • album_artists (list, dicts): list of dicts containing the album artists present in the track and its mbid

    • artists (list, dicts): list of dicts containing information of the featuring artists in the track

    • raaga (list, dict): list of dicts containing information about the raagas present in the track

    • form (list, dict): list of dicts containing information about the forms present in the track

    • work (list, dicts): list of dicts containing the work present in the piece, and its mbid

    • taala (list, dicts): list of dicts containing the talas present in the track and its uuid

    • concert (list, dicts): list of dicts containing the concert where the track is present and its mbid

property audio

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.saraga_carnatic.load_audio(audio_path)[source]

Load a Saraga Carnatic audio file.

Parameters

audio_path (str) – path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.saraga_carnatic.load_metadata(fhandle)[source]

Load a Saraga Carnatic metadata file

Parameters

fhandle (str or file-like) – File-like object or path to metadata json

Returns

dict

metadata with the following fields

  • title (str): Title of the piece in the track

  • mbid (str): MusicBrainz ID of the track

  • album_artists (list, dicts): list of dicts containing the album artists present in the track and its mbid

  • artists (list, dicts): list of dicts containing information of the featuring artists in the track

  • raaga (list, dict): list of dicts containing information about the raagas present in the track

  • form (list, dict): list of dicts containing information about the forms present in the track

  • work (list, dicts): list of dicts containing the work present in the piece, and its mbid

  • taala (list, dicts): list of dicts containing the talas present in the track and its uuid

  • concert (list, dicts): list of dicts containing the concert where the track is present and its mbid

mirdata.datasets.saraga_carnatic.load_phrases(fhandle)[source]

Load phrases

Parameters

fhandle (str or file-like) – Local path where the phrase annotation is stored.

Returns

EventData – phrases annotation for track

mirdata.datasets.saraga_carnatic.load_pitch(fhandle)[source]

Load pitch

Parameters

fhandle (str or file-like) – Local path where the pitch annotation is stored.

Returns

F0Data – pitch annotation

mirdata.datasets.saraga_carnatic.load_sama(fhandle)[source]

Load sama

Parameters

fhandle (str or file-like) – Local path where the sama annotation is stored.

Returns

BeatData – sama annotations

mirdata.datasets.saraga_carnatic.load_sections(fhandle)[source]

Load sections from carnatic collection

Parameters

fhandle (str or file-like) – Local path where the section annotation is stored.

Returns

SectionData – section annotations for track

mirdata.datasets.saraga_carnatic.load_tempo(fhandle)[source]

Load tempo from carnatic collection

Parameters

fhandle (str or file-like) – Local path where the tempo annotation is stored.

Returns

dict

Dictionary of tempo information with the following keys:

  • tempo_apm: tempo in aksharas per minute (APM)

  • tempo_bpm: tempo in beats per minute (BPM)

  • sama_interval: median duration (in seconds) of one tāla cycle

  • beats_per_cycle: number of beats in one cycle of the tāla

  • subdivisions: number of aksharas per beat of the tāla

mirdata.datasets.saraga_carnatic.load_tonic(fhandle)[source]

Load track absolute tonic

Parameters

fhandle (str or file-like) – Local path where the tonic path is stored.

Returns

int – Tonic annotation in Hz

saraga_hindustani

Saraga Dataset Loader

class mirdata.datasets.saraga_hindustani.Dataset(data_home=None, version='default')[source]

The saraga_hindustani dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_hindustani.load_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_phrases(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_hindustani.load_phrases

load_pitch(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_hindustani.load_pitch

load_sama(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_hindustani.load_sama

load_sections(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_hindustani.load_sections

load_tempo(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_hindustani.load_tempo

load_tonic(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.saraga_hindustani.load_tonic

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.saraga_hindustani.Track(track_id, data_home, dataset_name, index, metadata)[source]

Saraga Hindustani Track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. default=None If None, looks for the data in the default directory, ~/mir_datasets

Variables
  • audio_path (str) – path to audio file

  • ctonic_path (str) – path to ctonic annotation file

  • pitch_path (str) – path to pitch annotation file

  • tempo_path (str) – path to tempo annotation file

  • sama_path (str) – path to sama annotation file

  • sections_path (str) – path to sections annotation file

  • phrases_path (str) – path to phrases annotation file

  • metadata_path (str) – path to metadata annotation file

Other Parameters
  • tonic (float) – tonic annotation

  • pitch (F0Data) – pitch annotation

  • tempo (dict) – tempo annotations

  • sama (BeatData) – Sama section annotations

  • sections (SectionData) – track section annotations

  • phrases (EventData) – phrase annotations

  • metadata (dict) – track metadata with the following fields

    • title (str): Title of the piece in the track

    • mbid (str): MusicBrainz ID of the track

    • album_artists (list, dicts): list of dicts containing the album artists present in the track and its mbid

    • artists (list, dicts): list of dicts containing information of the featuring artists in the track

    • raags (list, dict): list of dicts containing information about the raags present in the track

    • forms (list, dict): list of dicts containing information about the forms present in the track

    • release (list, dicts): list of dicts containing information of the release where the track is found

    • works (list, dicts): list of dicts containing the work present in the piece, and its mbid

    • taals (list, dicts): list of dicts containing the taals present in the track and its uuid

    • layas (list, dicts): list of dicts containing the layas present in the track and its uuid

property audio

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.saraga_hindustani.load_audio(audio_path)[source]

Load a Saraga Hindustani audio file.

Parameters

audio_path (str) – path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.saraga_hindustani.load_metadata(fhandle)[source]

Load a Saraga Hindustani metadata file

Parameters

fhandle (str or file-like) – path to metadata json file

Returns

dict

metadata with the following fields

  • title (str): Title of the piece in the track

  • mbid (str): MusicBrainz ID of the track

  • album_artists (list, dicts): list of dicts containing the album artists present in the track and its mbid

  • artists (list, dicts): list of dicts containing information of the featuring artists in the track

  • raags (list, dict): list of dicts containing information about the raags present in the track

  • forms (list, dict): list of dicts containing information about the forms present in the track

  • release (list, dicts): list of dicts containing information of the release where the track is found

  • works (list, dicts): list of dicts containing the work present in the piece, and its mbid

  • taals (list, dicts): list of dicts containing the taals present in the track and its uuid

  • layas (list, dicts): list of dicts containing the layas present in the track and its uuid

mirdata.datasets.saraga_hindustani.load_phrases(fhandle)[source]

Load phrases

Parameters

fhandle (str or file-like) – Local path where the phrase annotation is stored. If None, returns None.

Returns

EventData – phrases annotation for track

mirdata.datasets.saraga_hindustani.load_pitch(fhandle)[source]

Load automatic extracted pitch or melody

Parameters

fhandle (str or file-like) – Local path where the pitch annotation is stored. If None, returns None.

Returns

F0Data – pitch annotation

mirdata.datasets.saraga_hindustani.load_sama(fhandle)[source]

Load sama

Parameters

fhandle (str or file-like) – Local path where the sama annotation is stored. If None, returns None.

Returns

SectionData – sama annotations

mirdata.datasets.saraga_hindustani.load_sections(fhandle)[source]

Load tracks sections

Parameters

fhandle (str or file-like) – Local path where the section annotation is stored.

Returns

SectionData – section annotations for track

mirdata.datasets.saraga_hindustani.load_tempo(fhandle)[source]

Load tempo from hindustani collection

Parameters

fhandle (str or file-like) – Local path where the tempo annotation is stored.

Returns

dict – Dictionary of tempo information with the following keys:

  • tempo: median tempo for the section in mātrās per minute (MPM)

  • matra_interval: tempo expressed as the duration of the mātra (essentially dividing 60 by tempo, expressed in seconds)

  • sama_interval: median duration of one tāl cycle in the section

  • matras_per_cycle: indicator of the structure of the tāl, showing the number of mātrā in a cycle of the tāl of the recording

  • start_time: start time of the section

  • duration: duration of the section

mirdata.datasets.saraga_hindustani.load_tonic(fhandle)[source]

Load track absolute tonic

Parameters

fhandle (str or file-like) – Local path where the tonic path is stored. If None, returns None.

Returns

int – Tonic annotation in Hz

scms

Saraga-Carnatic-Melody-Synth loader

class mirdata.datasets.scms.Dataset(data_home=None, version='default')[source]

The Saraga-Carnatic-Melody-Synth dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.scms.Track(track_id, data_home, dataset_name, index, metadata)[source]

Saraga-Carnatic-Melody-Synth Track class

Parameters

track_id (str) – track id of the track

Variables
  • artist (str) – artist

  • audio_path (str) – path to the audio file

  • pitch_path (str) – path to the pitch annotation file

  • activations_path (str) – path to the vocal activation annotation file

  • tonic (str) – tonic of the recording

  • gender (str) – gender

  • artist – instrument of the track

  • title (str) – title

  • train (bool) – indicating if the track belongs to the train or testing set

  • track_id (str) – track id

Other Parameters
  • pitch (F0Data) – vocal pitch time-series

  • activations (EventData) – time regions where the singing voice is present and active

property audio: Optional[Tuple[numpy.ndarray, float]]

The track”s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track”s data in jams format

Returns

jams.JAMS – the track”s data in jams format

mirdata.datasets.scms.load_activations(fhandle: TextIO) Optional[mirdata.annotations.EventData][source]

load a Saraga-Carnatic-Melody-Synth activation annotation file

Parameters

fhandle (str or file-like) – str or file-like to note annotation file

Raises

IOError – if file doesn”t exist

Returns

EventData – vocal activations

mirdata.datasets.scms.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Saraga-Carnatic-Melody-Synth audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.scms.load_pitch(fhandle: TextIO) mirdata.annotations.F0Data[source]

load a Saraga-Carnatic-Melody-Synth pitch annotation file

Parameters

fhandle (str or file-like) – str or file-like to pitch annotation file

Raises

IOError – if the path doesn”t exist

Returns

F0Data – pitch annotation

slakh

slakh Dataset Loader

class mirdata.datasets.slakh.Dataset(data_home=None, version='default')[source]

The slakh dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.slakh.load_audio

load_midi(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.slakh.load_midi

load_multif0_from_midi(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.io.load_multif0_from_midi

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_notes_from_midi(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.io.load_notes_from_midi

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

mirdata.datasets.slakh.MIXING_GROUPS = {'bass': [32, 33, 34, 35, 36, 37, 38, 39], 'drums': [128], 'guitar': [24, 25, 26, 27, 28, 29, 30, 31], 'piano': [0, 1, 2, 3, 4, 5, 6, 7]}

Mixing group to program number mapping

class mirdata.datasets.slakh.MultiTrack(mtrack_id, data_home, dataset_name, index, track_class, metadata)[source]

slakh multitrack class, containing information about the mix and the set of associated stems

Variables
  • mtrack_id (str) – track id

  • tracks (dict) – {track_id: Track}

  • track_audio_property (str) – the name of the attribute of Track which returns the audio to be mixed

  • mix_path (str) – path to the multitrack mix audio

  • midi_path (str) – path to the full midi data used to generate the mixture

  • metadata_path (str) – path to the multitrack metadata file

  • split (str or None) – one of ‘train’, ‘validation’, ‘test’, or ‘omitted’. ‘omitted’ tracks are part of slakh2100-redux which were found to be duplicates in the original slakh2011.

  • data_split (str or None) – equivalent to split (deprecated in 0.3.6)

  • uuid (str) – File name of the original MIDI file from Lakh, sans extension

  • lakh_midi_dir (str) – Path to the original MIDI file from a fresh download of Lakh

  • normalized (bool) – whether the mix and stems were normalized according to the ITU-R BS.1770-4 spec

  • overall_gain (float) – gain applied to every stem to make sure mixture does not clip when stems are summed

Other Parameters
  • midi (PrettyMIDI) – midi data used to generate the mixture audio

  • notes (NoteData) – note representation of the midi data

  • multif0 (MultiF0Data) – multif0 representation of the midi data

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_mix()[source]

Create a linear mixture given a subset of tracks.

Parameters

track_keys (list) – list of track keys to mix together

Returns

np.ndarray – mixture audio with shape (n_samples, n_channels)

get_path(key)[source]

Get absolute path to multitrack audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

get_random_target(n_tracks=None, min_weight=0.3, max_weight=1.0)[source]

Get a random target by combining a random selection of tracks with random weights

Parameters
  • n_tracks (int or None) – number of tracks to randomly mix. If None, uses all tracks

  • min_weight (float) – minimum possible weight when mixing

  • max_weight (float) – maximum possible weight when mixing

Returns

  • np.ndarray - mixture audio with shape (n_samples, n_channels)

  • list - list of keys of included tracks

  • list - list of weights used to mix tracks

get_submix_by_group(target_groups)[source]

Create submixes grouped by instrument type. Creates one submix per target group, plus one additional “other” group for any remaining sources. Only tracks with available audio are mixed.

Parameters

target_groups (list) – List of target groups. Elements should be one of MIXING_GROUPS, e.g. [“bass”, “guitar”]

Returns

** submixes (dict)* – {group: audio_signal} of submixes * groups (dict): {group: list of track ids} of submixes

get_target(track_keys, weights=None, average=True, enforce_length=True)[source]

Get target which is a linear mixture of tracks

Parameters
  • track_keys (list) – list of track keys to mix together

  • weights (list or None) – list of positive scalars to be used in the average

  • average (bool) – if True, computes a weighted average of the tracks if False, computes a weighted sum of the tracks

  • enforce_length (bool) – If True, raises ValueError if the tracks are not the same length. If False, pads audio with zeros to match the length of the longest track

Returns

np.ndarray – target audio with shape (n_channels, n_samples)

Raises

ValueError – if sample rates of the tracks are not equal if enforce_length=True and lengths are not equal

to_jams()[source]

Jams: the track’s data in jams format

class mirdata.datasets.slakh.Track(track_id, data_home, dataset_name, index, metadata)[source]

slakh Track class, for individual stems

Variables
  • audio_path (str or None) – path to the track’s audio file. For some unusual tracks, such as sound effects, there is no audio and this attribute is None.

  • split (str or None) – one of ‘train’, ‘validation’, ‘test’, or ‘omitted’. ‘omitted’ tracks are part of slakh2100-redux which were found to be duplicates in the original slakh2011. In baby slakh there are no splits, so this attribute is None.

  • data_split (str or None) – equivalent to split (deprecated in 0.3.6)

  • metadata_path (str) – path to the multitrack’s metadata file

  • midi_path (str or None) – path to the track’s midi file. For some unusual tracks, such as sound effects, there is no midi and this attribute is None.

  • mtrack_id (str) – the track’s multitrack id

  • track_id (str) – track id

  • instrument (str) – MIDI instrument class, see link for details: https://en.wikipedia.org/wiki/General_MIDI#Program_change_events

  • integrated_loudness (float) – integrated loudness (dB) of this track as calculated by the ITU-R BS.1770-4 spec

  • is_drum (bool) – whether the “drum” flag is true for this MIDI track

  • midi_program_name (str) – MIDI instrument program name

  • plugin_name (str) – patch/plugin name that rendered the audio file

  • mixing_group (str) – which mixing group the track belongs to. One of MIXING_GROUPS.

  • program_number (int) – MIDI instrument program number

Other Parameters
  • midi (PrettyMIDI) – midi data used to generate the audio

  • notes (NoteData or None) – note representation of the midi data. If there are no notes in the midi file, returns None.

  • multif0 (MultiF0Data or None) – multif0 representaation of the midi data. If there are no notes in the midi file, returns None.

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Jams: the track’s data in jams format

mirdata.datasets.slakh.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a slakh audio file.

Parameters

fhandle (str or file-like) – path or file-like object pointing to an audio file

Returns

  • np.ndarray - the audio signal

  • float - The sample rate of the audio file

tinysol

TinySOL Dataset Loader.

class mirdata.datasets.tinysol.Dataset(data_home=None, version='default')[source]

The tinysol dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.tinysol.load_audio

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.tinysol.Track(track_id, data_home, dataset_name, index, metadata)[source]

tinysol Track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – path of the audio file

  • dynamics (str) – dynamics abbreviation. Ex: pp, mf, ff, etc.

  • dynamics_id (int) – pp=0, p=1, mf=2, f=3, ff=4

  • family (str) – instrument family encoded by its English name

  • instance_id (int) – instance ID. Either equal to 0, 1, 2, or 3.

  • instrument_abbr (str) – instrument abbreviation

  • instrument_full (str) – instrument encoded by its English name

  • is_resampled (bool) – True if this sample was pitch-shifted from a neighbor; False if it was genuinely recorded.

  • pitch (str) – string containing English pitch class and octave number

  • pitch_id (int) – MIDI note index, where middle C (“C4”) corresponds to 60

  • string_id (NoneType) – string ID. By musical convention, the first string is the highest. On wind instruments, this is replaced by None.

  • technique_abbr (str) – playing technique abbreviation

  • technique_full (str) – playing technique encoded by its English name

  • track_id (str) – track id

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.tinysol.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a TinySOL audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

tonality_classicaldb

Tonality classicalDB Dataset Loader

class mirdata.datasets.tonality_classicaldb.Dataset(data_home=None, version='default')[source]

The tonality_classicaldb dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.tonality_classicaldb.load_audio

load_hpcp(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.tonality_classicaldb.load_hpcp

load_key(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.tonality_classicaldb.load_key

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_musicbrainz(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.tonality_classicaldb.load_musicbrainz

load_spectrum(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.tonality_classicaldb.load_spectrum

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.tonality_classicaldb.Track(track_id, data_home, dataset_name, index, metadata)[source]

tonality_classicaldb track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – track audio path

  • key_path (str) – key annotation path

  • title (str) – title of the track

  • track_id (str) – track id

Other Parameters
  • key (str) – key annotation

  • spectrum (np.array) – computed audio spectrum

  • hpcp (np.array) – computed hpcp

  • musicbrainz_metadata (dict) – MusicBrainz metadata

property audio: Optional[Tuple[numpy.ndarray, float]]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.tonality_classicaldb.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Tonality classicalDB audio file.

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.tonality_classicaldb.load_hpcp(fhandle: TextIO) numpy.ndarray[source]

Load Tonality classicalDB HPCP feature from a file

Parameters

fhandle (str or file-like) – File-like object or path to HPCP file

Returns

np.ndarray – loaded HPCP data

mirdata.datasets.tonality_classicaldb.load_key(fhandle: TextIO) str[source]

Load Tonality classicalDB format key data from a file

Parameters

fhandle (str or file-like) – File-like object or path to key annotation file

Returns

str – musical key data

mirdata.datasets.tonality_classicaldb.load_musicbrainz(fhandle: TextIO) Dict[Any, Any][source]

Load Tonality classicalDB musicbraiz metadata from a file

Parameters

fhandle (str or file-like) – File-like object or path to musicbrainz metadata file

Returns

dict – musicbrainz metadata

mirdata.datasets.tonality_classicaldb.load_spectrum(fhandle: TextIO) numpy.ndarray[source]

Load Tonality classicalDB spectrum data from a file

Parameters

fhandle (str or file-like) – File-like object or path to spectrum file

Returns

np.ndarray – spectrum data

tonas

TONAS Loader

class mirdata.datasets.tonas.Dataset(data_home=None, version='default')[source]

The TONAS dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_audio(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.tonas.load_audio

load_f0(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.tonas.load_f0

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_notes(*args, **kwargs)[source]

Deprecated since version 0.3.4: Use mirdata.datasets.tonas.load_notes

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.tonas.Track(track_id, data_home, dataset_name, index, metadata)[source]

TONAS track class

Parameters
  • track_id (str) – track id of the track

  • data_home (str) – Local path where the dataset is stored. If None, looks for the data in the default directory, ~/mir_datasets/TONAS

Variables
  • f0_path (str) – local path where f0 melody annotation file is stored

  • notes_path (str) – local path where notation annotation file is stored

  • audio_path (str) – local path where audio file is stored

  • track_id (str) – track id

  • singer (str) – performing singer (cantaor)

  • title (str) – title of the track song

  • tuning_frequency (float) – tuning frequency of the symbolic notation

Other Parameters
  • f0_automatic (F0Data) – automatically extracted f0

  • f0_corrected (F0Data) – manually corrected f0 annotations

  • notes (NoteData) – annotated notes

property audio: Tuple[numpy.ndarray, float]

The track’s audio

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.tonas.load_audio(fhandle: str) Tuple[numpy.ndarray, float][source]

Load a TONAS audio file.

Parameters

fhandle (str) – path to an audio file

Returns

  • np.ndarray - the mono audio signal

  • float - The sample rate of the audio file

mirdata.datasets.tonas.load_f0(fpath: str, corrected: bool) Optional[mirdata.annotations.F0Data][source]

Load TONAS f0 annotations

Parameters
  • fpath (str) – path pointing to f0 annotation file

  • corrected (bool) – if True, loads manually corrected frequency values otherwise, loads automatically extracted frequency values

Returns

F0Data – predominant f0 melody

mirdata.datasets.tonas.load_notes(fhandle: TextIO) Optional[mirdata.annotations.NoteData][source]

Load TONAS note data from the annotation files

Parameters

fhandle (str or file-like) – path or file-like object pointing to a notes annotation file

Returns

NoteData – note annotations

vocadito

vocadito Dataset Loader

class mirdata.datasets.vocadito.Dataset(data_home=None, version='default')[source]

The vocadito dataset

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.datasets.vocadito.Track(track_id, data_home, dataset_name, index, metadata)[source]

vocadito Track class

Parameters

track_id (str) – track id of the track

Variables
  • audio_path (str) – path to the track’s audio file

  • f0_path (str) – path to the track’s f0 annotation file

  • lyrics_path (str) – path to the track’s lyric annotation file

  • notes_a1_path (str) – path to the track’s note annotation file for annotator A1

  • notes_a2_path (str) – path to the track’s note annotation file for annotator A2

  • track_id (str) – track id

  • singer_id (str) – singer id

  • average_pitch_midi (int) – Average pitch in midi, computed from the f0 annotation

  • language (str) – The track’s language. May contain multiple languages.

Other Parameters
  • f0 (F0Data) – human-annotated singing voice pitch

  • lyrics (List[List[str]]) – human-annotated lyrics

  • notes_a1 (NoteData) – human-annotated notes by annotator A1

  • notes_a2 (NoteData) – human-annotated notes by annotator A2

property audio: Optional[Tuple[numpy.ndarray, float]]

solo vocal audio (mono)

Returns

  • np.ndarray - audio signal

  • float - sample rate

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

to_jams()[source]

Get the track’s data in jams format

Returns

jams.JAMS – the track’s data in jams format

mirdata.datasets.vocadito.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load vocadito vocal audio

Parameters

fhandle (str or file-like) – File-like object or path to audio file

Returns

  • np.ndarray - audio signal

  • float - sample rate

mirdata.datasets.vocadito.load_f0(fhandle: TextIO) mirdata.annotations.F0Data[source]

Load a vocadito f0 annotation

Parameters

fhandle (str or file-like) – File-like object or path to f0 annotation file

Raises

IOError – If f0_path does not exist

Returns

F0Data – the f0 annotation data

mirdata.datasets.vocadito.load_lyrics(fhandle: TextIO) List[List[str]][source]

Load a lyrics annotation

Parameters

fhandle (str or file-like) – File-like object or path to lyric annotation file

Raises

IOError – if lyrics_path does not exist

Returns

LyricData – lyric annotation data

mirdata.datasets.vocadito.load_notes(fhandle: TextIO) Optional[mirdata.annotations.NoteData][source]

load a note annotation file

Parameters

fhandle (str or file-like) – str or file-like to note annotation file

Raises

IOError – if file doesn’t exist

Returns

NoteData – note annotation

Core

Core mirdata classes

class mirdata.core.Dataset(data_home=None, version='default', name=None, track_class=None, multitrack_class=None, bibtex=None, indexes=None, remotes=None, download_info=None, license_info=None)[source]

mirdata Dataset class

Variables
  • data_home (str) – path where mirdata will look for the dataset

  • version (str) –

  • name (str) – the identifier of the dataset

  • bibtex (str or None) – dataset citation/s in bibtex format

  • indexes (dict or None) –

  • remotes (dict or None) – data to be downloaded

  • readme (str) – information about the dataset

  • track (function) – a function mapping a track_id to a mirdata.core.Track

  • multitrack (function) – a function mapping a mtrack_id to a mirdata.core.Multitrack

__init__(data_home=None, version='default', name=None, track_class=None, multitrack_class=None, bibtex=None, indexes=None, remotes=None, download_info=None, license_info=None)[source]

Dataset init method

Parameters
  • data_home (str or None) – path where mirdata will look for the dataset

  • name (str or None) – the identifier of the dataset

  • track_class (mirdata.core.Track or None) – a Track class

  • multitrack_class (mirdata.core.Multitrack or None) – a Multitrack class

  • bibtex (str or None) – dataset citation/s in bibtex format

  • remotes (dict or None) – data to be downloaded

  • download_info (str or None) – download instructions or caveats

  • license_info (str or None) – license of the dataset

choice_multitrack()[source]

Choose a random multitrack

Returns

Multitrack – a Multitrack object instantiated by a random mtrack_id

choice_track()[source]

Choose a random track

Returns

Track – a Track object instantiated by a random track_id

cite()[source]

Print the reference

property default_path

Get the default path for the dataset

Returns

str – Local path to the dataset

download(partial_download=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally print a message.

Parameters
  • partial_download (list or None) – A list of keys of remotes to partially download. If None, all data is downloaded

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete any zip/tar files after extracting.

  • allow_invalid_checksum (bool) – Allow invalid checksums of the downloaded data. Useful sometimes behind some proxies that inspection the downloaded data. When having a different checksum promts a warn instead of raising an exception

Raises
  • ValueError – if invalid keys are passed to partial_download

  • IOError – if a downloaded file’s checksum is different from expected

get_mtrack_splits()[source]

Get predetermined multitrack splits (e.g. train/ test) released alongside this dataset.

Raises
  • AttributeError – If this dataset does not have multitracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of mtrack_ids

get_random_mtrack_splits(splits, seed=42, split_names=None)[source]

Split the multitracks into partitions, e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_random_track_splits(splits, seed=42, split_names=None)[source]

Split the tracks into partitions e.g. training, validation, test

Parameters
  • splits (list of float) – a list of floats that should sum up 1. It will return as many splits as elements in the list

  • seed (int) – the seed used for the random generator, in order to enhance reproducibility. Defaults to 42

  • split_names (list) – list of keys to use in the output dictionary

Returns

dict – a dictionary containing the elements in each split

get_track_splits()[source]

Get predetermined track splits (e.g. train/ test) released alongside this dataset

Raises
  • AttributeError – If this dataset does not have tracks

  • NotImplementedError – If this dataset does not have predetermined splits

Returns

dict – splits, keyed by split name and with values of lists of track_ids

license()[source]

Print the license

load_multitracks()[source]

Load all multitracks in the dataset

Returns

dict – {mtrack_id: multitrack data}

Raises

NotImplementedError – If the dataset does not support Multitracks

load_tracks()[source]

Load all tracks in the dataset

Returns

dict – {track_id: track data}

Raises

NotImplementedError – If the dataset does not support Tracks

mtrack_ids[source]

Return track ids

Returns

list – A list of track ids

track_ids[source]

Return track ids

Returns

list – A list of track ids

validate(verbose=True)[source]

Validate if the stored dataset is a valid version

Parameters

verbose (bool) – If False, don’t print output

Returns

  • list - files in the index but are missing locally

  • list - files which have an invalid checksum

class mirdata.core.Index(filename: str, url: Optional[str] = None, checksum: Optional[str] = None, partial_download: Optional[List[str]] = None)[source]

Class for storing information about dataset indexes.

Parameters
  • filename (str) – The index filename (not path), e.g. “example_dataset_index_1.2.json”

  • url (str or None) – None if index is not remote, or a url to download from

  • checksum (str or None) – None if index is not remote, or the md5 checksum of the file

  • partial_download (list or None) – if provided, specifies a subset of Dataset.remotes corresponding to this index to be downloaded. If None, all Dataset.remotes will be downloaded when calling Dataset.download()

Variables
  • remote (download_utils.RemoteFileMetadata or None) – None if index is not remote, or a RemoteFileMetadata object

  • partial_download (list or None) – a list of keys to partially download, or None

get_path(data_home: str) str[source]

Get the absolute path to the index file

Parameters

data_home (str) – Path where the dataset’s data lives

Returns

str – absolute path to the index file

class mirdata.core.MultiTrack(mtrack_id, data_home, dataset_name, index, track_class, metadata)[source]

MultiTrack class.

A multitrack class is a collection of track objects and their associated audio that can be mixed together. A multitrack is itself a Track, and can have its own associated audio (such as a mastered mix), its own metadata and its own annotations.

__init__(mtrack_id, data_home, dataset_name, index, track_class, metadata)[source]

Multitrack init method. Sets boilerplate attributes, including:

  • mtrack_id

  • _dataset_name

  • _data_home

  • _multitrack_paths

  • _multitrack_metadata

Parameters
  • mtrack_id (str) – multitrack id

  • data_home (str) – path where mirdata will look for the dataset

  • dataset_name (str) – the identifier of the dataset

  • index (dict) – the dataset’s file index

  • metadata (function or None) – a function returning a dictionary of metadata or None

get_mix()[source]

Create a linear mixture given a subset of tracks.

Parameters

track_keys (list) – list of track keys to mix together

Returns

np.ndarray – mixture audio with shape (n_samples, n_channels)

get_path(key)[source]

Get absolute path to multitrack audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

get_random_target(n_tracks=None, min_weight=0.3, max_weight=1.0)[source]

Get a random target by combining a random selection of tracks with random weights

Parameters
  • n_tracks (int or None) – number of tracks to randomly mix. If None, uses all tracks

  • min_weight (float) – minimum possible weight when mixing

  • max_weight (float) – maximum possible weight when mixing

Returns

  • np.ndarray - mixture audio with shape (n_samples, n_channels)

  • list - list of keys of included tracks

  • list - list of weights used to mix tracks

get_target(track_keys, weights=None, average=True, enforce_length=True)[source]

Get target which is a linear mixture of tracks

Parameters
  • track_keys (list) – list of track keys to mix together

  • weights (list or None) – list of positive scalars to be used in the average

  • average (bool) – if True, computes a weighted average of the tracks if False, computes a weighted sum of the tracks

  • enforce_length (bool) – If True, raises ValueError if the tracks are not the same length. If False, pads audio with zeros to match the length of the longest track

Returns

np.ndarray – target audio with shape (n_channels, n_samples)

Raises

ValueError – if sample rates of the tracks are not equal if enforce_length=True and lengths are not equal

class mirdata.core.Track(track_id, data_home, dataset_name, index, metadata)[source]

Track base class

See the docs for each dataset loader’s Track class for details

__init__(track_id, data_home, dataset_name, index, metadata)[source]

Track init method. Sets boilerplate attributes, including:

  • track_id

  • _dataset_name

  • _data_home

  • _track_paths

  • _track_metadata

Parameters
  • track_id (str) – track id

  • data_home (str) – path where mirdata will look for the dataset

  • dataset_name (str) – the identifier of the dataset

  • index (dict) – the dataset’s file index

  • metadata (function or None) – a function returning a dictionary of metadata or None

get_path(key)[source]

Get absolute path to track audio and annotations. Returns None if the path in the index is None

Parameters

key (string) – Index key of the audio or annotation type

Returns

str or None – joined path string or None

class mirdata.core.cached_property(func)[source]

Cached propery decorator

A property that is only computed once per instance and then replaces itself with an ordinary attribute. Deleting the attribute resets the property. Source: https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76

mirdata.core.docstring_inherit(parent)[source]

Decorator function to inherit docstrings from the parent class.

Adds documented Attributes from the parent to the child docs.

Annotations

mirdata annotation data types

mirdata.annotations.AMPLITUDE_UNITS = {'binary': '0 or 1', 'energy': 'energy value, measured as the sum of a squared signal', 'likelihood': 'score between 0 and 1', 'velocity': 'MIDI velocity between 0 and 127'}

Amplitude/voicing units

class mirdata.annotations.Annotation[source]

Annotation base class

mirdata.annotations.BEAT_POSITION_UNITS = {'bar_fraction': 'beat position as fractions of bars, e.g. 0.25', 'bar_index': 'beat index within a bar, 1-indexed', 'global_fraction': 'bar_frac, but where the integer part indicates the bar. e.g. 4.25', 'global_index': 'beat index within full track, 1-indexed'}

Beat position units

class mirdata.annotations.BeatData(times, time_unit, positions, position_unit, confidence=None, confidence_unit=None)[source]

BeatData class

Variables
  • times (np.ndarray) – array of time stamps with positive, strictly increasing values

  • time_unit (str) – time unit, one of TIME_UNITS

  • positions (np.ndarray) – array of beat positions in the format of position_unit. For all units, values of 0 indicate beats which fall outside of a measure.

  • position_unit (str) – beat position unit, one of BEAT_POSITION_UNITS

  • confidence (np.ndarray) – array of confidence values

  • confidence_unit (str) – confidence unit, one of AMPLITUDE_UNITS

mirdata.annotations.CHORD_UNITS = {'harte': 'chords in harte format, e.g. Ab:maj7', 'jams': "chords in jams 'chord' format", 'open': 'no strict schema or units'}

Chord units

class mirdata.annotations.ChordData(intervals, interval_unit, labels, label_unit, confidence=None, confidence_unit=None)[source]

ChordData class

Variables
  • intervals (np.ndarray) – (n x 2) array of intervals in the form [start_time, end_time]. Times should be positive and intervals should have non-negative duration

  • interval_unit (str) – unit of the time values in intervals. One of TIME_UNITS.

  • labels (list) – list chord labels (as strings)

  • label_unit (str) – chord label schema

  • confidence (np.ndarray or None) – array of confidence values

  • confidence_unit (str or None) – confidence unit, one of AMPLITUDE_UNITS

mirdata.annotations.EVENT_UNITS = {'open': 'no scrict schema or units'}

Event units

class mirdata.annotations.EventData(intervals, interval_unit, events, event_unit)[source]

EventData class

Variables
  • intervals (np.ndarray) – (n x 2) array of intervals in the form [start_time, end_time]. Times should be positive and intervals should have non-negative duration

  • interval_unit (str) – unit of the time values in intervals. One of TIME_UNITS.

  • interval_unit – interval units, one of TIME_UNITS

  • events (list) – list of event labels (as strings)

  • event_unit (str) – event units, one of EVENT_UNITS

class mirdata.annotations.F0Data(times, time_unit, frequencies, frequency_unit, voicing, voicing_unit, confidence=None, confidence_unit=None)[source]

F0Data class

Variables
  • times (np.ndarray) – array of time stamps (as floats) with positive, strictly increasing values

  • time_unit (str) – time unit, one of TIME_UNITS

  • frequencies (np.ndarray) – array of frequency values (as floats)

  • frequency_unit (str) – frequency unit, one of PITCH_UNITS

  • voicing (np.ndarray) – array of voicing values, indicating whether or not a time frame has an active pitch

  • voicing_unit (str) – voicing unit, one of VOICING_UNITS

  • confidence (np.ndarray or None) – array of confidence values

  • confidence_unit (str or None) – confidence unit, one of AMPLITUDE_UNITS

resample(times_new, times_new_unit)[source]

Resample the annotation to a new time scale. This function is adapted from: https://github.com/craffel/mir_eval/blob/master/mir_eval/melody.py#L212

Parameters
  • times_new (np.ndarray) – new time base, in units of times_new_unit

  • times_new_unit (str) – time unit, one of TIME_UNITS

Returns

F0Data – F0 data sampled at new time scale

to_matrix(time_scale, time_scale_unit, frequency_scale, frequency_scale_unit, amplitude_unit='binary')[source]

Convert f0 data to a matrix (piano roll) defined by a time and frequency scale

Parameters
  • time_scale (np.array) – times in units time_unit

  • time_scale_unit (str) – time scale units, one of TIME_UNITS

  • frequency_scale (np.array) – frequencies in frequency_unit

  • frequency_scale_unit (str) – frequency scale units, one of PITCH_UNITS

  • amplitude_unit (str) – amplitude units, one of AMPLITUDE_UNITS Defaults to “binary”.

Returns

np.ndarray – 2D matrix of shape len(time_scale) x len(frequency_scale)

to_mir_eval()[source]

Convert units and format to what is expected by mir_eval.melody.evaluate

Returns

  • times (np.ndarray) - uniformly spaced times in seconds

  • frequencies (np.ndarray) - frequency values in hz

  • voicing (np.ndarray) - voicings, as likelihood values

to_multif0()[source]

Convert annotation to multif0 format

Returns

MultiF0Data – data in multif0 format

to_sparse_index(time_scale, time_scale_unit, frequency_scale, frequency_scale_unit, amplitude_unit='binary')[source]

Convert F0 annotation to sparse matrix indices for a time-frequency matrix.

Parameters
  • time_scale (np.array) – times in units time_unit

  • time_scale_unit (str) – time scale units, one of TIME_UNITS

  • frequency_scale (np.array) – frequencies in frequency_unit

  • frequency_scale_unit (str) – frequency scale units, one of PITCH_UNITS

  • amplitude_unit (str) – amplitude units, one of AMPLITUDE_UNITS Defaults to “binary”.

Returns

** sparse_index (np.ndarray)* – Array of sparce indices [(time_index, frequency_index)] * amplitude (np.ndarray): Array of amplitude values for each index

mirdata.annotations.KEY_UNITS = {'key_mode': 'key labels in key-mode format, e.g. G#:minor'}

Key units

class mirdata.annotations.KeyData(intervals, interval_unit, keys, key_unit)[source]

KeyData class

Variables
  • intervals (np.ndarray) – (n x 2) array of intervals in the form [start_time, end_time]. Times should be positive and intervals should have non-negative duration

  • interval_unit (str) – unit of the time values in intervals. One of TIME_UNITS.

  • keys (list) – list key labels (as strings)

  • key_unit (str) – key unit, one of KEY_UNITS

mirdata.annotations.LYRIC_UNITS = {'pronunciations_open': 'lyric pronunciations, no strict schema', 'syllable_open': 'lyrics segmented by syllable, no strict schema', 'words': 'lyrics as words or phrases'}

Lyric units

class mirdata.annotations.LyricData(intervals, interval_unit, lyrics, lyric_unit)[source]

LyricData class

Variables
  • intervals (np.ndarray) – (n x 2) array of intervals in the form [start_time, end_time]. Times should be positive and intervals should have non-negative duration

  • interval_unit (str) – unit of the time values in intervals. One of TIME_UNITS.

  • lyrics (list) – list of lyrics (as strings)

  • lyric_unit (str) – lyric unit, one of LYRIC_UNITS

class mirdata.annotations.MultiF0Data(times, time_unit, frequency_list, frequency_unit, confidence_list=None, confidence_unit=None)[source]

MultiF0Data class

Variables
  • times (np.ndarray) – array of time stamps (as floats) with positive, strictly increasing values

  • time_unit (str) – time unit, one of TIME_UNITS

  • frequency_list (list) – list of lists of frequency values (as floats)

  • frequency_unit (str) – frequency unit, one of PITCH_UNITS

  • confidence_list (np.ndarray or None) – list of lists of confidence values

  • confidence_unit (str or None) – confidence unit, one of AMPLITUDE_UNITS

resample(times_new, times_new_unit)[source]

Resample annotation to a new time scale. This function is adapted from: https://github.com/craffel/mir_eval/blob/master/mir_eval/multipitch.py#L104

Parameters
  • times_new (np.array) – array of new time scale values

  • times_new_unit (str) – units for new time scale, one of TIME_UNITS

Returns

MultiF0Data – the resampled annotation

to_matrix(time_scale, time_scale_unit, frequency_scale, frequency_scale_unit, amplitude_unit='binary')[source]

Convert f0 data to a matrix (piano roll) defined by a time and frequency scale

Parameters
  • time_scale (np.array) – times in units time_unit

  • time_scale_unit (str) – time scale units, one of TIME_UNITS

  • frequency_scale (np.array) – frequencies in frequency_unit

  • frequency_scale_unit (str) – frequency scale units, one of PITCH_UNITS

  • amplitude_unit (str) – amplitude units, one of AMPLITUDE_UNITS Defaults to “binary”.

Returns

np.ndarray – 2D matrix of shape len(time_scale) x len(frequency_scale)

to_mir_eval()[source]

Convert annotation into the format expected by mir_eval.multipitch.evaluate

Returns

** times (np.ndarray)* – array of uniformly spaced time stamps in seconds * frequency_list (list): list of np.array of frequency values in Hz

to_sparse_index(time_scale, time_scale_unit, frequency_scale, frequency_scale_unit, amplitude_unit='binary')[source]

Convert MultiF0 annotation to sparse matrix indices for a time-frequency matrix.

Parameters
  • time_scale (np.array) – times in units time_unit

  • time_scale_unit (str) – time scale units, one of TIME_UNITS

  • frequency_scale (np.array) – frequencies in frequency_unit

  • frequency_scale_unit (str) – frequency scale units, one of PITCH_UNITS

  • amplitude_unit (str) – amplitude units, one of AMPLITUDE_UNITS Defaults to “binary”.

Returns

** sparse_index (np.ndarray)* – Array of sparce indices [(time_index, frequency_index)] * amplitude (np.ndarray): Array of amplitude values for each index

class mirdata.annotations.NoteData(intervals: numpy.ndarray, interval_unit: str, pitches: numpy.ndarray, pitch_unit: str, confidence: Optional[numpy.ndarray] = None, confidence_unit: Optional[str] = None)[source]

NoteData class

Variables
  • intervals (np.ndarray) – (n x 2) array of intervals in the form [start_time, end_time]. Times should be positive and intervals should have non-negative duration

  • interval_unit (str) – unit of the time values in intervals. One of TIME_UNITS.

  • pitches (np.ndarray) – array of pitches

  • pitch_unit (str) – note unit, one of PITCH_UNITS

  • confidence (np.ndarray or None) – array of confidence values

  • confidence_unit (str or None) – confidence unit, one of AMPLITUDE_UNITS

to_matrix(time_scale: numpy.ndarray, time_scale_unit: str, frequency_scale: numpy.ndarray, frequency_scale_unit: str, amplitude_unit: str = 'binary', onsets_only: bool = False) numpy.ndarray[source]

Convert f0 data to a matrix (piano roll) defined by a time and frequency scale

Parameters
  • time_scale (np.ndarray) – array of matrix time stamps in seconds

  • time_scale_unit (str) – units for time scale values, one of TIME_UNITS

  • frequency_scale (np.ndarray) – array of matrix frequency values in seconds

  • frequency_scale_unit (str) – units for frequency scale values, one of PITCH_UNITS

  • onsets_only (bool, optional) – If True, returns an onset piano roll. Defaults to False.

Returns

np.ndarray – 2D matrix of shape len(time_scale) x len(frequency_scale)

to_mir_eval()[source]

Convert data to the format expected by mir_eval.transcription.evaluate and mir_eval.transcription_velocity.evaluate

Returns

  • intervals (np.ndarray) - (n x 2) array of intervals of start time, end time in seconds

  • pitches (np.ndarray) - array of pitch values in hz

  • velocity (optional, np.ndarray) - array of velocity values between 0 and 127

to_multif0(time_hop: float, time_hop_unit: str, max_time: Optional[float] = None) mirdata.annotations.MultiF0Data[source]

Convert note annotation to multiple f0 format.

Parameters
  • time_hop (float) – time between time stamps in multif0 annotation

  • time_hop_unit (str) – unit for time_hop, and resulting multif0 data. One of TIME_UNITS

  • max_time (float, optional) – Maximum time stamp in time_hop units. Defaults to None, in which case the maximum note interval time is used.

Returns

MultiF0Data – multif0 annotation

to_sparse_index(time_scale: numpy.ndarray, time_scale_unit: str, frequency_scale: numpy.ndarray, frequency_scale_unit: str, amplitude_unit: str = 'binary', onsets_only: bool = False) Tuple[numpy.ndarray, numpy.ndarray][source]

Convert note annotations to indexes of a sparse matrix (piano roll)

Parameters
  • time_scale (np.array) – array of matrix time stamps in seconds

  • time_scale_unit (str) – units for time scale values, one of TIME_UNITS

  • frequency_scale (np.array) – array of matrix frequency values in seconds

  • frequency_scale_unit (str) – units for frequency scale values, one of PITCH_UNITS

  • amplitude_unit (str) – units for amplitude values, one of AMPLITUDE_UNITS. Defaults to “binary”.

  • onsets_only (bool, optional) – If True, returns an onset piano roll. Defaults to False.

Returns

** sparse_index (np.ndarray)* – Array of sparce indices [(time_index, frequency_index)] * amplitude (np.ndarray): Array of amplitude values for each index

mirdata.annotations.PITCH_UNITS = {'hz': 'hertz', 'midi': 'MIDI note number', 'note_name': 'pc with octave, e.g. Ab4', 'pc': 'pitch class, e.g. G#'}

Pitch units

mirdata.annotations.SECTION_UNITS = {'open': 'no scrict schema or units'}

Section units

class mirdata.annotations.SectionData(intervals, interval_unit, labels=None, label_unit=None)[source]

SectionData class

Variables
  • intervals (np.ndarray) – (n x 2) array of intervals in the form [start_time, end_time]. Times should be positive and intervals should have non-negative duration

  • interval_unit (str) – unit of the time values in intervals. One of TIME_UNITS.

  • labels (list or None) – list of section labels

  • label_unit (str or None) – label unit, one of SECTION_UNITS

mirdata.annotations.TEMPO_UNITS = {'bpm': 'beats per minute'}

Tempo units

mirdata.annotations.TIME_UNITS = {'ms': 'miliseconds', 's': 'seconds', 'ticks': 'MIDI ticks'}

Time units

class mirdata.annotations.TempoData(intervals, interval_unit, tempos, tempo_unit, confidence=None, confidence_unit=None)[source]

TempoData class

Variables
  • intervals (np.ndarray) – (n x 2) array of intervals in the form [start_time, end_time]. Times should be positive and intervals should have non-negative duration

  • interval_unit (str) – unit of the time values in intervals. One of TIME_UNITS.

  • tempos (list) – array of tempo values (as floats)

  • tempo_unit (str) – tempo unit, one of TEMPO_UNITS

  • confidence (np.ndarray or None) – array of confidence values

  • confidence_unit (str or None) – confidence unit, one of AMPLITUDE_UNITS

mirdata.annotations.VOICING_UNITS = {'binary': '0 or 1', 'likelihood': 'score between 0 and 1'}

Voicing units

mirdata.annotations.closest_index(input_array, target_array)[source]

Get array of indices of target_array that are closest to the input_array

Parameters
  • input_array (np.ndarray) – (n x 2) array of input values

  • target_array (np.ndarray) – (m x 2) array of target values)

Returns

np.ndarray – array of shape (n x 1) of indexes into target_array

mirdata.annotations.convert_amplitude_units(amplitude, amplitude_unit, target_amplitude_unit)[source]

Convert amplitude values to likelihoods

Parameters
  • amplitude (np.array) – array of amplitude values

  • amplitude_unit (str) – unit of amplitude, one of AMPLITUDE_UNITS

  • target_amplitude_unit (str) – target unit of amplitude, one of AMPLITUDE_UNITS

Raises

NotImplementedError – If conversion is not supported

Returns

np.array – array of amplitude values as in target amplitude unit

mirdata.annotations.convert_pitch_units(pitches, pitch_unit, target_pitch_unit)[source]

Convert pitch values from pitch_unit to target_pitch_unit

Parameters
  • pitches (np.array) – array of pitch values

  • pitch_unit (str) – unit of pitch, one of PITCH_UNITS

  • target_pitch_unit (str) – target unit of pitch, one of PITCH_UNITS

Raises

NotImplementedError – If conversion between given units is not supported

Returns

np.array – array of pitch values in target_pitch_unit

mirdata.annotations.convert_time_units(times, time_unit, target_time_unit)[source]

Convert a time array from time_unit to target_time_unit

Parameters
  • times (np.ndarray) – array of time values in units time_unit

  • time_unit (str) – time unit, one of TIME_UNITS

  • target_time_unit (str) – new time unit, one of TIME_UNITS

Raises

ValueError – If time units are not convertable

Returns

np.ndarray – times in units target_time_unit

mirdata.annotations.validate_array_like(array_like, expected_type, expected_dtype, none_allowed=False)[source]

Validate that array-like object is well formed

If array_like is None, validation passes automatically.

Parameters
  • array_like (array-like) – object to validate

  • expected_type (type) – expected type, either list or np.ndarray

  • expected_dtype (type) – expected dtype

  • none_allowed (bool) – if True, allows array to be None

Raises
  • TypeError – if type/dtype does not match expected_type/expected_dtype

  • ValueError – if array

mirdata.annotations.validate_beat_positions(positions, position_unit)[source]

Validate if positions is well-formed.

Parameters
  • positions (np.ndarray) – an array of positions values

  • positions_unit (str) – one of BEAT_POSITION_UNITS

Raises

ValueError – if positions values are incompatible with the unit

mirdata.annotations.validate_chord_labels(chords, chord_unit)[source]

Validate that chord labels conform to chord_unit namespace

Parameters
  • chords (list) – list of chord labels as strings

  • chord_unit (str) – chord namespace, e.g. “harte”

Raises

ValueError – If chords don’t conform to namespace

mirdata.annotations.validate_confidence(confidence, confidence_unit)[source]

Validate if confidence is well-formed.

If confidence is None, validation passes automatically

Parameters
  • confidence (np.ndarray) – an array of confidence values

  • confidence_unit (str) – one of AMPLITUDE_UNITS

Raises

ValueError – if confidence values are incompatible with the unit

mirdata.annotations.validate_intervals(intervals, interval_unit)[source]

Validate if intervals are well-formed.

If intervals is None, validation passes automatically

Parameters
  • intervals (np.ndarray) – (n x 2) array

  • interval_unit (str) – interval unit, one of TIME_UNITS

Raises
  • ValueError – if intervals have an invalid shape, have negative values

  • or if end times are smaller than start times.

mirdata.annotations.validate_key_labels(keys, key_unit)[source]

Validate that key labels conform to key_unit namespace

Parameters
  • keys (list) – list of key labels as strings

  • key_unit (str) – key namespace, e.g. “harte”

Raises

ValueError – If keys don’t conform to namespace

mirdata.annotations.validate_lengths_equal(array_list)[source]

Validate that arrays in list are equal in length

Some arrays may be None, and the validation for these are skipped.

Parameters

array_list (list) – list of array-like objects

Raises

ValueError – if arrays are not equal in length

mirdata.annotations.validate_pitches(pitches, pitch_unit)[source]

Validate if pitches are well-formed.

Parameters
  • pitches (np.ndarray) – an array of pitch values

  • pitch_unit (str) – pitch unit, one of PITCH_UNITS

Raises

ValueError – if pitches do not correspond to the unit

mirdata.annotations.validate_tempos(tempo, tempo_unit)[source]

Validate if tempos are well-formed

Parameters
  • tempo (list) – list of tempo values

  • tempo_unit (str) – tempo unit, one of TEMPO_UNITS

Raises

ValueError – if tempos are not well-formed

mirdata.annotations.validate_times(times, time_unit)[source]

Validate if times are well-formed.

If times is None, validation passes automatically

Parameters
  • times (np.ndarray) – an array of time stamps

  • time_unit (str) – one of TIME_UNITS

Raises

ValueError – if times have negative values or are non-increasing

mirdata.annotations.validate_unit(unit, unit_values, allow_none=False)[source]

Validate that the given unit is one of the allowed unit values.

Parameters
  • unit (str) – the unit name

  • unit_values (dict) – dictionary of possible unit values

  • allow_none (bool) – if true, allows unit=None to pass validation

Raises

ValueError – If the given unit is not one of the allowed unit valuess

mirdata.annotations.validate_voicing(voicing, voicing_unit)[source]

Validate if voicing is well-formed.

Parameters
  • voicing (np.ndarray) – an array of voicing values

  • voicing_unit (str) – one of VOICING_UNITS

Raises

ValueError – if voicing values are incompatible with the unit

Advanced

mirdata.validate

Utility functions for mirdata

mirdata.validate.log_message(message, verbose=True)[source]

Helper function to log message

Parameters
  • message (str) – message to log

  • verbose (bool) – if false, the message is not logged

mirdata.validate.md5(file_path)[source]

Get md5 hash of a file.

Parameters

file_path (str) – File path

Returns

str – md5 hash of data in file_path

mirdata.validate.validate(local_path, checksum)[source]

Validate that a file exists and has the correct checksum

Parameters
  • local_path (str) – file path

  • checksum (str) – md5 checksum

Returns

  • bool - True if file exists

  • bool - True if checksum matches

mirdata.validate.validate_files(file_dict, data_home, verbose)[source]

Validate files

Parameters
  • file_dict (dict) – dictionary of file information

  • data_home (str) – path where the data lives

  • verbose (bool) – if True, show progress

Returns

  • dict - missing files

  • dict - files with invalid checksums

mirdata.validate.validate_index(dataset_index, data_home, verbose=True)[source]

Validate files in a dataset’s index

Parameters
  • dataset_index (list) – dataset indices

  • data_home (str) – Local home path that the dataset is being stored

  • verbose (bool) – if true, prints validation status while running

Returns

  • dict - file paths that are in the index but missing locally

  • dict - file paths with differing checksums

mirdata.validate.validate_metadata(file_dict, data_home, verbose)[source]

Validate files

Parameters
  • file_dict (dict) – dictionary of file information

  • data_home (str) – path where the data lives

  • verbose (bool) – if True, show progress

Returns

  • dict - missing files

  • dict - files with invalid checksums

mirdata.validate.validator(dataset_index, data_home, verbose=True)[source]

Checks the existence and validity of files stored locally with respect to the paths and file checksums stored in the reference index. Logs invalid checksums and missing files.

Parameters
  • dataset_index (list) – dataset indices

  • data_home (str) – Local home path that the dataset is being stored

  • verbose (bool) – if True (default), prints missing and invalid files to stdout. Otherwise, this function is equivalent to validate_index.

Returns

missing_files (list)

List of file paths that are in the dataset index

but missing locally.

invalid_checksums (list): List of file paths that file exists in the

dataset index but has a different checksum compare to the reference checksum.

mirdata.download_utils

Utilities for downloading from the web.

class mirdata.download_utils.DownloadProgressBar(*_, **__)[source]

Wrap tqdm to show download progress

class mirdata.download_utils.RemoteFileMetadata(filename, url, checksum, destination_dir=None, unpack_directories=None)[source]

The metadata for a remote file

Variables
  • filename (str) – the remote file’s basename

  • url (str) – the remote file’s url

  • checksum (str) – the remote file’s md5 checksum

  • destination_dir (str or None) – the relative path for where to save the file

  • unpack_directories (list or None) – list of relative directories. For each directory the contents will be moved to destination_dir (or data_home if not provieds)

mirdata.download_utils.download_from_remote(remote, save_dir, force_overwrite, allow_invalid_checksum)[source]

Download a remote dataset into path Fetch a dataset pointed by remote’s url, save into path using remote’s filename and ensure its integrity based on the MD5 Checksum of the downloaded file.

Adapted from scikit-learn’s sklearn.datasets.base._fetch_remote.

Parameters
  • remote (RemoteFileMetadata) – Named tuple containing remote dataset meta information: url, filename and checksum

  • save_dir (str) – Directory to save the file to. Usually data_home

  • force_overwrite (bool) – If True, overwrite existing file with the downloaded file. If False, does not overwrite, but checks that checksum is consistent.

Returns

str – Full path of the created file.

mirdata.download_utils.download_tar_file(tar_remote, save_dir, force_overwrite, cleanup, allow_invalid_checksum)[source]

Download and untar a tar file.

Parameters
  • tar_remote (RemoteFileMetadata) – Object containing download information

  • save_dir (str) – Path to save downloaded file

  • force_overwrite (bool) – If True, overwrites existing files

  • cleanup (bool) – If True, remove tarfile after untarring

mirdata.download_utils.download_zip_file(zip_remote, save_dir, force_overwrite, cleanup, allow_invalid_checksum)[source]

Download and unzip a zip file.

Parameters
  • zip_remote (RemoteFileMetadata) – Object containing download information

  • save_dir (str) – Path to save downloaded file

  • force_overwrite (bool) – If True, overwrites existing files

  • cleanup (bool) – If True, remove zipfile after unziping

mirdata.download_utils.downloader(save_dir, remotes=None, index=None, partial_download=None, info_message=None, force_overwrite=False, cleanup=False, allow_invalid_checksum=False)[source]

Download data to save_dir and optionally log a message.

Parameters
  • save_dir (str) – The directory to download the data

  • remotes (dict or None) – A dictionary of RemoteFileMetadata tuples of data in zip format. If None, there is no data to download

  • index (core.Index) – A mirdata Index class, which may contain a remote index to be downloaded or a subset of remotes to download by default.

  • partial_download (list or None) – A list of keys to partially download the remote objects of the download dict. If None, all data specified by the index is downloaded

  • info_message (str or None) – A string of info to log when this function is called. If None, no string is logged.

  • force_overwrite (bool) – If True, existing files are overwritten by the downloaded files.

  • cleanup (bool) – Whether to delete the zip/tar file after extracting.

  • allow_invalid_checksum (bool) – Allow having an invalid checksum, and whenever this happens prompt a warning instead of deleting the files.

mirdata.download_utils.extractall_unicode(zfile, out_dir)[source]

Extract all files inside a zip archive to a output directory.

In comparison to the zipfile, it checks for correct file name encoding

Parameters
  • zfile (obj) – Zip file object created with zipfile.ZipFile

  • out_dir (str) – Output folder

mirdata.download_utils.move_directory_contents(source_dir, target_dir)[source]

Move the contents of source_dir into target_dir, and delete source_dir

Parameters
  • source_dir (str) – path to source directory

  • target_dir (str) – path to target directory

mirdata.download_utils.untar(tar_path, cleanup)[source]

Untar a tar file inside it’s current directory.

Parameters
  • tar_path (str) – Path to tar file

  • cleanup (bool) – If True, remove tarfile after untarring

mirdata.download_utils.unzip(zip_path, cleanup)[source]

Unzip a zip file inside it’s current directory.

Parameters
  • zip_path (str) – Path to zip file

  • cleanup (bool) – If True, remove zipfile after unzipping

mirdata.jams_utils

Utilities for converting mirdata Annotation classes to jams format.

mirdata.jams_utils.beats_to_jams(beat_data, description=None)[source]

Convert beat annotations into jams format.

Parameters
  • beat_data (annotations.BeatData) – beat data object

  • description (str) – annotation description

Returns

jams.Annotation – jams annotation object.

mirdata.jams_utils.chords_to_jams(chord_data, description=None)[source]

Convert chord annotations into jams format.

Parameters
  • chord_data (annotations.ChordData) – chord data object

  • description (str) – annotation description

Returns

jams.Annotation – jams annotation object.

mirdata.jams_utils.events_to_jams(event_data, description=None)[source]

Convert events annotations into jams format.

Parameters
  • event_data (annotations.EventData) – event data object

  • description (str) – annotation description

Returns

jams.Annotation – jams annotation object.

mirdata.jams_utils.f0s_to_jams(f0_data, description=None)[source]

Convert f0 annotations into jams format.

Parameters
  • f0_data (annotations.F0Data) – f0 annotation object

  • description (str) – annotation descriptoin

Returns

jams.Annotation – jams annotation object.

mirdata.jams_utils.jams_converter(audio_path=None, spectrogram_path=None, beat_data=None, chord_data=None, note_data=None, f0_data=None, section_data=None, multi_section_data=None, tempo_data=None, event_data=None, key_data=None, lyrics_data=None, tags_gtzan_data=None, tags_open_data=None, metadata=None)[source]

Convert annotations from a track to JAMS format.

Parameters
  • audio_path (str or None) – A path to the corresponding audio file, or None. If provided, the audio file will be read to compute the duration. If None, ‘duration’ must be a field in the metadata dictionary, or the resulting jam object will not validate.

  • spectrogram_path (str or None) – A path to the corresponding spectrum file, or None.

  • beat_data (list or None) – A list of tuples of (annotations.BeatData, str), where str describes the annotation (e.g. ‘beats_1’).

  • chord_data (list or None) – A list of tuples of (annotations.ChordData, str), where str describes the annotation.

  • note_data (list or None) – A list of tuples of (annotations.NoteData, str), where str describes the annotation.

  • f0_data (list or None) – A list of tuples of (annotations.F0Data, str), where str describes the annotation.

  • section_data (list or None) – A list of tuples of (annotations.SectionData, str), where str describes the annotation.

  • multi_section_data (list or None) – A list of tuples. Tuples in multi_section_data should contain another list of tuples, indicating annotations in the different levels e.g. ([(segments0, level0), ‘(segments1, level1)], annotator) and a str indicating the annotator

  • tempo_data (list or None) – A list of tuples of (float, str), where float gives the tempo in bpm and str describes the annotation.

  • event_data (list or None) – A list of tuples of (annotations.EventData, str), where str describes the annotation.

  • key_data (list or None) – A list of tuples of (annotations.KeyData, str), where str describes the annotation.

  • lyrics_data (list or None) – A list of tuples of (annotations.LyricData, str), where str describes the annotation.

  • tags_gtzan_data (list or None) – A list of tuples of (str, str), where the first srt is the tag and the second is a descriptor of the annotation.

  • tags_open_data (list or None) – A list of tuples of (str, str), where the first srt is the tag and the second is a descriptor of the annotation.

  • metadata (dict or None) – A dictionary containing the track metadata.

Returns

jams.JAMS – A JAMS object containing the annotations.

mirdata.jams_utils.keys_to_jams(key_data, description)[source]

Convert key annotations into jams format.

Parameters
  • key_data (annotations.KeyData) – key data object

  • description (str) – annotation description

Returns

jams.Annotation – jams annotation object.

mirdata.jams_utils.lyrics_to_jams(lyric_data, description=None)[source]

Convert lyric annotations into jams format.

Parameters
  • lyric_data (annotations.LyricData) – lyric annotation object

  • description (str) – annotation descriptoin

Returns

jams.Annotation – jams annotation object.

mirdata.jams_utils.multi_sections_to_jams(multisection_data, description)[source]

Convert multi-section annotations into jams format.

Parameters
  • multisection_data (list) – list of tuples of the form [(SectionData, int)]

  • description (str) – annotation description

Returns

jams.Annotation – jams annotation object.

mirdata.jams_utils.notes_to_jams(note_data, description)[source]

Convert note annotations into jams format.

Parameters
  • note_data (annotations.NoteData) – note data object

  • description (str) – annotation description

Returns

jams.Annotation – jams annotation object.

mirdata.jams_utils.sections_to_jams(section_data, description=None)[source]

Convert section annotations into jams format.

Parameters
  • section_data (annotations.SectionData) – section data object

  • description (str) – annotation description

Returns

jams.Annotation – jams annotation object.

mirdata.jams_utils.tag_to_jams(tag_data, namespace='tag_open', description=None)[source]

Convert lyric annotations into jams format.

Parameters
  • lyric_data (annotations.LyricData) – lyric annotation object

  • namespace (str) – the jams-compatible tag namespace

  • description (str) – annotation descriptoin

Returns

jams.Annotation – jams annotation object.

mirdata.jams_utils.tempos_to_jams(tempo_data, description=None)[source]

Convert tempo annotations into jams format.

Parameters
  • tempo_data (annotations.TempoData) – tempo data object

  • description (str) – annotation description

Returns

jams.Annotation – jams annotation object.