Spaces:
Running
on
Zero
Running
on
Zero
roychao19477
commited on
Commit
·
d49889f
1
Parent(s):
658a305
Fix spectrogram issue
Browse files
app.py
CHANGED
|
@@ -94,7 +94,9 @@ def enhance(filepath, model_name):
|
|
| 94 |
out = librosa.resample(out, orig_sr=16000, target_sr=orig_sr)
|
| 95 |
|
| 96 |
# Normalize
|
| 97 |
-
|
|
|
|
|
|
|
| 98 |
|
| 99 |
# write file
|
| 100 |
sf.write("enhanced.wav", out, orig_sr)
|
|
|
|
| 94 |
out = librosa.resample(out, orig_sr=16000, target_sr=orig_sr)
|
| 95 |
|
| 96 |
# Normalize
|
| 97 |
+
peak = np.max(np.abs(out))
|
| 98 |
+
if peak > 1e-5:
|
| 99 |
+
out = out / peak * 0.85
|
| 100 |
|
| 101 |
# write file
|
| 102 |
sf.write("enhanced.wav", out, orig_sr)
|