Source code for muspy.datasets.musicnet

"""MusicNet Dataset."""
from pathlib import Path
from typing import Union

from ..inputs import read_midi
from import Music
from .base import DatasetInfo, RemoteFolderDataset

# pylint: disable=line-too-long

_NAME = "MusicNet Dataset"
MusicNet is a collection of 330 freely-licensed classical music recordings, \
together with over 1 million annotated labels indicating the precise time of \
each note in every recording, the instrument that plays each note, and the \
note's position in the metrical structure of the composition."""
_CITATION = """\
  author={John Thickstun and Zaid Harchaoui and Sham M. Kakade},
  title={Learning Features of Music from Scratch},
  booktitle={International Conference on Learning Representations (ICLR)},

[docs]class MusicNetDataset(RemoteFolderDataset): """MusicNet Dataset (MIDI only).""" _info = DatasetInfo(_NAME, _DESCRIPTION, _HOMEPAGE) _citation = _CITATION _sources = { "musicnet": { "filename": "musicnet_midis.tar.gz", "url": "", "archive": True, "size": 2601302, "md5": "b5fa98a113bfc51c8a445def9f24dc7e", "sha256": "943cc47731ec5f397bd6fbab4dff78342472890cd484bd30ffb2e16047eef908", } } _extension = "mid"
[docs] def read(self, filename: Union[str, Path]) -> Music: """Read a file into a Music object.""" return read_midi(self.root / filename)