import ChatTTS import torch import torchaudio chat = ChatTTS.Chat() chat.load(compile=False) # Set to True for better performance texts = ["PUT YOUR 1st TEXT HERE", "PUT YOUR 2nd TEXT HERE"] wavs = chat.infer(texts) for i in range(len(wavs)): """ In some versions of torchaudio, the first line works but in other versions, so does the second line. """ try: torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]).unsqueeze(0), 24000) except: torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]), 24000)