fix: fixed audio error

fix: mp3 error
fixes #76
fixes #71
pull/418/head
Jason 3 years ago
parent 6729cba965
commit 0c1ccebb12

@ -13,6 +13,7 @@ from requests.adapters import HTTPAdapter, Retry
# pf = ProfanityFilter()
# Code by @JasonLovesDoggo
# https://twitter.com/scanlime/status/1512598559769702406
nonhuman = [ # DISNEY VOICES
"en_us_ghostface", # Ghost Face
"en_us_chewbacca", # Chewbacca
@ -86,12 +87,12 @@ class TTTTSWrapper: # TikTok Text-to-Speech Wrapper
)
chunks = [
m.group().strip() for m in re.finditer(r" *((.{0,200})(\.|.$))", req_text)
m.group().strip() for m in re.finditer(r" *((.{0,299})(\.|.$))", req_text)
]
audio_clips = []
cbn = sox.Combiner()
cbn.set_input_format(file_type=["mp3"])
cbn.set_input_format(file_type=["mp3" for _ in chunks])
chunkId = 0
for chunk in chunks:
@ -129,7 +130,7 @@ class TTTTSWrapper: # TikTok Text-to-Speech Wrapper
for clip in audio_clips:
i = audio_clips.index(clip) # get the index of the clip
audio_clips = (
audio_clips[:i] + [AudioFileClip(clip)] + audio_clips[i + 1 :]
audio_clips[:i] + [AudioFileClip(clip)] + audio_clips[i + 1:]
) # replace the clip with an AudioFileClip
audio_concat = concatenate_audioclips(audio_clips)
audio_composite = CompositeAudioClip([audio_concat])

Loading…
Cancel
Save