tempo_dataset

PyTorch Dataset and DataLoader for this project’s own tempo-annotated datasets (see docs/source/data.rst’s “Data format” section).

Classes

TempoDataset([name, data_home, refs, ...])

Dataset returning raw waveforms and tempo labels, read entirely from this project's own tracks/+annotations/ format.

class TempoDataset(name=None, data_home=None, *, refs=None, sample_rate=22050, duration=10.0)[source]

Bases: Dataset

Dataset returning raw waveforms and tempo labels, read entirely from this project’s own tracks/+annotations/ format.

Loads every track with a migrated .beats annotation whose .meta.json carries a bpm_median (see musicality.dataformats.track_io.bpm_stats(), computed by the migration tools from the beat annotation itself — there’s no separate ground-truth tempo field in this format). Tracks missing either are silently skipped. Preprocessing (e.g. mel transform) is left to the model.

Parameters:
  • name (str | None) – Dataset name (e.g. "rwc_popular", "swing") — must already be migrated to this project’s own format (see tools/migrate_mirdata_dataset.py / tools/migrate_rwc_genre.py). Mutually exclusive with refs.

  • data_home (Path | None) – Dataset directory. Defaults to DATA_DIR/<name> (DATA_DIR from musicality.dataformats). Ignored if refs is given.

  • refs (list[TrackRef] | None) – Explicit list of tracks to load, bypassing name/data_home resolution entirely — e.g. tracks pulled from several source datasets (see load_refs()). Mutually exclusive with name.

  • sample_rate (int) – Target sample rate. Audio is resampled if needed.

  • duration (float) – Clip duration in seconds. The clip is taken from the start of the track; shorter tracks are zero-padded.