Skip to content

Commit

Permalink
fix: better output filename and aug params
Browse files Browse the repository at this point in the history
  • Loading branch information
pprobst committed Oct 20, 2023
1 parent 8cbc6cf commit 1e74f2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions audio/aug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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},
}
Expand Down
2 changes: 1 addition & 1 deletion run_audio_aug.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1e74f2a

Please sign in to comment.