- Home /
Microsoft.Speech.dll being finicky
I've installed this version of Microsoft.Speech.dll: http://www.microsoft.com/en-us/download/details.aspx?id=27226, the x86 version. I've imported it into my unity project, and successfully referenced it in code. However, when I run the program, I get this error:
PlatformNotSupportedException: Speech Recognition is not available on this system. SAPI and Speech Recognition engines cannot be found.
Microsoft.Speech.Internal.SapiInterop.SapiRecognizer..ctor (RecognizerType type) Microsoft.Speech.Recognition.SpeechRecognitionEngine.Initialize (Microsoft.Speech.Recognition.RecognizerInfo recognizerInfo) Microsoft.Speech.Recognition.SpeechRecognitionEngine..ctor () FightVoiceManager.Start () (at Assets/Scripts/Managers/FightVoiceManager.cs:10)
Which is interesting, because this is literally the only code I've created for this before testing:
using UnityEngine;
using System.Collections;
using Microsoft.Speech.Recognition;
public class FightVoiceManager : MonoBehaviour {
SpeechRecognitionEngine sre;
void Start() {
sre = new SpeechRecognitionEngine();
}
}
It does not give me any console errors at all before clicking Play. My syntax is alright. My references are alright. The editor understands where Microsoft.Speech.Recognition is. I'm completely perplexed. If any help could be had, I'd greatly appreciate it. Thanks!
Does.... does your system support speech recognition?
I don't know. How can I find out?
EDIT 1
I've set up my computer for speech, but Unity still claims that it's not, even after reopening Unity.
It fails because a short times a short gets converted to an int32 in the background. This is done to prevent overflow, since it's possible to multiply two shorts and arrive at a number too large to be representable by a short.
If you are certain this does not happen in your code, you have the option to explicitly cast the result back to a short:
this._blockAlign = (short)(this._channelCount * (this._bitsPerSample / 8));
But the compiler cannot do this implicitly for you for above reason. So it gives you an error ins$$anonymous$$d.
Yes, I did check both the 32-bit and 64-bit versions of the .dll, and neither worked, but I do know that that's a mistake that a lot of people make so I don't blame you. I'm pretty sure that it's a problem with the .NET runtime difference between the .dll and Unity and the SAPI engine I have installed on my computer to Unity, as Unity has a runtime of 2.0, but the .dll is 4.5, which is why I'm updating the .dll. Thanks anyway!
Your answer
![](https://koobas.hobune.stream/wayback/20220611233329im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can you force Unity to use Oculus microphone? 0 Answers
Microphone Noise Reduction speech enhancement 1 Answer
Microphone to Gameplay mechanics 1 Answer
Dictation Recognizer does not recognize words 0 Answers
Microphone Input In Background 0 Answers