Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for i in range(5):
output_file_path = os.path.join(
output_dir, "AddGaussianNoise_{:03d}.wav".format(i)
)
augmented_samples = augmenter(samples=samples, sample_rate=SAMPLE_RATE)
wavfile.write(output_file_path, rate=SAMPLE_RATE, data=augmented_samples)
# TimeStretch
augmenter = Compose([TimeStretch(min_rate=0.8, max_rate=1.25, p=1.0)])
for i in range(5):
output_file_path = os.path.join(output_dir, "TimeStretch_{:03d}.wav".format(i))
augmented_samples = augmenter(samples=samples, sample_rate=SAMPLE_RATE)
wavfile.write(output_file_path, rate=SAMPLE_RATE, data=augmented_samples)
# PitchShift
augmenter = Compose([PitchShift(min_semitones=-4, max_semitones=4, p=1.0)])
for i in range(5):
output_file_path = os.path.join(output_dir, "PitchShift_{:03d}.wav".format(i))
augmented_samples = augmenter(samples=samples, sample_rate=SAMPLE_RATE)
wavfile.write(output_file_path, rate=SAMPLE_RATE, data=augmented_samples)
# Shift
augmenter = Compose([Shift(min_fraction=-0.5, max_fraction=0.5, p=1.0)])
for i in range(5):
output_file_path = os.path.join(output_dir, "Shift_{:03d}.wav".format(i))
augmented_samples = augmenter(samples=samples, sample_rate=SAMPLE_RATE)
wavfile.write(output_file_path, rate=SAMPLE_RATE, data=augmented_samples)
# Normalize
augmenter = Compose([Normalize(p=1.0)])
output_file_path = os.path.join(output_dir, "Normalize_{:03d}.wav".format(0))
augmented_samples = augmenter(samples=samples, sample_rate=SAMPLE_RATE)