Shortcuts

Musan

class torchaudio.prototype.datasets.Musan(root: Union[str, Path], subset: str)[source]

MUSAN [Snyder et al., 2015] dataset.

Parameters:
  • root (str or Path) – Root directory where the dataset’s top-level directory exists.

  • subset (str) – Subset of the dataset to use. Options: ["music", "noise", "speech"].

__getitem__

Musan.__getitem__(n: int) Tuple[Tensor, int, str][source]

Return the n-th sample in the dataset.

Parameters:

n (int) – Index of sample to be loaded.

Returns:

torch.Tensor

Waveform.

int

Sample rate.

str

File name.

Return type:

(torch.Tensor, int, str)

get_metadata

Musan.get_metadata(n: int) Tuple[str, int, str][source]

Get metadata for the n-th sample in the dataset. Returns filepath instead of waveform, but otherwise returns the same fields as __getitem__().

Parameters:

n (int) – Index of sample to be loaded.

Returns:

str

Path to audio.

int

Sample rate.

str

File name.

Return type:

(str, int, str)

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources