2noise / ChatTTS

A generative speech model for daily dialogue.
https://2noise.com
GNU Affero General Public License v3.0
32.22k stars 3.5k forks source link

There was a problem with the word order of the text generated by ChatTTS #625

Open soyh opened 3 months ago

soyh commented 3 months ago

I found that there was a problem with the word order of the text generated by ChatTTS, and when I generated the sound, the next few words/Chinese characters would be recited at the beginning

Code info:

import ChatTTS
import torch
import torchaudio

chat = ChatTTS.Chat()
chat.load(source='local',force_redownload=False,compile=False,custom_path=r"asset/GPT.pt",device=torch.device("cuda:0"),coef=None) # Set to True for better performance

texts = [" I am happy to join with you today in what will go down in history as the greatest demonstration for freedom in the history of our nation."]

wavs = chat.infer(texts)

for i in range(len(wavs)):
    torchaudio.save(f"basic_output{i}.wav", torch.from_numpy(wavs[i]).unsqueeze(0), 22000)
fumiama commented 3 months ago

There's a leading space ` in your text, which may cause this problem. Also, the sample rate should be24000, not22000`.