from utils.bert_vits2_utils import TextToSpeech
import soundfile as sf
tts = TextToSpeech()
tts.print_speakers_info()

audio, sample_rate= tts.synthesize("你好，我好开心",        # 文本
                                   0,                      # 说话人 id
                                   style_text="我很难过！！！！呜呜呜！！！",   # 情绪prompt，当language=="ZH" 才有效 
                                   style_weight=0.9,        # 情绪prompt权重
                                   language="mix",          # 语言类型，包括 "ZH" "EN" "mix"
                                   en_ratio=1.)             # mix语言类型下，英文文本速度，越大速度越慢
save_path = "./tmp2.wav"
sf.write(save_path, audio, sample_rate)