Giooorgiooo/TikTok-Voice-TTS

Voice seems to cut at random pace

vichaikj opened this issue ยท 3 comments

Hello,

First of all, thank you for this script ๐Ÿ‘
I noticed an issue where it seems that the audio, once tts, is randomly pausing briefly during a long-enough sentence.

I tried to remove all return lines, and have a clean text, but I still have the issue.

Do you happened to know why ?

I apologize for the late reply.

This is because your text-to-speech text is processed in packets of 300 tokens and not as a whole, since a request to convert a text to audio can have a maximum of 300 tokens. This means that your text is split up first and the audio is bundled together again at the end, which could result in your final audio sounding choppy in some places. This problem will exist:

  1. if there will be no other endpoint that accepts a larger request of text.
  2. there is no other way to create TikTok text-to-speech audio using Python.

This is also the only point that bothered me when creating the project. Unfortunately, you have to live with it.

Maybe we should add a rule. So that in the range of 270 - 300 characters, a point is detected. If there is a point. Then the end of the block and then create go to the next block of 300 characters?
Pardon for my English.

Maybe we should add a rule. So that in the range of 270 - 300 characters, a point is detected. If there is a point. Then the end of the block and then create go to the next block of 300 characters? Pardon for my English.

That was my thought too. I have incorporated this idea into the _split_text method. The following punctuation marks are recognised as separators: .,!?:;- . You can add or remove punctuation marks in the regex expression in the code.