Spaces:
Sleeping
Sleeping
Update src/audio_preprocessing.py
Browse files
src/audio_preprocessing.py
CHANGED
|
@@ -149,6 +149,12 @@ def assess_pronunciation_quality(dist_matrix, path, threshold=0.4, wav_type="ref
|
|
| 149 |
def denoise_audio(input_audio_path):
|
| 150 |
assert isinstance(input_audio_path, str), "Input path must be a string"
|
| 151 |
output_audio_path = input_audio_path.replace(".wav", "_denoised.wav")
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
def denoise_audio(input_audio_path):
|
| 150 |
assert isinstance(input_audio_path, str), "Input path must be a string"
|
| 151 |
output_audio_path = input_audio_path.replace(".wav", "_denoised.wav")
|
| 152 |
+
try:
|
| 153 |
+
result = subprocess.run(["denoise", input_audio_path, output_audio_path, "--plot"], check=True, capture_output=True, text=True)
|
| 154 |
+
print(result.stdout)
|
| 155 |
+
except subprocess.CalledProcessError as e:
|
| 156 |
+
print(f"Error: {e}")
|
| 157 |
+
print(f"Stdout: {e.stdout}")
|
| 158 |
+
print(f"Stderr: {e.stderr}")
|
| 159 |
+
# just for testing, revert to output_audio_path once fixed.
|
| 160 |
+
return input_audio_path
|