JustinLiongChingHui-4322 avatar image
0 Votes"
JustinLiongChingHui-4322 asked JustinLiongChingHui-4322 commented

Using Speech SDK of Cognitive Services on Unity with .NET Standard 2.0

Hello, I am trying to implement the Speech SDK (specifically using the Pronunciation Assessment service so I can't use REST - there doesn't seem to be any for it) on Unity 2020.3;

I referred to the instructions under the ReadME file from the link:
(inclusive of the Plugin downloads and import into unity's "Assets/Plugin" path)

However, the instructions included that I need to change my Scripting backend to IL2CPP and Api Compatibility Level to .NET 4.x;
Which I don't wish to change as it affects other packages I have used in the project. I'm using Mono & .NET standard 2.0 for the settings as of now.

I have tried importing only the DLL file from NUGET package inside the netstandard2.0 folder into the project, the file name of which is Microsoft.CognitiveServices.Speech.csharp.dll, but it gives me an error:
"DllNotFoundException: Microsoft.CognitiveServices.Speech.core.dll"

Is there any way to work around this?

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@JustinLiongChingHui-4322 I think you have raised the issue also with the repo, Adding the issue you already created on git repo for reference.
Just curious to understand if it works with the requirements in the README page mentioned?

0 Votes 0 ·

Hi! Sorry thought it could get help from more people so I posted the issue there as well.

Inside the Unity Editor (when played) 2020.3 it worked without any error, and Pronunciation Assessment returned desired results as well.
However after I build it into an APK it would give error message: 200250-image.png

The Test_PronunAssessment is my Unity script to handle the cognitive services; the error happens at my attempt to initialize either one of the Audio Config, Speech Config or SpeechRecognizer object, which I assume is all required in the DLL needed but not found according to the error message

0 Votes 0 ·
image.png (47.6 KiB)


After some discussion with the team we decided to move to .NET 4.x instead of staying in .NET standard 2.0. So not a big problem on that anymore...
However after I set up everything (.NET 4.x API compatibility, IL2CPP for backend scripting, importing the SpeechSDK plugins into project folder), I encountered another error that says:

I have inspected the error point and apparently it had something to do with the:

 var pronunciationAssessmentResult = PronunciationAssessmentResult.FromResult(speechRecognitionResult);

0 Votes 0 ·
image.png (20.8 KiB)

0 Answers