如何在Unity项目中添加语音识别? [关闭]

问题描述 投票:5回答:2

我目前正在使用Vuforia进行增强现实项目,该项目使用语音识别来控制Unity中的对象。我只是在寻找一个示例工作代码。

c# unity3d speech-recognition augmented-reality vuforia
2个回答
14
投票

Unity尚未内置此功能。他们很长一段时间都在做research,这很可能会很快加入Unity。您可以从Assets商店here获得有效的Speech-to-Text(免费)。它是开源的,如果你发现任何问题,你可以帮助contribute

作为旁注,几乎每个操作系统都有语音识别API。您可以通过将所有这些API包装到C#中的单个类中来轻松制作插件,然后使用Unity's platform preprocessor directives根据您的游戏运行的操作系统来确定调用哪个。

安卓:

SpeechRecognizer类。

看到这个项目https://github.com/gsssrao/UnityAndroidSpeechRecognition

iOS版:

SFSpeechRecognizer

MacOS的:

NSSpeechRecognizer

视窗:

SpeechRecognitionEngine

看到这个项目https://github.com/LightBuzz/Speech-Recognition-Unity

例:

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 
}

如链接中所述,来自Unity的免费Speech-to-Text遗憾地停止了。


2
投票

您可以尝试使用Watson Unity SDK:https://github.com/watson-developer-cloud/unity-sdk ^,特别是ExampleSpeechToText

© www.soinside.com 2019 - 2024. All rights reserved.