Spaces:
Running
on
A10G
Running
on
A10G
Update audio.py
Browse files
audio.py
CHANGED
@@ -57,14 +57,14 @@ def gen_audio(subtitles, tmpdir):
|
|
57 |
duration = end_time - start_time
|
58 |
|
59 |
# tts = gTTS(text=text, lang='yue')
|
60 |
-
audio_path = os.path.join(temp_audio_path, f'subtitle_{i}.
|
61 |
# tts.save(audio_path)
|
62 |
ms_tts_gen(text, audio_path)
|
63 |
|
64 |
-
audio_segment = AudioSegment.
|
65 |
|
66 |
-
new_audio_path = os.path.join(temp_audio_path, f'subtitle_{i}_adjusted.
|
67 |
-
audio_segment.export(new_audio_path, format="
|
68 |
|
69 |
audio_clip = AudioFileClip(new_audio_path).set_start(start_time).set_duration(min(duration, audio_segment.duration_seconds))
|
70 |
|
|
|
57 |
duration = end_time - start_time
|
58 |
|
59 |
# tts = gTTS(text=text, lang='yue')
|
60 |
+
audio_path = os.path.join(temp_audio_path, f'subtitle_{i}.mp3')
|
61 |
# tts.save(audio_path)
|
62 |
ms_tts_gen(text, audio_path)
|
63 |
|
64 |
+
audio_segment = AudioSegment.from_mp3(audio_path)
|
65 |
|
66 |
+
new_audio_path = os.path.join(temp_audio_path, f'subtitle_{i}_adjusted.mp3')
|
67 |
+
audio_segment.export(new_audio_path, format="mp3")
|
68 |
|
69 |
audio_clip = AudioFileClip(new_audio_path).set_start(start_time).set_duration(min(duration, audio_segment.duration_seconds))
|
70 |
|