oscie57 / tiktok-voice

Simple Python script to interact with the TikTok TTS API
535 stars 80 forks source link

tweak: use textwrap to split input text on words rather than in the middle of them #20

Closed jaymo1011 closed 2 years ago

jaymo1011 commented 2 years ago

Instead of blindly splitting the segments of a batch at every 200 characters which usually ended up splitting a word in half, segments are now, where possible, split at the closest word using Python's included text wrapping algorithm. This results in better output for longer input strings as you don't get a word every 20 seconds of speech being pronounced in a b- r- oken way by the TTS engine.

oscie57 commented 2 years ago

seems good!