cad2task2_dataloader

class recipes.cad2.task2.ConvTasNet.local.cad2task2_dataloader.Compose(transforms)[source]

Bases: object

Composes several augmentation transforms. :param augmentations: list of augmentations to compose.

class recipes.cad2.task2.ConvTasNet.local.cad2task2_dataloader.RebalanceMusicDataset(root_path: ~pathlib.Path | str, music_tracks_file: ~pathlib.Path | str, target: str, samples_per_track: int = 1, segment_length: float | None = 5.0, random_segments=False, random_track_mix=False, split: str = 'train', source_augmentations=<function RebalanceMusicDataset.<lambda>>, sample_rate: int = 44100)[source]

Bases: Dataset

Dataset to process EnsembleSet and CadenzaWoodwind datasets for CAD2 Task2 baseline The dataset is composed of a target source and a random number of accompaniment sources.

Parameters:
  • root_path (str) – Path to the root directory of the dataset

  • music_tracks_file (str) – Path to the json file containing the music tracks

  • target (str) – Target source to be extracted

  • samples_per_track (int) – Number of samples to extract from each track

  • segment_length (float) – Length of the segment to extract

  • random_segments (bool) – If True, extract random segments from the tracks

  • random_track_mix (bool) – If True, mix random accompaniment tracks

  • split (str) – Split of the dataset to use

  • sample_rate (int) – Sample rate of the audio files

dataset_name = 'EnsembleSet & CadenzaWoodwind'
get_infos()[source]

Get dataset infos (for publishing models).

Returns:

dict, dataset infos with keys dataset, task and licences.

recipes.cad2.task2.ConvTasNet.local.cad2task2_dataloader.augment_channelswap(audio)[source]

Randomly swap channels of stereo sources

recipes.cad2.task2.ConvTasNet.local.cad2task2_dataloader.augment_gain(audio, low=0.25, high=1.25)[source]

Applies a random gain to each source between low and high

recipes.cad2.task2.ConvTasNet.local.cad2task2_dataloader.get_audio_durations(track_path: Path | str) float[source]