你可以按照以下方式将参数改写:

public string GenerateTextToSpeech(string lang, string name, string style, int styleDegree, string text)
{
    string xml = string.Format(@'<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis'
        xmlns:mstts='https://www.w3.org/2001/mstts' xml:lang='{0}'>
        <voice name='{1}'>
            <mstts:express-as style='{2}' styledegree='{3}'>
                {4}
            </mstts:express-as>
        </voice>
    </speak>', lang, name, style, styleDegree, text);

    return xml;
}

这样,你可以使用新的方法来生成一个 XML 字符串,而不再使用之前的 URL 参数形式的生成方式。

C# 生成语音合成 XML 字符串的改进方法

原文地址: https://www.cveoy.top/t/topic/jD3m 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录