Open SoftologyPro opened 1 month ago
try this code https://github.com/2noise/ChatTTS/pull/35/files
Thanks, that works.
import ChatTTS
import scipy
from IPython.display import Audio
chat = ChatTTS.Chat()
chat.load_models()
texts = ["This is a test of the ChatTTS script. Peter Piper picked a peck of pickled peppers. Red leather. Yellow leather. Red leather. Yellow leather. Red leather. Yellow leather.",]
wavs = chat.infer(texts, use_decoder=True)
Audio(wavs[0], rate=24_000, autoplay=True)
scipy.io.wavfile.write(filename = "output.wav", rate = 24_000, data = wavs[0].T)
This will work as well.
import ChatTTS
from IPython.display import Audio
chat = ChatTTS.Chat()
chat.load_models()
texts = ["This is a test of the ChatTTS script. ",]
wavs = chat.infer(texts, use_decoder=True)
Audio(wavs[0], rate=24_000, autoplay=True)
audio_data = Audio(wavs[0], rate=24_000, autoplay=True).data
with open("speech.wav", "wb") as f:
f.write(audio_data)
For your example, how do I save the result to a wav or mp3 file?
For Windows, I had to use the following packages and versions for the environment so the script ran without errors. This may help other Windows users.