Hello, I’ve been toying with unity’s native window’s voice recognition. I’ve been using the KeywordRecognizer to try to pick up words spoken by the user. The problem is it’s fine if I say the specific keyword alone by itself, but said in a sentence it doesn’t pick it up. For example here’s my script, based on the API:
using System;
using UnityEngine;
using UnityEngine.Windows.Speech;
public class VoiceRecognition : MonoBehaviour
{
public KeywordTemplate kTemplate;
private KeywordRecognizer m_Recognizer;
void Start()
{
m_Recognizer = new KeywordRecognizer(kTemplate.m_Keywords,ConfidenceLevel.Low);
m_Recognizer.OnPhraseRecognized += OnPhraseRecognized;
m_Recognizer.Start();
}
private void OnPhraseRecognized(PhraseRecognizedEventArgs args)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat("{0} ({1}){2}", args.text, args.confidence, Environment.NewLine);
builder.AppendFormat("\tTimestamp: {0}{1}", args.phraseStartTime, Environment.NewLine);
builder.AppendFormat("\tDuration: {0} seconds{1}", args.phraseDuration.TotalSeconds, Environment.NewLine);
Debug.Log(builder.ToString());
}
}
so I have “Hi”, “Hello” and “Ok” as my keywords. Saying them individually is detected fine, but saying into the mic, “Hi There!” or “Hello There!”, “ok i’ll do it” doesn’t detect the word hi, hello or ok respectively. On the other hand, saying “is everything ok?” or “why hello!” works (it detects ok and hello respectively). Any thoughts anyone?