def test_speed_does_not_change_num_samples(audio): augment_fn = SoxEffectTransform(effects=speed(SAMPLING_RATE)) # Since speed() is not deterministic and between 0.9x - 1.1x, multiple invocations # will yield either slower (more samples) or faster (less samples) signal. # The truncation/padding is performed inside of SoxEffectTransform so the user should not # see these changes. for _ in range(10): augmented_audio = augment_fn(audio, sampling_rate=SAMPLING_RATE) assert augmented_audio.shape == audio.shape assert augmented_audio != audio
def test_example_augmentation(audio, effect): augment_fn = SoxEffectTransform(effects=effect(SAMPLING_RATE)) augmented_audio = augment_fn(audio, sampling_rate=SAMPLING_RATE) assert augmented_audio.shape == audio.shape assert augmented_audio != audio
def test_volume_does_not_change_num_samples(audio): augment_fn = SoxEffectTransform(effects=volume(SAMPLING_RATE)) for _ in range(10): augmented_audio = augment_fn(audio, sampling_rate=SAMPLING_RATE) assert augmented_audio.shape == audio.shape assert augmented_audio != audio