Issue :: Microsoft Cognitive Services :: client-sdk :: Azure



我正在尝试使用Azure认知服务,并尝试将"文本"转换为"语音"。我能够在本地机器上成功地将文本转换为语音。只有当我使用"应用服务"将应用程序部署到Azure云时,才会出现这个问题。当我的代码试图创建SpeechConfig时,我得到以下错误/异常;

例外:如果

我在Azure云上使用以下技术堆栈:Spring Boot 2.6.7Linux(Tomcat嵌入式容器)用于Spring Boot。Client-jar-sdk 1.14.0 (com.microsoft. cognitivesservices .speech)

I amNOT在本例中使用任何容器或容器服务,如Kubernetes。它是一个使用应用程序服务部署到Azure的简单web应用程序。

注1:请注意,我也尝试使用微软认知服务客户端sdk(1.21.0),但我得到同样的异常。我上了谷歌,发现其他人也面临着同样的问题,但没有一个令人满意的答案。

https://learn.microsoft.com/en-us/answers/questions/660957/text-speech-when-speechconfig-init-got-error.html

注2:请注意,我是而不是使用免费订阅,资源组区域为eastus.

注3:我已经尝试并部署了许多代码示例(用于文本到语音),提供了我的微软和互联网上的其他人,但我在Azure平台ONLY中遇到了同样的问题.

异常快照:下面是异常快照

异常细节:2022 - 05 - 14 - t18:17:32.734458231z 164 18:17:32.733错误2022-05-14 (p - nio - 80 - exec - 7] o.a.c.c.C。[。[[/]。[dispatcherServlet]: servlet .service()为servlet [dispatcherServlet]在上下文与路径[]抛出异常[处理器调度失败;嵌套异常是java.lang. unsatisfiedlinkerror:带有根本原因的字符串,java.lang.String)']2022 - 05 - 14 - t18:17:32.734496431z2012-05-14 t18:17:32. 734502131z java.lang. unsatisfiedlinkerror: 'long com.microsoft.cognitiveservices.speech.SpeechConfig.fromSubscription(com.microsoft.cognitiveservices.speech.util.IntRef, java.lang. unsatisfiedlinkerror)字符串,以)2012-05-14 t18:17:32. 734506931z at com.microsoft.cognitiveservice .speech. speechconfig . fromsubscription(本机方法)~[client-jar-sdk-1.14.0.jar!]/na):2012-05-14 t18:17:32. 734511832z at com. microsoft.cognitivesservices .speech. speechconfig . fromsubscription (speech. config .java:103) ~[client-jar-sdk-1.14.0.jar!]/na):2017-05-14 t18:17:32. 734516232z at com. namepronounce .service. azuretexttospeechhelper . callazuretotransformtexttospeech (AzureTextToSpeechHelper.java:24) ~[classes!/:0.0.1-SNAPSHOT]2012-05-14 t18:17:32. 734520732z at com. namepronunciationservice .service (NamePronunciationService.java:28) ~[classes!/:0.0.1-SNAPSHOT]2012-05-14 t18:17:32 . 734524832z at com. namepronunciationcontroller .controller. nampronunciationcontroller .java:81) ~[classes!/:0.0.1-SNAPSHOT]2017-05-14 t18:17:32. 734529232z . java.base/jdk.internal.reflect. nativeemethodaccessorimpl .invoke0(本机方法)~[na:na]2022 - 05 - 14 - t18:17:32.734533332z

谢谢!Mansoor

  • 在创建流类之前,确保至少调用一次SpeechConfig.fromSubscription(KEY, REGION)(或其他from*()函数之一)。
  • 原因是语音sdk只在"入口"处加载本机dll。类,如语音配置或识别类。

  • Text Speech when SpeechConfig init got error
    java.lang。
    Azure语音服务无法使用

最新更新