riva_flutter 1.0.7
riva_flutter: ^1.0.7 copied to clipboard
The library shows device-specific speech recognition and speech-to-text conversion capabilities with Riva technology.
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 LanguageSupport Language you want to use text to speech languageSTT LanguageSupport Language you want to use speech to text sampleRateTTS int SampleRate is the sample rate of the data you want to play sampleRateSTT int 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: () {});
Translate
- Use to translate text supported by sdk
Param | Type | Description |
---|---|---|
inputText | String | input text you want translate |
inputLanguageCode | LanguageSupport | Language you want to push before translate |
outputLanguageCode | LanguageSupport | Language you want to receive after translate |
FRivaManager.translateText(
inputText: 'your_input_text',
inputLanguageCode: LanguageSupport,
outputLanguageCode: LanguageSupport );
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" />