audiotree.datasources

class AudioDataBalancedDataset(sources: Mapping[str, List[str]], sample_rate: int = 44100, mono: int = 1, duration: float = 1.0, extensions: List[str] = None, saliency_params: SaliencyParams = None, weights: Mapping[str, float] = None)

A Data Source that equally weights multiple sources, where each source is a list of directories.

Parameters:
  • sources (Mapping[str, List[str]]) – A dictionary mapping each source to a list of directories or glob expressions involving a file extension.

  • sample_rate (int) – The requested sample rate of the audio.

  • mono (bool) – Whether to force the audio to be mono.

  • duration (float) – The requested duration of the audio.

  • extensions (List[str]) – A list of file extensions to search for. Each extension should include a period.

  • saliency_params (SaliencyParams) – Saliency parameters to use.

  • weights (Mapping[str, float]) – A dictionary mapping each source to its proportion in the dataset.

class AudioDataBalancedSource(sources: Mapping[str, List[str]], num_records: int, sample_rate: int = 44100, mono: int = 1, duration: float = 1.0, extensions: List[str] = None, saliency_params: SaliencyParams = None)

A Data Source that equally weights multiple sources, where each source is a list of directories.

Parameters:
  • sources (Mapping[str, List[str]]) – A dictionary mapping each source to a list of directories or glob expressions involving a file extension.

  • num_records (int) – The requested length of the data source.

  • sample_rate (int) – The requested sample rate of the audio.

  • mono (bool) – Whether to force the audio to be mono.

  • duration (float) – The requested duration of the audio.

  • extensions (List[str]) – A list of file extensions to search for. Each extension should include a period.

  • saliency_params (SaliencyParams) – Saliency parameters to use.

class AudioDataSimpleSource(sources: Mapping[str, List[str]], num_records: int = None, sample_rate: int = 44100, mono: int = 1, duration: float = 1.0, extensions: List[str] = None, saliency_params: SaliencyParams = None)

A Data Source that aggregates all source files and weights them equally.

Parameters:
  • sources (Mapping[str, List[str]]) – A dictionary mapping each source to a list of directories or glob expressions involving a file extension.

  • num_records (int) – The requested length of the data source.

  • sample_rate (int) – The requested sample rate of the audio.

  • mono (bool) – Whether to force the audio to be mono.

  • duration (float) – The requested duration of the audio.

  • extensions (List[str]) – A list of file extensions to search for. Each extension should include a period.

  • saliency_params (SaliencyParams) – Saliency parameters to use.