Unity Plugin Document
KeenASR is a beta release Unity plugin that encapsulates speech recognition functionality and provides simple-to-use C# interface via KeenASR class. Our speech recognition SDK, and consenquently the plugin, currently supports only the iOS platform.
Installing KeenASR Unity Plugin
Download the latest archive file for the plugin and unpack it on your system.
Copy the content of
Assets/Pluginsdirectory to the
Assets/Pluginsdirectory of your Unity project
Make sure Unity is setup to build for iOS (editor version of the plugin is not available yet)
Download ASR Bundle for English and unpack it on your system.
After you compile your Unity app for the first time, you will need to add the ASR Bundle folder to the iOS project (this process will be automated in the future releases of the plugin). During this step, please make sure that “Create Reference Folder” option is chosen when adding librispeech-nnet2-en-us folder; when adding the folder in the file dialog box, click on Options button in the bottom left corner to reveal these options. Once ASR Bundle is added to the XCode, you should see a blue folder icon next to the folder name. (You will need to repeat this step every time you completely overwrite the iOS code base created by Unity)
Disable Bitcode in Build Settings
In XCode app settings, under Build Settings of your target you will need to disable bitcode (Enable Bitcode options should be set to No)
Specify libc++ as C++ Standard Library in XCode Build Settings
Update privacy settings for microphone access
As of iOS 10, Apple requires all apps that access microphone to provide a description with the reason your app needs to access the microphone, by adding a key in the Info.plist file. If this key is not specified the app will crash as soon as it tries to access the microphone (in this case, on initialization of the framework). More details.
To add this key, open Info.plist file in your project, add the NSMicrophoneUsageDescription key, and specify your description as the string value. For example, “Speech recognition feature in this app requires access to the microphone”.
Plugins directory in your Unity project should look like this:
There may be some additional files and directories, unrelated to KeenASR plugin, under Assets, Plugins, and various subdirectories.
Adding Speech Recognition Functionality to Your App
Assets/Plugins/KeenASR/KeenASR.cs file, which provides high-level interface to the SDK. We highly recommend you review the documentation for the iOS framework to get familiar with the SDK high-level concepts. Unity plugin provides access to most of the functionality available in the iOS framework.
See sample code for using the plugin from within Unity.
NOTE: editor version of the plugin is not available