Wrote a utility script to help process large text files for longer narration. #3801
TheMechanicX32
started this conversation in
General
Replies: 3 comments
-
Thanks! is very Useful! 😎👌 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Very useful, and nice code! Exactly what I was looking for. 💯👌 |
Beta Was this translation helpful? Give feedback.
0 replies
-
I was trying to make this for a week I did it but still running into some bug with non-ascii this is really helpful thanks |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Good morning all!
I wrote this helper function to help me generate audio from long text files. Here is the script:
Usage:
Create a new python script and call it
text.py
(or whatever suits your needs). Drop it in the same directory as the script you use to run XTTS. Inside your run script, import the function fromtext.py
like so:from text import split_text_into_chunks;
To use the text splitter, pull data from a text file and pipe it into the
split_text_into_chunks()
function like so:I have to use
torchaudio
to concatenate all my audio files together after the script finishes generating all the audio segments. My finalrun.py
script looks like this:This utility script I wrote splits the text file into sentences. It does it's hardest to avoid splitting in the middle of a sentence, which causes really strange flow in the final product. Makes the audio hard to follow while listening. Generally speaking, the tts model does best with sentences that are not abnormal. Clear, concise, neat grammar is rewarded here. The utility function relies on correct punctuation. Let me know if you have any questions. I don't check github too often, but I'll try to be more active in this thread.
Beta Was this translation helpful? Give feedback.
All reactions