Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -169,6 +169,7 @@ async def generate_audio_with_voice_prefix(text_segment, default_voice, rate, pi
|
|
| 169 |
rate_str = f"{current_rate:+d}%"
|
| 170 |
pitch_str = f"{current_pitch:+d}Hz"
|
| 171 |
communicate = edge_tts.Communicate(processed_text, current_voice_short, rate=rate_str, pitch=pitch_str)
|
|
|
|
| 172 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
|
| 173 |
audio_path = tmp_file.name
|
| 174 |
await communicate.save(audio_path)
|
|
@@ -225,9 +226,9 @@ async def transcript_to_speech(transcript_text, voice, rate, pitch):
|
|
| 225 |
for path in audio_paths:
|
| 226 |
try:
|
| 227 |
audio = AudioSegment.from_mp3(path)
|
| 228 |
-
audio = strip_silence(audio, silence_thresh=-40, min_silence_len=100)
|
| 229 |
combined_line_audio += audio
|
| 230 |
-
combined_line_audio = strip_silence(combined_line_audio, silence_thresh=-40, min_silence_len=100)
|
| 231 |
os.remove(path)
|
| 232 |
except FileNotFoundError:
|
| 233 |
print(f"Warning: Audio file not found: {path}")
|
|
|
|
| 169 |
rate_str = f"{current_rate:+d}%"
|
| 170 |
pitch_str = f"{current_pitch:+d}Hz"
|
| 171 |
communicate = edge_tts.Communicate(processed_text, current_voice_short, rate=rate_str, pitch=pitch_str)
|
| 172 |
+
communicate = strip_silence(communicate, silence_thresh=-40, min_silence_len=100)
|
| 173 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp_file:
|
| 174 |
audio_path = tmp_file.name
|
| 175 |
await communicate.save(audio_path)
|
|
|
|
| 226 |
for path in audio_paths:
|
| 227 |
try:
|
| 228 |
audio = AudioSegment.from_mp3(path)
|
| 229 |
+
#audio = strip_silence(audio, silence_thresh=-40, min_silence_len=100)
|
| 230 |
combined_line_audio += audio
|
| 231 |
+
#combined_line_audio = strip_silence(combined_line_audio, silence_thresh=-40, min_silence_len=100)
|
| 232 |
os.remove(path)
|
| 233 |
except FileNotFoundError:
|
| 234 |
print(f"Warning: Audio file not found: {path}")
|