问题描述
我目前正在使用Vuforia进行增强现实项目,该项目使用语音识别来控制Unity中的对象.我只是在寻找示例工作代码.
I am presently working on a Augmented Reality project using Vuforia that uses Speech recognition to control the objects in Unity. I was just looking for a sample working code.
推荐答案
Unity尚未内置此功能.他们已经对它进行研究很长时间了,这很可能会很快就会加入Unity.您可以从Assets商店此处获取有效的语音转文本(免费) .它是开源的,如果发现任何问题,您可以做出贡献.
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.
请注意,几乎每个操作系统都具有语音识别API.通过将所有这些API包装到C#中的sing类中,然后使用 Unity的平台预处理程序指令确定要调用哪个操作系统,具体取决于您的游戏运行的操作系统.
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 :
查看此项目 https://github.com/gsssrao/UnityAndroidSpeechRecognition
iOS :
MacOS :
Windows :
查看此项目 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的免费语音转换令人遗憾如链接中所述已停产.
The free Speech-to-Text from Unity is sadly discontinued, as stated in the link.
这篇关于如何在Unity项目中添加语音识别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!