From 1e74f2ab0435d8a472ba06f2b0bc12897fbce3c4 Mon Sep 17 00:00:00 2001 From: pprobst Date: Fri, 20 Oct 2023 17:54:50 -0300 Subject: [PATCH] fix: better output filename and aug params --- audio/aug.py | 6 +++--- run_audio_aug.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/audio/aug.py b/audio/aug.py index dc00774..e69e537 100644 --- a/audio/aug.py +++ b/audio/aug.py @@ -9,7 +9,7 @@ AUG_PARAMS = { # See a list of possible transforms here: https://iver56.github.io/audiomentations/ # "p" is the probability of applying the transform - "AddGaussianNoise": {"min_amplitude": 0.001, "max_amplitude": 0.015, "p": 0.7}, + "AddGaussianNoise": {"min_amplitude": 0.0001, "max_amplitude": 0.005, "p": 0.7}, "AddGaussianSNR": {"min_snr_db": 5.0, "max_snr_db": 40.0, "p": 0.7}, "ClippingDistortion": { "min_percentile_threshold": 0, @@ -33,10 +33,10 @@ "min_bitrate": 8, "max_bitrate": 64, "backend": "pydub", - "p": 0.7, + "p": 0.5, }, "Normalize": {"p": 0.7}, - "TimeStretch": {"min_rate": 0.7, "max_rate": 1.25, "p": 0.8}, + "TimeStretch": {"min_rate": 0.8, "max_rate": 1.25, "p": 0.8}, "PitchShift": {"min_semitones": -1.0, "max_semitones": 1.0, "p": 0.7}, "Shift": {"min_shift": -1.0, "max_shift": 1.0, "p": 0.7}, } diff --git a/run_audio_aug.py b/run_audio_aug.py index ba776cd..67e93d2 100755 --- a/run_audio_aug.py +++ b/run_audio_aug.py @@ -18,7 +18,7 @@ def process_audio(input_file: str, augmentations: List[str], output_format: str) augmented_audio, transforms_used = apply_augmentation(audio, sr, augmentations) if len(transforms_used) > 0: - output_filename = output_filename + "_" + "_".join(transforms_used) + output_filename = output_filename + "-aug_" + "_".join(transforms_used) input_dir = os.path.dirname(input_file) output_path = os.path.join(input_dir, f"{output_filename}.{output_format}") save_audio(augmented_audio, output_path, sr, output_format)