Skip to content

Commit

Permalink
Capitalize
Browse files Browse the repository at this point in the history
  • Loading branch information
iver56 committed Sep 30, 2024
1 parent 804e094 commit c5a12e4
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion audiomentations/augmentations/add_color_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def __init__(
def randomize_parameters(self, samples: np.ndarray, sample_rate: int):
super().randomize_parameters(samples, sample_rate)
if self.parameters["should_apply"]:
# Pick SNR in decibel scale
# Pick SNR in Decibel scale
snr = random.uniform(self.min_snr_db, self.max_snr_db)

# Pick f_decay
Expand Down
2 changes: 1 addition & 1 deletion audiomentations/augmentations/add_gaussian_snr.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class AddGaussianSNR(BaseWaveformTransform):
"""
Add gaussian noise to the input. A random Signal to Noise Ratio (SNR) will be picked
uniformly in the decibel scale. This aligns with human hearing, which is more
uniformly in the Decibel scale. This aligns with human hearing, which is more
logarithmic than linear.
"""

Expand Down
4 changes: 2 additions & 2 deletions audiomentations/augmentations/base_butterword_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def apply(self, samples: NDArray[np.float32], sample_rate: int = None):
cutoff_freq = self.parameters["cutoff_freq"]
nyquist_freq = sample_rate // 2
if cutoff_freq > nyquist_freq:
# Ensure that the cutoff frequency does not exceed the nyquist
# Ensure that the cutoff frequency does not exceed the Nyquist
# frequency to avoid an exception from scipy
cutoff_freq = nyquist_freq * 0.9999
sos = butter(
Expand All @@ -206,7 +206,7 @@ def apply(self, samples: NDArray[np.float32], sample_rate: int = None):
)
nyquist_freq = sample_rate // 2
if high_freq > nyquist_freq:
# Ensure that the upper critical frequency does not exceed the nyquist
# Ensure that the upper critical frequency does not exceed the Nyquist
# frequency to avoid an exception from scipy
high_freq = nyquist_freq * 0.9999
sos = butter(
Expand Down
8 changes: 4 additions & 4 deletions audiomentations/augmentations/high_shelf_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class HighShelfFilter(BaseWaveformTransform):
A high shelf filter is a filter that either boosts (increases amplitude) or cuts
(decreases amplitude) frequencies above a certain center frequency. This transform
applies a high-shelf filter at a specific center frequency in hertz.
The gain at nyquist frequency is controlled by `{min,max}_gain_db` (note: can be positive or negative!).
The gain at Nyquist frequency is controlled by `{min,max}_gain_db` (note: can be positive or negative!).
Filter coefficients are taken from the W3 Audio EQ Cookbook: https://www.w3.org/TR/audio-eq-cookbook/
"""

Expand All @@ -35,8 +35,8 @@ def __init__(
"""
:param min_center_freq: The minimum center frequency of the shelving filter
:param max_center_freq: The maximum center frequency of the shelving filter
:param min_gain_db: The minimum gain at the nyquist frequency
:param max_gain_db: The maximum gain at the nyquist frequency
:param min_gain_db: The minimum gain at the Nyquist frequency
:param max_gain_db: The maximum gain at the Nyquist frequency
:param min_q: The minimum quality factor Q. The higher the Q, the steeper the
transition band will be.
:param max_q: The maximum quality factor Q. The higher the Q, the steeper the
Expand Down Expand Up @@ -120,7 +120,7 @@ def apply(self, samples: NDArray[np.float32], sample_rate: int):
nyquist_freq = sample_rate // 2
center_freq = self.parameters["center_freq"]
if center_freq > nyquist_freq:
# Ensure that the center frequency is below the nyquist
# Ensure that the center frequency is below the Nyquist
# frequency to avoid filter instability
center_freq = nyquist_freq * 0.9999

Expand Down
4 changes: 2 additions & 2 deletions audiomentations/augmentations/limiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def __init__(
The attack time is how quickly the limiter kicks in once the audio signal starts exceeding the threshold.
The release time determines how quickly the limiter stops working after the signal drops below the threshold.
:param min_threshold_db: Minimum threshold in decibels
:param max_threshold_db: Maximum threshold in decibels
:param min_threshold_db: Minimum threshold in Decibels
:param max_threshold_db: Maximum threshold in Decibels
:param min_attack: Minimum attack time in seconds
:param max_attack: Maximum attack time in seconds
:param min_release: Minimum release time in seconds
Expand Down
2 changes: 1 addition & 1 deletion audiomentations/augmentations/low_shelf_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def apply(self, samples: NDArray[np.float32], sample_rate: int):
nyquist_freq = sample_rate // 2
center_freq = self.parameters["center_freq"]
if center_freq > nyquist_freq:
# Ensure that the center frequency is below the nyquist
# Ensure that the center frequency is below the Nyquist
# frequency to avoid filter instability
center_freq = nyquist_freq * 0.9999

Expand Down
2 changes: 1 addition & 1 deletion audiomentations/augmentations/trim.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Trim(BaseWaveformTransform):

def __init__(self, top_db: float = 30.0, p: float = 0.5):
"""
:param top_db: The threshold (in decibels) below reference to consider as silence
:param top_db: The threshold (in Decibels) below reference to consider as silence
:param p: The probability of applying this transform
"""
super().__init__(p)
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ These are **breaking changes**. The following example shows how you can adapt yo
* When looking for audio files in `AddImpulseResponse`, `AddBackgroundNoise`
and `AddShortNoises`, follow symlinks by default.
* When using the new parameters `min_snr_in_db` and `max_snr_in_db` in `AddGaussianSNR`,
SNRs will be picked uniformly in _the decibel scale_ instead of in the linear amplitude
SNRs will be picked uniformly in _the Decibel scale_ instead of in the linear amplitude
ratio scale. The new behavior aligns more with human hearing, which is not linear.

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion docs/waveform_transforms/add_background_noise.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Here are some examples of datasets that can be downloaded and used as background
## Input-output example

Here we add some music to a speech recording, targeting a signal-to-noise ratio (SNR) of
5 decibels (dB), which means that the speech (_signal_) is 5 dB louder than the music (_noise_).
5 Decibels (dB), which means that the speech (_signal_) is 5 dB louder than the music (_noise_).

![Input-output waveforms and spectrograms](AddBackgroundNoise.webp)

Expand Down
2 changes: 1 addition & 1 deletion docs/waveform_transforms/add_gaussian_snr.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ _Added in v0.7.0_

The `AddGaussianSNR` transform injects Gaussian noise into an audio signal. It applies
a **Signal-to-Noise Ratio (SNR)** that is chosen randomly from a **uniform distribution on the
decibel scale**. This choice is consistent with the nature of human hearing, which is
Decibel scale**. This choice is consistent with the nature of human hearing, which is
logarithmic rather than linear.

**SNR** is a common measure used in science and engineering to compare the level of a
Expand Down
4 changes: 2 additions & 2 deletions docs/waveform_transforms/trim.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
_Added in v0.7.0_

Trim leading and trailing silence from an audio signal using `librosa.effects.trim`. It considers threshold
(in decibels) below reference defined in parameter `top_db` as silence.
(in Decibels) below reference defined in parameter `top_db` as silence.

## Input-output example

Expand Down Expand Up @@ -31,7 +31,7 @@ augmented_sound = transform(my_waveform_ndarray, sample_rate=16000)
## Trim API

[`top_db`](#top_db){ #top_db }: `float` • unit: Decibel
: :octicons-milestone-24: Default: `30.0`. The threshold value (in decibels) below which to consider silence and trim.
: :octicons-milestone-24: Default: `30.0`. The threshold value (in Decibels) below which to consider silence and trim.

[`p`](#p){ #p }: `float` • range: [0.0, 1.0]
: :octicons-milestone-24: Default: `0.5`. The probability of applying this transform.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_air_absorption.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


def get_chirp_test(sample_rate, duration):
"""Create a `duration` seconds chirp from 0Hz to `nyquist frequency`"""
"""Create a `duration` seconds chirp from 0Hz to `Nyquist frequency`"""
n = np.arange(0, duration, 1 / sample_rate)
samples = scipy.signal.chirp(n, 0, duration, sample_rate // 2, method="linear")
return samples.astype(np.float32)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_filter_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


def get_chirp_test(sample_rate, duration):
"""Create a `duration` seconds chirp from 0Hz to `nyquist frequency`"""
"""Create a `duration` seconds chirp from 0Hz to `Nyquist frequency`"""
n = np.arange(0, duration, 1 / sample_rate)
samples = scipy.signal.chirp(n, 0, duration, sample_rate // 2, method="linear")
return samples.astype(np.float32)
Expand Down Expand Up @@ -738,7 +738,7 @@ def test_n_channel_input(self, samples, rolloff, zero_phase, num_channels):
@pytest.mark.parametrize("zero_phase", [False])
def test_nyquist_limit(self, cutoff_frequency, rolloff, zero_phase):
# Test that the filter doesn't raise an exception when
# cutoff_frequency is greater than the nyquist frequency
# cutoff_frequency is greater than the Nyquist frequency

sample_rate = 8000

Expand Down Expand Up @@ -947,7 +947,7 @@ def test_nyquist_limit(
self, center_frequency, bandwidth_fraction, rolloff, zero_phase
):
# Test that the filter doesn't raise an exception when
# center_freq + bandwidth / 2 is greater than the nyquist frequency
# center_freq + bandwidth / 2 is greater than the Nyquist frequency

sample_rate = 16000

Expand Down
2 changes: 1 addition & 1 deletion tests/test_room_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def get_sinc_impulse(sample_rate, duration):
"""Create a `duration` seconds chirp from 0Hz to `nyquist frequency`"""
"""Create a `duration` seconds chirp from 0Hz to `Nyquist frequency`"""
n = np.arange(-duration / 2, duration / 2, 1 / sample_rate)

# Full band sinc impulse centered at half the duration
Expand Down

0 comments on commit c5a12e4

Please sign in to comment.