Pull Text from .TXT file using Colab #244
Replies: 1 comment
-
Cell 1`!pip3 install -U scipy !git clone https://github.com/jnordberg/tortoise-tts.git import torch import IPython from tortoise.api import TextToSpeech tts = TextToSpeech() import os Cell 2`# upload at least 2 audio clips. They must be a WAV file, 6-10 seconds long. custom_voice_folder = f"tortoise/voices/{CUSTOM_VOICE_NAME}" Cell 3uploaded = files.upload() Break text into chunks of 100 characterstext_chunks = [text[i:i+100] for i in range(0, len(text), 100)] Pick a "preset mode" to determine quality. Options: {"ultra_fast", "fast" (default), "standard", "high_quality"}. See docs in api.pypreset = "high_quality" Generate speech for each chunk of textfor i, chunk in enumerate(text_chunks): Combine all generated speech files into a single filecombined = [] Save and play the combined speech filetorchaudio.save(f'generated-{CUSTOM_VOICE_NAME}.wav', combined, 24000) |
Beta Was this translation helpful? Give feedback.
-
In Colab can you add the code to a cell to pull the Text from a .TXT file as opposed to copying and pasting ?
This is available in the installed PC method but not in the Colab.
Thank you.
PS: Are there any 'Voice' repositories available other than what is in the Colab? (.WAV)
Beta Was this translation helpful? Give feedback.
All reactions