在Azure Linux应用程序上,使用Blazor Server在CognitiveServices语音中的错误
在App Service(Linux和.NET 6.0)上安装Blazor应用程序后,除了CognitiveServices外,一切都很好。
该代码在语音识别仪的构造函数中引发了一个例外:
SpeechConfig speechConfig = SpeechConfig.FromSubscription("<key>", "<region>");
AudioConfig audioConfig = AudioConfig.FromDefaultMicrophoneInput();
var recognizer = new SpeechRecognizer(speechConfig, audioConfig);
_recognizer.Recognized += Recognizer_Recognized;
错误:System.ApplicationException:异常具有错误代码:0x38 (spxerr_audio_sys_library_not_found) Microsoft.cognitiveservices.speech.internal.spxexceptionthroter.throwiffail(intptr hr)at Microsoft.cognitiveservices.speech.recognizer.fromconfig(getRecognizerfromconfigdelegate 来自Config,SpeechConfig SpeechConfig,AudioConfig AudioConfig) Microsoft.CognitiveServices.speech.speechRecognizer..ctor(SpeechConfig SpeechConfig,AudioConfig AudioConfig)
该代码在Visual Studio 2022(当然)(当然)本地运行。
安装软件包显示了必要的DLL/SO文件,
请提供帮助。
After installing the Blazor App on App service (Linux and .net 6.0) everything works fine, except the CognitiveServices.
The code throws an exception in de constructor of SpeechRecognizer:
SpeechConfig speechConfig = SpeechConfig.FromSubscription("<key>", "<region>");
AudioConfig audioConfig = AudioConfig.FromDefaultMicrophoneInput();
var recognizer = new SpeechRecognizer(speechConfig, audioConfig);
_recognizer.Recognized += Recognizer_Recognized;
error: System.ApplicationException: Exception with an error code: 0x38
(SPXERR_AUDIO_SYS_LIBRARY_NOT_FOUND) at
Microsoft.CognitiveServices.Speech.Internal.SpxExceptionThrower.ThrowIfFail(IntPtr
hr) at
Microsoft.CognitiveServices.Speech.Recognizer.FromConfig(GetRecognizerFromConfigDelegate
fromConfig, SpeechConfig speechConfig, AudioConfig audioConfig) at
Microsoft.CognitiveServices.Speech.SpeechRecognizer..ctor(SpeechConfig
speechConfig, AudioConfig audioConfig)
The code runs fine locally from Visual Studio 2022 (of course).
The installation packages shows the necessary dll/so files
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到答案: https://github.com/azure-com./azure-com./azure-comle- samples/Cognitive-Services-Speech-sdk/essem/517
“ Azure App Service在云中的服务器上运行。这些服务器没有麦克风(因为麦克风将在数据插座中的某个地方是客户无法实际上,如果您想创建一个Web应用程序供您的客户使用浏览器/Web的麦克风,则应使用SDK的JavaScript版本,并嵌入JS代码。”
Found the answer: https://github.com/Azure-Samples/cognitive-services-speech-sdk/issues/517
"Azure App Service runs on servers in the cloud. Those servers don't have microphones (since the microphones would be somewhere in the datacetner were customers can't physically go). If you wish to create a web app for your customers to use the microphone from the browser/web, you should use the javascript version of the SDK, and embedd that js code into your web page."