要将请求中的'${filteredText}'参数应用在_msg的变量中,可以按照以下步骤进行操作:

  1. 在代码中找到请求的URL字符串:'https://genshinvoice.top/api?speaker=胡桃&text=${filteredText}&format=wav&length=1&noise=0.5&noisew=0.9&sdp_ratio=0.2'。

  2. 找到发送数据的方法SendAudioData,在该方法中找到以下代码行:

UnityWebRequest www = UnityWebRequest.Post(m_SpeechRecognizeURL, form);
  1. 在该代码行之前,添加以下代码行,用于替换URL字符串中的'${filteredText}'参数:
string url = $'https://genshinvoice.top/api?speaker=胡桃&text={filteredText}&format=wav&length=1&noise=0.5&noisew=0.9&sdp_ratio=0.2';
UnityWebRequest www = UnityWebRequest.Post(url, form);
  1. 确保在代码的其他位置定义了filteredText变量,并且该变量的值是请求中的'${filteredText}'参数的实际值。

  2. 重新编译和运行代码,现在请求的URL中的'${filteredText}'参数将被替换为实际的值。

如何在 Unity 中使用 Whisper 语音识别 API 将请求中的 ${filteredText} 参数应用在 _msg 变量中

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

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