Rhino - Android API

  • Speech-to-Intent Engine
  • Domain Specific NLU
  • Offline SLU
  • Local Voice Recognition
  • Android
  • Java

This document outlines how to integrate Rhino Spech-to-Intent engine within an Android application.

Prerequisites

Rhino is implemented in ANSI C and is shipped as precompiled libraries accompanied by corresponding Java interfaces (bindings). To integrate within an Android application the following items are needed

  • Precompiled libraries
  • Java binding
  • The model file. The standard model is freely available on Rhino's GitHub repository. Enterprises who are commercially engaged with Picovoice can access compressed and standard models as well.
  • Context model file for your use case. A set of freely-available context files can be found on Rhino's GitHub repository. Enterprises who are engaged with Picovoice can create custom NLU models using Picovoice Console.

Integration

Rhino provides a binding for Android using JNI. It can be initialized using:

final String modelFilePath = ...
final String contextFilePath = ...
Rhino rhino = new Rhino(modelFilePath, contextFilePath);

Once initialized, rhino can be used for intent inference:

private short[] getNextAudioFrame();
while (rhino.process(getNextAudioFrame()));
if (rhino.isUnderstood()) {
RhinoIntent intent = rhino.getIntent();
// logic to perform an action given the intent object.
} else {
// logic for handling out of context or unrecognized command
}

When finished processing, be sure to reset the object before processing a new stream of audio via:

rhino.reset()

Finally, prior to exiting the application be sure to release resources acquired via:

rhino.delete()