From c5a12e4b3b5b70352ebe7d4d326593e9958601d2 Mon Sep 17 00:00:00 2001 From: iver56 Date: Mon, 30 Sep 2024 15:54:20 +0200 Subject: [PATCH] Capitalize --- audiomentations/augmentations/add_color_noise.py | 2 +- audiomentations/augmentations/add_gaussian_snr.py | 2 +- audiomentations/augmentations/base_butterword_filter.py | 4 ++-- audiomentations/augmentations/high_shelf_filter.py | 8 ++++---- audiomentations/augmentations/limiter.py | 4 ++-- audiomentations/augmentations/low_shelf_filter.py | 2 +- audiomentations/augmentations/trim.py | 2 +- docs/changelog.md | 2 +- docs/waveform_transforms/add_background_noise.md | 2 +- docs/waveform_transforms/add_gaussian_snr.md | 2 +- docs/waveform_transforms/trim.md | 4 ++-- tests/test_air_absorption.py | 2 +- tests/test_filter_transforms.py | 6 +++--- tests/test_room_simulator.py | 2 +- 14 files changed, 22 insertions(+), 22 deletions(-) diff --git a/audiomentations/augmentations/add_color_noise.py b/audiomentations/augmentations/add_color_noise.py index 2facc249..1cd51c01 100644 --- a/audiomentations/augmentations/add_color_noise.py +++ b/audiomentations/augmentations/add_color_noise.py @@ -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 diff --git a/audiomentations/augmentations/add_gaussian_snr.py b/audiomentations/augmentations/add_gaussian_snr.py index 8806f0e4..73e96f6e 100644 --- a/audiomentations/augmentations/add_gaussian_snr.py +++ b/audiomentations/augmentations/add_gaussian_snr.py @@ -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. """ diff --git a/audiomentations/augmentations/base_butterword_filter.py b/audiomentations/augmentations/base_butterword_filter.py index e4724526..f9ad0cbb 100644 --- a/audiomentations/augmentations/base_butterword_filter.py +++ b/audiomentations/augmentations/base_butterword_filter.py @@ -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( @@ -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( diff --git a/audiomentations/augmentations/high_shelf_filter.py b/audiomentations/augmentations/high_shelf_filter.py index 58ae07c0..6461c95c 100644 --- a/audiomentations/augmentations/high_shelf_filter.py +++ b/audiomentations/augmentations/high_shelf_filter.py @@ -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/ """ @@ -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 @@ -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 diff --git a/audiomentations/augmentations/limiter.py b/audiomentations/augmentations/limiter.py index a1722a59..f1aa8ecb 100644 --- a/audiomentations/augmentations/limiter.py +++ b/audiomentations/augmentations/limiter.py @@ -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 diff --git a/audiomentations/augmentations/low_shelf_filter.py b/audiomentations/augmentations/low_shelf_filter.py index 7ba0318f..bb2cd8bb 100644 --- a/audiomentations/augmentations/low_shelf_filter.py +++ b/audiomentations/augmentations/low_shelf_filter.py @@ -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 diff --git a/audiomentations/augmentations/trim.py b/audiomentations/augmentations/trim.py index c379b921..32a496eb 100644 --- a/audiomentations/augmentations/trim.py +++ b/audiomentations/augmentations/trim.py @@ -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) diff --git a/docs/changelog.md b/docs/changelog.md index 47fa3ec6..3e9a546d 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -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 diff --git a/docs/waveform_transforms/add_background_noise.md b/docs/waveform_transforms/add_background_noise.md index de4754c5..0aefeaea 100644 --- a/docs/waveform_transforms/add_background_noise.md +++ b/docs/waveform_transforms/add_background_noise.md @@ -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) diff --git a/docs/waveform_transforms/add_gaussian_snr.md b/docs/waveform_transforms/add_gaussian_snr.md index 7eba8cca..f02c210d 100644 --- a/docs/waveform_transforms/add_gaussian_snr.md +++ b/docs/waveform_transforms/add_gaussian_snr.md @@ -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 diff --git a/docs/waveform_transforms/trim.md b/docs/waveform_transforms/trim.md index a043e144..dbabe53a 100644 --- a/docs/waveform_transforms/trim.md +++ b/docs/waveform_transforms/trim.md @@ -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 @@ -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. diff --git a/tests/test_air_absorption.py b/tests/test_air_absorption.py index f071f5e1..46157c63 100644 --- a/tests/test_air_absorption.py +++ b/tests/test_air_absorption.py @@ -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) diff --git a/tests/test_filter_transforms.py b/tests/test_filter_transforms.py index d8d05f51..2aa4c272 100644 --- a/tests/test_filter_transforms.py +++ b/tests/test_filter_transforms.py @@ -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) @@ -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 @@ -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 diff --git a/tests/test_room_simulator.py b/tests/test_room_simulator.py index f2c1c125..f4a0d709 100644 --- a/tests/test_room_simulator.py +++ b/tests/test_room_simulator.py @@ -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