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) EventDataExtended | None[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

ballroom

Ballroom Rhythm Dataset Loader

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

The ballroom 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.ballroom.Track(track_id, data_home, dataset_name, index, metadata)[source]

Ballroom 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 (str) – path to beats file

  • tempo_path (str) – path to tempo file

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

  • tempo (float) – human-labeled tempo annotations

property audio: Tuple[numpy.ndarray, float] | None

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.ballroom.load_audio(fhandle: BinaryIO) Tuple[numpy.ndarray, float][source]

Load a Ballroom 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.ballroom.load_beats(fhandle: TextIO)[source]

Load beats

Parameters:

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

Returns:

BeatData – beat annotations

mirdata.datasets.ballroom.load_tempo(fhandle: TextIO) float[source]

Load tempo

Parameters:

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

Returns:

float – tempo annotation

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: Tuple[numpy.ndarray, float] | None

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) 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) 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) 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) 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: Tuple[numpy.ndarray, float] | None

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: Tuple[numpy.ndarray, float] | None

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) 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: numpy.ndarray | None

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) F0Data | None[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) 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: Tuple[numpy.ndarray, float] | None

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) 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) 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) 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) 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: Tuple[numpy.ndarray, float] | None

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

Returns:

  • np.ndarray - audio signal

  • float - sample rate

property audio_spl: Tuple[numpy.ndarray, float] | None

The audio for the piano accompaniment DI (left channel)

Returns:

  • np.ndarray - audio signal

  • float - sample rate

property audio_spr: Tuple[numpy.ndarray, float] | None

The audio for the piano accompaniment DI (right channel)

Returns:

  • np.ndarray - audio signal

  • float - sample rate

property audio_stl: Tuple[numpy.ndarray, float] | None

The audio for the room mic (left channel)

Returns:

  • np.ndarray - audio signal

  • float - sample rate

property audio_stm: Tuple[numpy.ndarray, float] | None

The audio for the room mic (mono mixdown)

Returns:

  • np.ndarray - audio signal

  • float - sample rate

property audio_str: Tuple[numpy.ndarray, float] | None

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: Tuple[numpy.ndarray, float] | None

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

Returns:

  • np.ndarray - audio signal

  • float - sample rate

property audio_hsm: Tuple[numpy.ndarray, float] | None

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

Returns:

  • np.ndarray - audio signal

  • float - sample rate

property audio_lrx: Tuple[numpy.ndarray, float] | None

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) 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) 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) 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: Tuple[numpy.ndarray, float] | None

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) Tuple[numpy.ndarray, float] | None[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: Tuple[numpy.ndarray, float] | None

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