I'm trying out unity's built in speech recognition API, but I'm only getting this error message:
*UnityException: Speech recognition is not supported on this machine. UnityEngine.Windows.Speech.DictationRecognizer..ctor (ConfidenceLevel minimumConfidence, DictationTopicConstraint topic) (at C:/buildslave/unity/build/Runtime/Export/Windows/Speech.cs:316) UnityEngine.Windows.Speech.DictationRecognizer..ctor () (at C:/buildslave/unity/build/Runtime/Export/Windows/Speech.cs:300) Recognizer.Start () (at Assets/Scripts/Recognizer.cs:20)*
I was trying it out with unity's own sample code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Windows.Speech;
public class Recognizer : MonoBehaviour {
[SerializeField]
private Text hypotheses;
[SerializeField]
private Text recognitions;
DictationRecognizer dictationRecognizer;
// Use this for initialization
void Start()
{
dictationRecognizer = new DictationRecognizer();
dictationRecognizer.DictationResult += (text, confidence) =>
{
Debug.LogFormat("Dictation result: {0}", text);
recognitions.text += text + "\n";
};
dictationRecognizer.DictationHypothesis += (text) =>
{
Debug.LogFormat("Dictation hypothesis: {0}", text);
hypotheses.text += text;
};
dictationRecognizer.DictationComplete += (completionCause) =>
{
if (completionCause != DictationCompletionCause.Complete)
Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completionCause);
};
dictationRecognizer.DictationError += (error, hresult) =>
{
Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult);
};
dictationRecognizer.Start();
}
// Update is called once per frame
void Update () {
}
}
I'm using Windows 10, I know the speech recognizer works, I've enabled it, I got the correct langugage package, I can talk with cortana etc. The problem seems to be only in unity. I read somewhere about a microphone setting in player settings under project settings, but there are no microphone settings there. I'm thankful for some help.
↧