Undo noise first

This commit is contained in:
James Betker 2021-08-05 23:24:38 -06:00
parent 908ef5495f
commit f126040da2

View File

@ -40,14 +40,14 @@ class WavAugmentor:
]
band_effect = random.choice(band_effects)
volume_effects = [
['loudness', rdi(10,-10)],
['loudness', rdi(10,-2)],
['overdrive', rdi(20,0), rdi(20,0)],
]
vol_effect = random.choice(volume_effects)
effects = [speed_effect, band_effect, vol_effect]
out, sr = torchaudio.sox_effects.apply_effects_tensor(wav, sample_rate, effects)
# Add a variable amount of noise
out = wav + torch.rand_like(wav) * random.random() * .05
out, sr = torchaudio.sox_effects.apply_effects_tensor(out, sample_rate, effects)
out = out + torch.rand_like(out) * random.random() * .05
return out