rev_voice_input_flutter 1.0.4 copy "rev_voice_input_flutter: ^1.0.4" to clipboard
rev_voice_input_flutter: ^1.0.4 copied to clipboard

A Flutter SDK for accurate speech-to-text conversion using Reverie's AI technology. Supports multiple languages and domains with real-time voice input processing.

Reverie Voice Input SDK for Flutter #

A Flutter SDK for accurate speech-to-text conversion using Reverie's AI technology. This package provides real-time voice input processing with support for multiple Indian languages and specialized domains.

Table of Contents #

Features #

  • Accurate Speech-to-Text Conversion: Precise and reliable conversion of spoken words into text using Reverie's advanced AI technology
  • Real-time Processing: Stream audio and receive transcription results in real-time
  • Multi-language Support: Support for English and multiple Indian languages
  • Domain-specific Optimization: Specialized models for different use cases (Voice Search, BFSI, Generic)
  • Timeout Management: Configurable timeouts for no-input, silence detection, and session duration
  • Simple Integration: Easy-to-use API with minimal setup required

Supported Languages #

Language Code
English Languages.ENGLISH
Hindi Languages.HINDI
Assamese Languages.ASSAMESE
Bengali Languages.BENGALI
Gujarati Languages.GUJARATI
Kannada Languages.KANNADA
Malayalam Languages.MALAYALAM
Marathi Languages.MARATHI
Odia Languages.ODIA
Punjabi Languages.PUNJABI
Tamil Languages.TAMIL
Telugu Languages.TELUGU

Supported Domains #

Domain Code Description
Generic Domain.GENERIC General-purpose recognition for most applications
Voice Search Domain.VOICE_SEARCH Optimized for voice search queries and commands
BFSI Domain.BFSI Banking, Financial Services, and Insurance terminology
App Search Domain.APP_SEARCH Application search and navigation commands

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  rev_voice_input_flutter: ^1.0.4

Then run:

flutter pub get

Platform Setup #

Android Setup #

Add the following permissions to your android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Note: Minimum Android SDK version is 24.

iOS Setup #

Step 1: Add the following to your ios/Runner/Info.plist:

<key>NSMicrophoneUsageDescription</key>
<string>We need access to your microphone to record audio.</string>

Step 2: Add the following to your ios/Podfile to enable permissions from the flutter package:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      # You can remove unused permissions here
      # for more information: https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h
      # e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0'
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',

        ## dart: PermissionGroup.microphone
        'PERMISSION_MICROPHONE=1',
      ]
    end
  end
end

Usage #

1. Initialize the SDK #

import 'package:rev_voice_input_flutter/rev_voice_input_flutter.dart';

late RevVoiceInput _revVoiceInput;

void initializeVoiceInput() {
  _revVoiceInput = RevVoiceInput(
    'YOUR_API_KEY',      // Replace with your actual API key
    'YOUR_APP_ID',       // Replace with your actual App ID
    onDataReceived: (SttResponseData data) {
      print('Transcription: ${data.transcript}');
      print('Is Final: ${data.finalResult}');
      print('Confidence: ${data.confidence}');
    },
    onErrorOccurred: (String error) {
      print('Error: $error');
    },
    onRecordingStart: () {
      print('Recording started');
    },
    onRecordingEnd: () {
      print('Recording ended');
    },
  );
}

2. Configure Optional Settings #

// Set timeouts (optional)
_revVoiceInput.setNoInputTimeout(6.0);  // seconds
_revVoiceInput.setTimeout(30.0);        // seconds
_revVoiceInput.setSilence(2.0);         // seconds

// Set logging behavior (optional)
_revVoiceInput.setLogging(Logging.NO_AUDIO);  // For privacy

3. Start Voice Input #

void startListening() {
  _revVoiceInput.startVoiceInput(
    lang: Languages.ENGLISH,
    domain: Domain.VOICE_SEARCH,
  );
}

4. Stop Voice Input #

// Get final result
void stopAndGetResult() {
  _revVoiceInput.finishInput();
}

// Cancel without getting result
void cancelListening() {
  _revVoiceInput.stopVoiceInput();
}

API Reference #

RevVoiceInput Constructor #

RevVoiceInput(
  String apiKey,
  String appId, {
  OnDataReceived? onDataReceived,
  OnErrorOccurred? onErrorOccurred,
  OnRecordingStart? onRecordingStart,
  OnRecordingEnd? onRecordingEnd,
})

Methods #

Method Description
startVoiceInput({String lang, String domain}) Start voice input with specified language and domain
finishInput() Stop recording and get final transcription result
stopVoiceInput() Cancel recording without getting final result
setNoInputTimeout(double seconds) Set timeout for no audio input
setTimeout(double seconds) Set overall session timeout
setSilence(double seconds) Set silence detection timeout
setLogging(String level) Set logging behavior

Logging Options #

Option Description
Logging.TRUE Store both audio and transcript
Logging.FALSE Store neither audio nor transcript
Logging.NO_AUDIO Store transcript only
Logging.NO_TRANSCRIPT Store audio only

License #

Copyright 2024 Reverie Language Technologies Limited.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

1
likes
130
points
218
downloads

Publisher

verified publisherreverieinc.com

Weekly Downloads

A Flutter SDK for accurate speech-to-text conversion using Reverie's AI technology. Supports multiple languages and domains with real-time voice input processing.

Homepage

Topics

#speech-to-text #voice-recognition

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_sound, logger, permission_handler, web_socket_channel

More

Packages that depend on rev_voice_input_flutter