KeenASR Unity is a beta release Unity plugin that encapsulates speech recognition functionality of Keen ASR SDK and provides simple-to-use C# interface via KeenASR class. Unity plugin currently works with both iOS and Android versions of KeenASR SDK. Keen ASR SDK will only work on the device (not the simulator) on those platforms; we provide stub methods for Unity Player.
Installing KeenASR Unity Plugin (tested in Unity 2017.2.0f3)
Download the latest archive file for the Unity plugin. The archive contains both Android and iOS SDKs as well as the ASR Bundle.
Unpack the archive in your Unity project root directory. You should end up with
Assets/Plugins/KeenASRdirectory in your project; the archive also contains
Assets/StreamingAssets/keenB2mQT-nnet3chain-en-usdirectory with the ASR Bundle (acoustic models) which are needed by KeenASR SDK.
Make sure Unity is setup to build for iOS or Android; editor version of the plugin provides only stubs.
As of plugin version 0.3 all settings in XCode that are related to KeenASR SDK are performed automatically via
Assets/Plugins/KeenASR/Editor/PostBuildProcess.csscript. Please review and edit settings for microphone usage description in this file.
For Android builds, please modify the following settings under Build Settings -> Player Settings:
Device Filter: choose Armv7
Minimum API Level: 21
For Android builds, AndroidManifest.xml file in
Assets/Plugins/KeenASR/Android/KeenASRUnityBinding.aararchive is setup to require RECORD_AUDIO permission. This file will be merged with the app’s AndroidManifest.xml file during Unity build and user will be prompted to allow the app to record the audio on application startup. The app will also prompt user for variety of additional permissions; if you disable, so called, “dangerous permissions” by creating your own AndroidManifest.xml file in Assets/Plugins/Android directory, you will need to make sure user is prompted for the record audio permissions before KeenASR SDK is initialized. For more details, please see Unity documentation.
If you are using a custom ASR Bundle provided by Keen Research please remove
Assets/StreamingAssets/keenB2mQT/directory and copy the custom ASR bundle instead so that StreamingAssets directory contains subdirectory with the new bundle.
If upgrading from previous plugin versions, we recommend you completely remove the old plugin (Assets/Plugins/KeenASR directory) and then install the new version of the plugin.
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 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. This sample shows how to initialize the SDK; it presents a “Start Listening” button on the screen and logs partial and final results on the console (they are not shown on the screen).