riva_flutter
Introduction
The library shows device-specific speech recognition and speech-to-text conversion capabilities.
This plugin contains a set of classes that make it easy to use the underlying platform's speech recognition capabilities in Flutter. It supports Android, iOS. The target use cases of this library are persistent speech conversion or always listening and converting a continuous text to speech.
Usage
Init riva
-
Use to init sdk riva
Param Type Description host String Your host url languageTTS String Language you want to use text to speech languageSTT String Language you want to use speech to text sampleRateTTS String SampleRate is the sample rate of the data you want to play sampleRateSTT String SampleRate is the sample rate of the data you want to record voiceName String Voice name speech
await FRivaManager.initSdk(host: 'your_host_url');
Start speech to text
- Use to start speech to text and receive result on callback
FRivaManager.startSTT(
onStart: () {},
onSpeeching: (textSpeeching) {},
onSuccess: (textRecognized) {},
onError: (error) {},
onComplete: () {});
Start text to speech
- Use to start text to speech and receive result on callback
| Param | Type | Description |
|---|---|---|
| textOrigin | String | input text convert to speech |
FRivaManager.startTTS(
textOrigin,
onStart: () {},
onPlaying: () {},
onError: (error) {},
onComplete: () {});
Permission
IOS
- min SDK: 11.0
- Add the microphone permission to your Info.plist file, located in
project root>/ios/Runner/Info.plist
<key>NSMicrophoneUsageDescription</key>
<string>Some message to describe why you need this permission</string>
Android
- min SDK : 21 (amrNb/amrWb: 26, Opus: 29).
- Add the record audio permission to your AndroidManifest.xml file, located
in
<project root>/android/app/src/main/AndroidManifest.xml.
android.permission.RECORD_AUDIO- this permission is required for microphone access.
<uses-permission android:name="android.permission.RECORD_AUDIO" />