From 23c4ee7ca5048e6bec3da39e91a3bf9f68515e6c Mon Sep 17 00:00:00 2001 From: iver56 Date: Mon, 30 Sep 2024 10:00:09 +0200 Subject: [PATCH] Update AddBackgroundNoise code examples --- audiomentations/augmentations/add_background_noise.py | 2 +- docs/waveform_transforms/add_background_noise.md | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/audiomentations/augmentations/add_background_noise.py b/audiomentations/augmentations/add_background_noise.py index 7b8f221c..163d74a9 100644 --- a/audiomentations/augmentations/add_background_noise.py +++ b/audiomentations/augmentations/add_background_noise.py @@ -24,7 +24,7 @@ class AddBackgroundNoise(BaseWaveformTransform): A folder of (background noise) sounds to be mixed in must be specified. These sounds should ideally be at least as long as the input sounds to be transformed. Otherwise, the background sound will be repeated, which may sound unnatural. - Note that the gain of the added noise is relative to the amount of signal in the input if the parameter noise_rms + Note that the gain of the added noise is relative to the signal level in the input if the parameter noise_rms is set to "relative" (default option). This implies that if the input is completely silent, no noise will be added. Here are some examples of datasets that can be downloaded and used as background noise: * https://github.com/karolpiczak/ESC-50#download diff --git a/docs/waveform_transforms/add_background_noise.md b/docs/waveform_transforms/add_background_noise.md index c2786d92..de4754c5 100644 --- a/docs/waveform_transforms/add_background_noise.md +++ b/docs/waveform_transforms/add_background_noise.md @@ -13,7 +13,7 @@ specified. These sounds should ideally be at least as long as the input sounds t transformed. Otherwise, the background sound will be repeated, which may sound unnatural. Note that in the default case ([`noise_rms="relative"`](#noise_rms)) the gain of the added noise is -relative to the amount of signal in the input. This implies that if the input is +relative to the signal level in the input. This implies that if the input is completely silent, no noise will be added. Optionally, the added noise sound can be transformed (with [`noise_transform`](#noise_transform)) before it gets mixed in. @@ -44,8 +44,8 @@ Here we add some music to a speech recording, targeting a signal-to-noise ratio transform = AddBackgroundNoise( sounds_path="/path/to/folder_with_sound_files", - min_snr_in_db=3.0, - max_snr_in_db=30.0, + min_snr_db=3.0, + max_snr_db=30.0, noise_transform=PolarityInversion(), p=1.0 ) @@ -61,8 +61,8 @@ Here we add some music to a speech recording, targeting a signal-to-noise ratio transform = AddBackgroundNoise( sounds_path="/path/to/folder_with_sound_files", noise_rms="absolute", - min_absolute_rms_in_db=-45.0, - max_absolute_rms_in_db=-15.0, + min_absolute_rms_db=-45.0, + max_absolute_rms_db=-15.0, noise_transform=PolarityInversion(), p=1.0 )