audiotree.datasources

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

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.

  • num_steps (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.

  • cpu (bool) – Whether to load the audio data on the CPU.

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

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.

  • num_steps (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.

  • cpu (bool) – Whether to load the audio data on the CPU.