Leopard Speech-to-Text
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 Leopard Speech-to-Text plugin to your app project by referencing it in
pubspec.yaml
:
- Enable the proper permissions 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:
Model File
Add the Leopard Speech-to-Text model file to your Flutter application:
- Create a model in Picovoice Console or use a default language model.
- Add the model file to an
assets
folder in your project directory. - Add the asset to your
pubspec.yaml
:
- In this example, the path to the model file in code would then be as follows:
Usage
An instance of Leopard Speech-to-Text
is created by passing a model file path into its static constructor create
:
Transcribe an audio file by passing in the path:
When done, resources have to be released explicitly:
Word Metadata
Along with the transcript, Leopard Speech-to-Text returns metadata for each transcribed word. Available metadata items are:
- Start Time: Indicates when the word started in the transcribed audio. Value is in seconds.
- End Time: Indicates when the word ended in the transcribed audio. Value is in seconds.
- Confidence: Leopard Speech-to-Text's confidence that the transcribed word is accurate. It is a number within
[0, 1]
. - Speaker Tag: If speaker diarization is enabled on initialization, the speaker tag is a non-negative integer identifying unique speakers, with
0
reserved for unknown speakers. If speaker diarization is not enabled, the value will always be-1
.
Demo
For the Leopard Speech-to-Text Flutter SDK, we offer demo applications that demonstrate how to use the Speech-to-Text engine on audio recordings.
Setup
Clone the Leopard Speech-to-Text repository from GitHub using HTTPS:
Usage
- 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.
Replace
{YOUR_ACCESS_KEY_HERE}
with a validAccessKey
in the demo/flutter/lib/main.dart file:Build and deploy the demo to your device:
For more information on our Leopard Speech-to-Text demos for Flutter, head over to our GitHub repository.