Search Unity

Unity Voice Recognition Issues

Discussion in 'Audio & Video' started by peonix, Oct 6, 2016.

  1. peonix

    peonix

    Joined:
    Oct 6, 2016
    Posts:
    3
    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:

    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using UnityEngine.Windows.Speech;
    4.  
    5. public class VoiceRecognition : MonoBehaviour
    6. {
    7.     public KeywordTemplate kTemplate;
    8.     private KeywordRecognizer m_Recognizer;
    9.  
    10.  
    11.     void Start()
    12.     {
    13.         m_Recognizer = new KeywordRecognizer(kTemplate.m_Keywords,ConfidenceLevel.Low);
    14.         m_Recognizer.OnPhraseRecognized += OnPhraseRecognized;
    15.         m_Recognizer.Start();
    16.     }
    17.  
    18.     private void OnPhraseRecognized(PhraseRecognizedEventArgs args)
    19.     {
    20.         StringBuilder builder = new StringBuilder();
    21.         builder.AppendFormat("{0} ({1}){2}", args.text, args.confidence, Environment.NewLine);
    22.         builder.AppendFormat("\tTimestamp: {0}{1}", args.phraseStartTime, Environment.NewLine);
    23.         builder.AppendFormat("\tDuration: {0} seconds{1}", args.phraseDuration.TotalSeconds, Environment.NewLine);
    24.         Debug.Log(builder.ToString());
    25.     }
    26. }
    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?
     
  2. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    587
    I used Google's speech API after trying out Windows speech recognition and finding it does not work well. Does the Windows built-in translator recognize better than what you are finding from within Unity?
     
  3. peonix

    peonix

    Joined:
    Oct 6, 2016
    Posts:
    3
    According to the Speech-To-Text sample in the asset store, the built in translator is microsoft's. I decided to try using the dictationrecognizer instead but can't seem to get it to work properly. It always gives an UnknownError.
     
  4. ruwido_GP

    ruwido_GP

    Joined:
    Oct 6, 2014
    Posts:
    1
    The DictationCompletionCause.UnknownError received upon request completion seems to be related to your Windows updates. I tried the same piece of code on several devices, with or without updates, and devices which were last updated before October were able to recognize speech.

    The problem does not occur when using the 32-bits version of the Unity Editor, or in a 32-bits build; but will always occur on an updated, 64-bits Windows.

    "Solution" would be to switch Unity to 32-bits (Editor or only your build configuration); or revert the faulty update (don't know which one though).
     
  5. hwkeyser

    hwkeyser

    Joined:
    Apr 14, 2017
    Posts:
    1
    Does anyone have an update on this? I'm trying to add a voice-command to a plugin i'm making, and I don't think I can reasonably ask all of the devs to whom I release it that they should rollback to a 32-bit version of Unity.
     
  6. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    hwkeyser, this issue seems to be fixed after installing the Windows 10 creators update.
     
  7. RealSoftGames

    RealSoftGames

    Joined:
    Jun 8, 2014
    Posts:
    220
    hello, im currently running into an issue, im using windows 10 and PhraseRecognitionSystem.isSupported is returning false, does anyone have a clue to why this is happening.