Exception in SpeechConfig setTempDirectory

Atul 11 Reputation points
2022-07-29T13:50:46.817+00:00

I am running the Java Speech Recognition Samples from https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/samples/java/jre/console
It is working fine on Win 10, however I am getting java.lang.UnsatisfiedLinkError: com.microsoft.cognitiveservices.speech.SpeechConfig.setTempDirectory exception when running on CentOS 7. I have ensured required per-requisite are installed on CentOS 7.

I referred following links for similar issue, however it's not working for me
https://learn.microsoft.com/en-us/answers/questions/660957/text-speech-when-speechconfig-init-got-error.html
https://bytemeta.vip/repo/Azure-Samples/cognitive-services-speech-sdk/issues/1461

Appreciate any pointers/suggestion.

Here is how I am running the sample and getting the exception.

# mvn compile exec:java -Dexec.mainClass="com.microsoft.cognitiveservices.speech.samples.console.Main"  
[INFO] Scanning for projects...  
[INFO]  
[INFO] ------------------------------------------------------------------------  
[INFO] Building SpeechSDKDemo 0.0.1-SNAPSHOT  
[INFO] ------------------------------------------------------------------------  
[INFO]  
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ SpeechSDKDemo ---  
[debug] execute contextualize  
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!  
[INFO] skip non existing resourceDirectory /root/siprec/cognitive-services-speech-sdk/samples/java/jre/console/src/main/resources  
[INFO]  
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ SpeechSDKDemo ---  
[INFO] Nothing to compile - all classes are up to date  
[INFO]  
[INFO] --- exec-maven-plugin:3.0.0:java (default-cli) @ SpeechSDKDemo ---  
 1. Speech recognition with microphone input.  
 2. Speech recognition with microphone input and detailed recognition results  
 3. Speech recognition in the specified language.  
 4. Speech recognition using customized model.  
 5. Speech continuous recognition using events with file.  
 6. Speech recognition with audio stream.  
 7. Speech recognition with keyword spotting.  
 8. Translation with microphone input.  
 9. Translation with file input.  
10. Translation with audio stream.  
11. Intent recognition with microphone.  
12. Intent recognition with language.  
13. Intent continuous recognition using events with file.  
14. Intent Pattern Matching with microphone.  
15. Intent Pattern Matching with microphone and keyword spotting.  
16. Speech continuous recognition using events with a PushStream.  
17. Speech continuous recognition using events with file and Phrase List.  
18. Speech synthesis to speaker output.  
19. Speech synthesis with specified language.  
20. Speech synthesis with specified voice.  
21. Speech synthesis to wave file.  
22. Speech synthesis to mp3 file.  
23. Speech synthesis to pull audio output stream.  
24. Speech synthesis to push audio output stream.  
25. Speech synthesis to result.  
26. Speech synthesis to audio data stream.  
27. Speech synthesis events.  
28. Speech synthesis word boundary event.  
29. Speech synthesis server scenario example.  
30. Speech synthesis with source language auto detection.  
31. Speaker verification with microphone.  
32. Speaker verification with file.  
33. Speaker identification with microphone.  
34. Speaker identification with file.  
35. Speech recognition from default microphone with Microsoft Audio Stack enabled.  
36. Speech recognition from a microphone with Microsoft Audio Stack enabled and pre-defined microphone array geometry specified.  
37. Speech recognition from multi-channel file with Microsoft Audio Stack enabled and custom microphone array geometry specified.  
38. Speech recognition from pull stream with custom set of enhancements from Microsoft Audio Stack enabled.  
39. Speech recognition from push stream with Microsoft Audio Stack enabled and beamforming angles specified.  
40. Pronunciation assessment with microphone input.  
41. Pronunciation assessment with stream input.  
42. Speech synthesis to audio and SRT files.  
43. Recognize once from file, with at-start language detection.  
44. Continuous speech recognition from file, with at-start language detection.  
45. Continuous speech recognition from file, with at-start language detection with custom model.  
46. Continuous speech recognition from file, with continuous language detection with custom models.  
Your choice (0: Stop): 16  
  
[WARNING]  
java.lang.UnsatisfiedLinkError: com.microsoft.cognitiveservices.speech.SpeechConfig.setTempDirectory(Ljava/lang/String;)V  
        at com.microsoft.cognitiveservices.speech.SpeechConfig.setTempDirectory(Native Method)  
        at com.microsoft.cognitiveservices.speech.SpeechConfig.
Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
2,063 questions
{count} votes

2 answers

Sort by: Most helpful
  1. romungi-MSFT 48,906 Reputation points Microsoft Employee Moderator
    2022-07-29T15:38:11.203+00:00

    @Atul One of the issues referenced is actually from the speech SDK repo which is the official repo to report issues with respect to the SDK.
    https://github.com/Azure-Samples/cognitive-services-speech-sdk/issues/1461

    I would request to raise the issue on the same repo so the SDK team could better advice in your scenario for the error message you have received.
    Although, the issue is from setting the temp directory the scenario seems to be slightly different from the referenced issue. From what I understand you have already run the steps required for setting up the SDK on centos7 with the required permissions? If not, could you please check again?

    If an answer is helpful, please click on 130616-image.png or upvote 130671-image.png which might help other community members reading this thread.

    0 comments No comments

  2. xiaomi 0 Reputation points
    2023-05-07T02:43:21.9+00:00

    Can you tell me which software packages are installed on CentOS? I'm encountering the same issue: it runs fine on Windows, but after packaging and running it on CentOS, I receive the same error as you. I hope you can offer some help.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.