Rhino Speech-to-Intent
Flutter Quick Start
Platforms
- Flutter (2.8.1+)
- Android (5.0+, API 21+)
- iOS (13.0+)
Requirements
- Flutter SDK
- Android SDK (21+)
- JDK (8+)
- Xcode (13+)
Picovoice Account & AccessKey
Signup or Login to Picovoice Console to get your AccessKey
.
Make sure to keep your AccessKey
secret.
Quick Start
Setup
Install Flutter SDK.
Run
flutter doctor
to determine any missing requirements.Add the Rhino Speech-to-Intent plugin to your app project by referencing it in
pubspec.yaml
:
- Enable the proper permission for recording with the hardware's microphone on both iOS and Android:
iOS
Open your Info.plist and add the following line:
Android
Open your AndroidManifest.xml and add the following line:
Usage
Add the context file (either a pre-built context file (
.rhn
) from the Rhino Speech-to-Intent GitHub Repository or a custom context created with the Picovoice Console) to theassets
folder in the project directory.Add the path to the
pubspec.yaml
:
- Create an instance of
RhinoManager
using the constructorRhinoManager.create
that infers custom commands:
The _inferenceCallback
parameter is a function that is invoked when Rhino Speech-to-Intent made an intent inference.
Start audio capture and intent inference:
Once an inference has been made, the _inferenceCallback
will be invoked and audio capture will stop automatically. Release resources explicitly when done with Rhino Speech-to-Intent:
Custom Contexts
Create custom contexts with the Picovoice Console. Download the custom context file (
.rhn
).Add the file to the
assets
folder in the project directory.Add it to the
pubspec.yaml
:
- Create an instance of
RhinoManager
using the constructorRhinoManager.create
with the custom context.
Alternatively, if the context file is deployed to the device with a different method, the absolute path to the file on device can be used.
Non-English Languages
Use the corresponding model file (.pv
) to detect non-English wake words.
The model files for all supported languages are available
on the Rhino Speech-to-Intent GitHub repository.
- Add the file to the
assets
folder in the project directory. - Add it to the
pubspec.yaml
:
- Pass in the model file using the
modelPath
parameter to change the language:
Alternatively, if the model file is deployed to the device with a different method, the absolute path to the file on device can be used.
Demo
For the Rhino Speech-to-Intent Flutter SDK, we offer demo applications that demonstrate how to use the Speech-to-Intent engine on real-time audio streams (i.e. microphone input).
Setup
Clone the Rhino Speech-to-Intent GitHub Repository:
Usage
Replace
{YOUR_ACCESS_KEY_HERE}
with a validAccessKey
in the demo/flutter/lib/main.dart file:Run the
prepare_demo
script with a language code to set up the demo in the language of your choice (e.g.de
-> German,ko
-> Korean). To see a list of available languages, runprepare_demo
without a language code.
- Build and deploy the demo to your device:
For more information on our Rhino Speech-to-Intent demos for Flutter, head over to our GitHub repository.