Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用Cosyvoice2进行情感语音合成 #921

Open
zhanghanweii opened this issue Jan 22, 2025 · 1 comment
Open

使用Cosyvoice2进行情感语音合成 #921

zhanghanweii opened this issue Jan 22, 2025 · 1 comment

Comments

@zhanghanweii
Copy link

在按照论文中的方式合成情感音频时无效,论文中的样例如下:

  • 你能用高兴的情感说吗?< |endofprompt| >今天真是太开心了,马上要放假了!I’m so happy, Spring Festival is coming!

我的代码如下:
import sys
sys.path.append("third_party/Matcha-TTS")
from cosyvoice.cli.cosyvoice import CosyVoice, CosyVoice2
from cosyvoice.utils.file_utils import load_wav
import torchaudio

cosyvoice = CosyVoice2('./CosyVoice2-0.5B', load_jit=False, load_trt=False)

cosyvoice = CosyVoice('./pretrained_models/CosyVoice-300M-Instruct')

prompt_speech_16k = load_wav('xiaojin_5s.wav', 16000)

for i, j in enumerate(cosyvoice.inference_cross_lingual('你能用安慰的情感说吗?同时语速放缓。< |endofprompt| >哎呀,没有抢到回家的票真的会让人很失落呢
,但希望你打起精神,一定还会有其他回家的方法的。', prompt_speech_16k, stream=False)):
torchaudio.save('zero_shot_{}.wav'.format(i), j['tts_speech'], cosyvoice.sample_rate)

上述代码会把整段txt文本进行合成,而没有使用情感描述,请问代码有哪些问题呢

@Aydous
Copy link

Aydous commented Jan 23, 2025

cosyvoice.inference_instruct2('哎呀,没有抢到回家的票真的会让人很失落呢,但希望你打起精神,一定还会有其他回家的方法的。', '你能用安慰的情感说吗?同时语速放缓', prompt_speech_16k, stream=False)
试试这个

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants