from scipy.io.wavfile import write
from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasks
text = '待合成文本' model_id = 'damo/speech_sambert-hifigan_tts_zhizhe_emo_zh-cn_16k' sambert_hifigan_tts = pipeline(task=Tasks.text_to_speech, model=model_id) output = sambert_hifigan_tts(input=text) pcm = output[OutputKeys.OUTPUT_PCM] write('output.wav', 16000, pcm)
使用modelscope时如何传入情感标签,我按照源码的参数传入,好像不起作用 output = sambert_hifigan_tts(input=text, inputs_emotion=5)
请参考https://help.aliyun.com/document_detail/101645.html#sectiondiv-g6w-isw-rmw
使用SSML emotion标签即可实现添加情感标签。