li cheng
commited on
Commit
·
4f8e4d2
1
Parent(s):
f609c13
fix
Browse files
xtts.py
CHANGED
@@ -119,13 +119,13 @@ def trim_sample_audio(speaker_wav, threshold=0.005):
|
|
119 |
trim_silence = f"areverse,silenceremove=start_periods=1:start_silence=0:start_threshold={threshold},areverse,silenceremove=start_periods=1:start_silence=0:start_threshold={threshold},"
|
120 |
out_filename=speaker_wav.replace(".wav","_trimed.wav")
|
121 |
shell_command = f"{ffmpeg} -y -i {speaker_wav} -af {lowpass_highpass}{trim_silence} {out_filename}".split(" ")
|
122 |
-
logging.debug(shell_command)
|
123 |
result=subprocess.run(
|
124 |
[item for item in shell_command],
|
125 |
capture_output=True,
|
126 |
text=True,
|
127 |
check=True,
|
128 |
-
stdout=subprocess.DEVNULL,
|
129 |
stderr=None,
|
130 |
)
|
131 |
if result.stderr is not None and "Output file is empty" in result.stderr:
|
@@ -136,6 +136,7 @@ def trim_sample_audio(speaker_wav, threshold=0.005):
|
|
136 |
logging.debug(f'trimed sample wav to {out_filename}')
|
137 |
return out_filename
|
138 |
except:
|
|
|
139 |
logging.debug(f'Error: trimed sample wav to, ignored')
|
140 |
return speaker_wav
|
141 |
|
|
|
119 |
trim_silence = f"areverse,silenceremove=start_periods=1:start_silence=0:start_threshold={threshold},areverse,silenceremove=start_periods=1:start_silence=0:start_threshold={threshold},"
|
120 |
out_filename=speaker_wav.replace(".wav","_trimed.wav")
|
121 |
shell_command = f"{ffmpeg} -y -i {speaker_wav} -af {lowpass_highpass}{trim_silence} {out_filename}".split(" ")
|
122 |
+
logging.debug(" ".join(shell_command))
|
123 |
result=subprocess.run(
|
124 |
[item for item in shell_command],
|
125 |
capture_output=True,
|
126 |
text=True,
|
127 |
check=True,
|
128 |
+
stdout=None, #subprocess.DEVNULL,
|
129 |
stderr=None,
|
130 |
)
|
131 |
if result.stderr is not None and "Output file is empty" in result.stderr:
|
|
|
136 |
logging.debug(f'trimed sample wav to {out_filename}')
|
137 |
return out_filename
|
138 |
except:
|
139 |
+
traceback.print_last()
|
140 |
logging.debug(f'Error: trimed sample wav to, ignored')
|
141 |
return speaker_wav
|
142 |
|