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)

  1. Download the latest archive file for the plugin.

  2. Unpack the archive in your Unity project root directory. You should end up with Assets/Plugins/KeenASR directory in your project; the archive also contains Assets/StreamingAssets/librispeechQT-nnet2-en-us directory with the ASR Bundle (acoustic models) which are needed by KeenASR SDK.

  3. Make sure Unity is setup to build for iOS or Android; editor version of the plugin provides only stubs.

  4. 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.cs script. Please review and edit settings for microphone usage description in this file.

  5. For Android builds, please modify the following settings under Build Settings -> Player Settings:

    Device Filter: choose Armv7

    Minimum API Level: 21

  6. For Android builds, AndroidManifest.xml file in Assets/Plugins/KeenASR/Android/KeenASRUnityBinding.aar archive 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.

  7. If you are using a custom ASR Bundle provided by Keen Research please remove Assets/StreamingAssets/librispeechQT-nnet2-en-us/ directory and copy the custom ASR bundle instead so that StreamingAssets directory contains subdirectory with the new bundle.

  8. 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

Review 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).