gorkemgoknar
commited on
Commit
•
f05e79d
1
Parent(s):
0db6209
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import sys
|
2 |
import os,stat
|
3 |
import subprocess
|
|
|
4 |
from zipfile import ZipFile
|
5 |
|
6 |
# By using XTTS you agree to CPML license https://coqui.ai/cpml
|
@@ -81,7 +82,8 @@ def predict(prompt, language, audio_file_pth, mic_file_path, use_mic,no_lang_aut
|
|
81 |
fast_denoise="afftdn=nr=12:nf=-25"
|
82 |
# better to remove silence in beginning and end for microphone
|
83 |
trim_silence="areverse,atrim=start=0.2,silenceremove=start_periods=1:start_silence=0:start_threshold=0.02,areverse,atrim=start=0.2,silenceremove=start_periods=1:start_silence=0:start_threshold=0.02"
|
84 |
-
|
|
|
85 |
|
86 |
#we will use newer ffmpeg as that has afftn denoise filter
|
87 |
shell_command = f"./ffmpeg -y -i {mic_file_path} -af {lowpass_highpass}{fast_denoise},{trim_silence},loudnorm {out_filename}".split(" ")
|
|
|
1 |
import sys
|
2 |
import os,stat
|
3 |
import subprocess
|
4 |
+
import random
|
5 |
from zipfile import ZipFile
|
6 |
|
7 |
# By using XTTS you agree to CPML license https://coqui.ai/cpml
|
|
|
82 |
fast_denoise="afftdn=nr=12:nf=-25"
|
83 |
# better to remove silence in beginning and end for microphone
|
84 |
trim_silence="areverse,atrim=start=0.2,silenceremove=start_periods=1:start_silence=0:start_threshold=0.02,areverse,atrim=start=0.2,silenceremove=start_periods=1:start_silence=0:start_threshold=0.02"
|
85 |
+
|
86 |
+
out_filename = mic_file_path + str(random.randint(1,9999)) + ".wav" #ffmpeg to know output format
|
87 |
|
88 |
#we will use newer ffmpeg as that has afftn denoise filter
|
89 |
shell_command = f"./ffmpeg -y -i {mic_file_path} -af {lowpass_highpass}{fast_denoise},{trim_silence},loudnorm {out_filename}".split(" ")
|