当我试图配置语音引擎时,它会抛出一个异常;libmicrosoft . cognitivesservices . speech .core。所以汇编:type: member:(null)"从SpeechConfig。FromSubscription方法。如何解决这个问题?到底哪里出了问题?
private async void btnStart_Clicked(object sender, EventArgs e)
{
bool isMicEnabled = await micService.GetPermissionAsync();
if (!isMicEnabled)
{
return;
}
if (recognizer == null)
{
var config = SpeechConfig.FromSubscription(GlobalData.CognitiveServicesApiKey, GlobalData.CognitiveServicesRegion);
recognizer = new SpeechRecognizer(config);
recognizer.Recognized += (obj, args) =>
{
ReceiveTranscription(args.Result.Text);
};
}
if (isTranscribing)
{
try
{
await recognizer.StopContinuousRecognitionAsync();
}
catch (Exception)
{
}
isTranscribing = false;
}
else
{
try
{
await recognizer.StartContinuousRecognitionAsync();
}
catch (Exception)
{
}
isTranscribing = true;
}
UpdateDisplayState();
}
肯定会出现演讲。核心二进制文件不可用。根据本演练,可能没有正确安装nuget包:https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstarts/setup-platform?tabs=xaml%2Clinux%2Cjre%2Cbrowser&pivots=programming-language-csharp