Views
No views yet
1from TTS.api import TTS
2tts = TTS("tts_models/multilingual/multi-dataset/xtts_v1").to("cuda")
3
4# Generate speech by cloning a voice using default settings
5tts.tts_to_file(
6 text="It took me quite a long time to develop a voice, and now that I have it I'm not going to be silent.",
7 file_path="output.wav",
8 speaker_wav="/path/to/target/speaker.wav",
9 language="en"
10)
11
12# Generate speech by cloning a voice using custom settings
13tts.tts_to_file(
14 text="It took me quite a long time to develop a voice, and now that I have it I'm not going to be silent.",
15 file_path="output.wav",
16 speaker_wav="/path/to/target/speaker.wav",
17 language="en",
18 decoder_iterations=30
19)1 tts --model_name tts_models/multilingual/multi-dataset/xtts_v1 \
2 --text "Bugün okula gitmek istemiyorum." \
3 --speaker_wav /path/to/target/speaker.wav \
4 --language_idx tr \
5 --use_cuda true1from TTS.tts.configs.xtts_config import XttsConfig
2from TTS.tts.models.xtts import Xtts
3
4config = XttsConfig()
5config.load_json("/path/to/xtts/config.json")
6model = Xtts.init_from_config(config)
7model.load_checkpoint(config, checkpoint_dir="/path/to/xtts/", eval=True)
8model.cuda()
9
10outputs = model.synthesize(
11 "It took me quite a long time to develop a voice and now that I have it I am not going to be silent.",
12 config,
13 speaker_wav="/data/TTS-public/_refclips/3.wav",
14 gpt_cond_len=3,
15 language="en",
16)