Utoljára aktív 1730823783

ChatTTS-12.py Eredeti
1import ChatTTS
2import torch
3import torchaudio
4
5chat = ChatTTS.Chat()
6chat.load(compile=False) # Set to True for better performance
7
8texts = ["PUT YOUR 1st TEXT HERE", "PUT YOUR 2nd TEXT HERE"]
9
10wavs = chat.infer(texts)
11
12for i in range(len(wavs)):
13 """
14 In some versions of torchaudio, the first line works but in other versions, so does the second line.
15 """
16 try:
17 torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]).unsqueeze(0), 24000)
18 except:
19 torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]), 24000)