Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
SWivid committed Nov 4, 2024
1 parent 8718b1d commit 4a69e6b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/f5_tts/infer/utils_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def load_model(
def remove_silence_edges(audio, silence_threshold=-42):
# Remove silence from the start
non_silent_start_idx = silence.detect_leading_silence(audio, silence_threshold=silence_threshold)
audio = audio[non_silent_start_idx :]
audio = audio[non_silent_start_idx:]

# Remove silence from the end
non_silent_end_duration = audio.duration_seconds
Expand Down Expand Up @@ -272,6 +272,7 @@ def preprocess_ref_audio_text(ref_audio_orig, ref_text, clip_short=True, show_in
if len(aseg) > 15000:
aseg = aseg[:15000]
show_info("Audio is over 15s, clipping short. (3)")

aseg = remove_silence_edges(aseg) + AudioSegment.silent(duration=50)
aseg.export(f.name, format="wav")
ref_audio = f.name
Expand Down

0 comments on commit 4a69e6b

Please sign in to comment.