Skip to content

Commit

Permalink
Update AddBackgroundNoise code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
iver56 committed Sep 30, 2024
1 parent a99e804 commit 23c4ee7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion audiomentations/augmentations/add_background_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions docs/waveform_transforms/add_background_noise.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
)
Expand All @@ -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
)
Expand Down

0 comments on commit 23c4ee7

Please sign in to comment.