audiomentations
audiomentations copied to clipboard
Idea: Rename AddBackgroundNoise?
I feel like it isn't limited to adding specifically background noise - it could be any type of noise or actually any audio (it doesn't have to be noise although that is a common thing to do)
Any suggestions for a better name? AddNoise? AddNoiseFromFiles? MixInSoundFile?
How about AddExternalNoise
?
Simply renaming might be confusing in some scenarios. In my opinion, repeat of sound is typical for background noise only.
https://github.com/iver56/audiomentations/blob/63a2eb7a75a0a5c2627bc5312d13ef789644a94a/audiomentations/augmentations/add_background_noise.py#L229
# Repeat the sound if it shorter than the input sound
num_samples = len(samples)
while len(noise_sound) < num_samples:
noise_sound = np.concatenate((noise_sound, noise_sound))
if len(noise_sound) > num_samples:
noise_sound = noise_sound[0:num_samples]
# Return a mix of the input sound and the background noise sound
return samples + noise_sound
If the rename is considered to make it more general, this functionality could be controlled by a boolean parameter like noise_repeat
. For non-background noises, mixing of audio should only be allowed for same length files.
Ok