在Azure Linux应用程序上,使用Blazor Server在CognitiveServices语音中的错误

发布于 2025-01-29 01:26:20 字数 959 浏览 4 评论 0原文

在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风蛊 2025-02-05 01:26:20

找到答案: 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."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文