1 注册链接
https://developer.nuance.com/public/index.php?task=mixregister
2 找到Sandbox Credentials
具体位置在MyCount->Sandbox Credentials
3 找到 Http Interface Applications
里面记录了调用api时需要的数据。
ASR代表语音识别
TTS代表文本转语音
4 接入API
private void GetASR()
{
string url = StringUtils.GetStringBuilderFromPool().AppendFormat("{0}?{1}={2}&{3}={4}&{5}={6}",
api,
"appId", app_id,
"appKey", app_key,
"id", SystemInfo.deviceUniqueIdentifier).ToString();
Uri tokenUri = new Uri(url);
HTTPRequest httpRequestToken = new HTTPRequest(tokenUri,HTTPMethods.Post ,OnRequestASRFinished);
httpRequestToken.AddHeader(ASRConst.ContentTypeKey, "audio/x-wav;codec=pcm;bit=16;rate=8000");
httpRequestToken.AddHeader("Accept", "text/plain");
httpRequestToken.AddHeader("Accept-Language", "cmn-CHN");
httpRequestToken.AddHeader("Accept", "text/plain");
httpRequestToken.AddHeader("Accept-Topic", "Dictation");
httpRequestToken.AddHeader("X-Dictation-NBestListSize", "10");
byte[] audio = record.AudioClipToBytes();
httpRequestToken.AddHeader("Content-Length", audio.Length.ToString());
httpRequestToken.RawData = audio;
httpRequestToken.Send();
}