Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Windows] Voice Recognition Server with KeyBoard emulation.

Discussion in 'Assets and Asset Store' started by ZJP, Jan 1, 2015.

  1. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    ***********************************************************
    EDIT :
    12-18-15 NEW VERSION !!!
    ***********************************************************

    Hi,

    A small application that allows voice recognition from a grammar file (grammar.txt who should be in the same directory as the server).
    The application uses the Windows API. It works under Vista 32/64, Win7 32/64, and maybe on Win8. (For XP, need probably install additional libraries.)
    The server is multi-language. It use the default recognition language installed on the system. Of course, the grammar used must be consistent with it.

    http://www.devmoons.net/OLDSERVER/pubip/reco_serveur_keyboard_source.zip
    http://www.devmoons.net/OLDSERVER/pubip/RecoServeur_project.zip
    http://www.devmoons.net/OLDSERVER/pubip/reco_serveur_keyboard.zip
    http://www.devmoons.net/OLDSERVER/pubip/RecoServer.zip


    #C >> 'Magic' word pronounced that close the Server. (This word must be present in the grammar.txt).
    #S >> 'Magic' word pronounced that ENABLE the Keyboard Emulation. The focused application (Unity or Other) can receive character from the server. (This word must be present in the grammar.txt)
    #E >> 'Magic' word pronounced that DISABLE the Keyboard Emulation.(This word must be present in the grammar.txt)
    #V >> Validation recognition. 0 to 100%. 70 is a good number
    #D >> Display (verbose) mode
    #N >> Add a 'NewLine Char \n' after the reconized word/sentence. New !!!
    # >> To add a comment.

    Example of 'grammar.txt'

    #C Close
    #S Enable
    #E Disable
    #V 70
    #N

    Hello
    Good morning
    My name is Smith
    Computer
    Forward
    Backward
    Jump
    Cover
    Open a channel
    Close the scene
    Move your body my friend. It's Unity
    Left
    Right
    Close
    Enable
    Disable


    Example of code with GetKeyDown. For more than one character and the CR, have a look to inputSting http://docs.unity3d.com/ScriptReference/Input-inputString.html

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class testVoiceGet : MonoBehaviour
    6. {
    7.    public string voiceInput;
    8.  
    9.    void Start()
    10.    {
    11.      Debug.Log("Waiting for voice input !!!");
    12.    }
    13.  
    14.    void Update()
    15.    {
    16.      foreach (char c in Input.inputString)
    17.      {
    18.        if (c == "\n"[0] || c == "\r"[0])
    19.        {
    20.          Debug.Log(voiceInput);
    21.          voiceInput = "";
    22.        }
    23.        voiceInput = voiceInput + c;
    24.      }
    25.    }
    26. }
    27.  
    28.  
    29.  
    You can just open the NotePad for trying the server. Remember, after enabled the emulation, the server will send a sentence to every focused application.


    Speech Training :

    http://www.gilsmethod.com/train-windows-7-understand-speech
    http://windows.microsoft.com/en-us/windows/set-speech-recognition#1TC=windows-7




    Happy new year... :)

    Edit 12-18-15.
    Happy Christmas
    . :p

    Edit 30/11/16
    New Download links.
     
    Last edited: Dec 1, 2016
  2. SirMeepington

    SirMeepington

    Joined:
    Apr 10, 2014
    Posts:
    1
    One question.. How would I install or implement this and make it run on game start?
     
  3. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
  4. basketbozo

    basketbozo

    Joined:
    Oct 15, 2013
    Posts:
    1
    ZJP, thank you for this. This is fantastic, but I am having trouble getting the keycode registered in Unity for some reason.

    I have the Reco server up and running, have it properly drawing from the grammar file and sending designated keycodes on voice recognition to every program but the actual Unity game... both game view and builds...

    WordPad, chrome, other tabs in Unity, and every other text box can all see the keycode, but the actual game will not register it. When I press the actual key, the desired result happens so I know it is not my Unity GetKeyDown... I can't understand why it would work as a keycode everywhere except in a Unity game. Any ideas?
     
  5. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    :confused:
    I'll find out why ..
     
  6. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Hi guys.

    See the first post : the new version will solve every trouble encountered about getting a recognized word in Unity.
     
  7. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Update Download links in the first post.
     
  8. xylss

    xylss

    Joined:
    Mar 15, 2017
    Posts:
    3
    Can update the download link? thank you.
     
  9. ecm_dave

    ecm_dave

    Joined:
    Jul 26, 2013
    Posts:
    4
    This is awesome, trying to figure out why it needs a standalone server however and can't just be run entirely from unity itself, would love to implement this in one of my apps as an alternative to using the windows native stuff available in windows 10 but the prospect of having to run a 3rd party server in the bg is killing me. Maybe I just don't understand how this is working.