chatterbox-ui/chatterbox-test.py

14 lines
485 B
Python

import torchaudio as ta
from chatterbox.tts import ChatterboxTTS
model = ChatterboxTTS.from_pretrained(device="mps")
text = "Sometimes you have to wonder just what's going on with this crazy fucking world."
#wav = model.generate(text)
#ta.save("test-1.wav", wav, model.sr)
# If you want to synthesize with a different voice, specify the audio prompt
AUDIO_PROMPT_PATH="sample.mp3"
wav = model.generate(text, audio_prompt_path=AUDIO_PROMPT_PATH)
ta.save("test-2.wav", wav, model.sr)