How to add Speech Recognition to Unity project? [closed]

核能气质少年 提交于 2019-11-27 05:29:14
Programmer

Unity does not have this built in yet. They have been doing research on it for a long time and this will likely be added into Unity very soon. You can get the working Speech-to-Text(free) from the Assets store here. It is open source and you can help contribute to it if you find any problems.

As a side note, almost every OS has a Speech Recognition API. You easily make a plugin by wrapping all those API into a sing class in C# then use Unity's platform preprocessor directives to determine which one to call depending on which OS your game is running on.

Android:

SpeechRecognizer class.

see this project https://github.com/gsssrao/UnityAndroidSpeechRecognition

iOS:

SFSpeechRecognizer class

MacOS:

NSSpeechRecognizer class

Windows:

SpeechRecognitionEngine class

see this project https://github.com/LightBuzz/Speech-Recognition-Unity

Example:

class CrazySpeechRecognition
{
  #if UNITY_ANDROID  
    Use SpeechRecognizer class
  #endif

  #if UNITY_IOS
    Use SFSpeechRecognizer class
  #endif

  #if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
    Use NSSpeechRecognizer class
  #endif

  #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
    Use SpeechRecognitionEngine class
  #endif 
}

The free Speech-to-Text from Unity is sadly discontinued, as stated in the link.

You can try Watson Unity SDK: https://github.com/watson-developer-cloud/unity-sdk^ in particular ExampleSpeechToText

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!