Skip to content

reverieinc/rev-voice-input-android

Repository files navigation

Reverie Voice Input SDK

License

This SDK helps in accurately converting speech into text using an API powered by Reverie's AI technology. The solution will transcribe the speech in real time in various Indian languages and audio formats.

Key Features

  • Accurate Speech-to-Text Conversion: The Voice Input SDK ensures precise and reliable conversion of spoken words into text, leveraging the advanced AI technology developed by Reverie.

  • Minimalistic Integration: Seamlessly integrate the SDK into your application with minimal effort, allowing you to focus on enhancing the user experience rather than grappling with complex integration processes.

  • Option to Use Bundled UI: Enjoy the convenience of utilizing the bundled user interface, streamlining the integration process and offering a consistent and user-friendly experience within your application.

API Reference

There are two constructors in the RevVoiceInput class. The first constructor accepts all parameters, allowing full customization. The second constructor accepts minimal parameters, assuming default values for language and domain.

There are two startRecognitions() methods in the RevVoiceInput class. The first method allows customization of language and domain for a specific call, while the second method uses default values for language and domain. Users can choose the constructor or method that best fits their needs based on whether they want to customize language and domain for the entire app flow or individual cases.

Constructors

Constructor 1

Parameter Type Required Default Description
apiKey String true - Api key given to the client
appId String true - App Id given to the client
domain String false ‘voice_search’ Domain of the voice Input
Language String false ‘en’ Language of voice Input
Logging String true - Logging of data required or not

Constructor 2

Parameter Type Required Default Description
apiKey String true - Api key given to the client
appId String true - App Id given to the client
Logging String true - Logging of data required or not

startRecognition()

Method 1
Element Type Required Default Description
Context context true - Context of the activity
isUiNeeded boolean true - to use bundled UI element of the SDK
Language String false ‘en’ Language of Input
Domain String false ‘voice_search’ Domain of Input

Method 2

Element Type Required Default Description
Context context true - Context of the activity
isUiNeeded boolean true - to use bundled UI element of the SDK

Supported Constants

Various constant values are provided in SDK for DOMAIN, LANGUAGES, and LOGGING parameters

Domain

  1. Domain.VOICE_SEARCH
  2. Domain.GENERIC
  3. Domain.BFSI

Languages

  1. Languages.ENGLISH
  2. Languages.HINDI

Logging

  1. Logging.TRUE - stores client’s audio and keeps transcript in logs.
  2. Logging.NO_AUDIO - does not store client’s audio but keeps transcript in logs.
  3. Logging.NO_TRANSCRIPT - does not keep transcript in logs but stores client’s audio.
  4. Logging.FALSE - does not keep the client’s audio or the transcript in the log.

Integrate the SDK in Your Application

To integrate the SDK into your application, follow these steps:

  1. Addition of Gradle dependencies as follows:

    • Groovy:

      Add the jitpack.io repository to the project level build.gradle file:

      dependencyResolutionManagement {
              repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
              repositories {
                  mavenCentral()
                  maven { url 'https://jitpack.io' }
              }
          }

      and add the following to the app-level dependencies:

      dependencies {
            implementation 'com.github.reverieinc:rev-voice-input-android:v1.0.4'
      }
    • or Kotlin DSL:

      Add the jitpack.io repository to the project level build.gradle file:

      dependencyResolutionManagement {
          repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
          repositories {
              mavenCentral()
              maven { url = uri("https://jitpack.io") }
          }
      }

      and add the following to the app-level dependencies:

      dependencies {
            implementation ("com.github.reverieinc:rev-voice-input-android:v1.0.4")
      }
      

      Note:

      • Verify that the latest version is added as a dependency.
      • Min Supported Android SDK-21
  2. Addition of Necessary Manifest Permissions

    Add the following permissions in your manifest:

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

    Make sure to request the user to grant the RECORD_AUDIO permission at runtime.

SDK usage example:

Kotlin

Kotlin-based example implementation of the SDK:

  1. Prepare the constructor:

    Type I:

    //Preparing the Constructor with  API-key, APP-ID, language, domain, and logging
        val  voiceInput=RevVoiceInput(API_KEY,APP_ID,
        Domain.VOICE_SEARCH, 
        Languages.ENGLISH,
        Logging.TRUE)

    Type II:

    //Preparing the constructor with a valid API key and APP-ID
         val voiceInput = RevVoiceInput(API_KEY, APP_ID,Logging.TRUE)

    For more details about the types check: API Reference

  2. Implement the listener:

    //Implement the listener to get results and error details
         voiceInput.setListener(object : VoiceInputListener {
          override fun onResult(result: VoiceInputResultData?) {
    
            }
    
            override fun onError(error: VoiceInputErrorResponseData?) {
    
            }
    
            override fun onRecordingStart(isStart: Boolean) {
                //
            }
    
            override fun onRecordingEnd(isEnd: Boolean) {
              
            }
        })
  3. Starting the Input process:

    Type I:

        voiceInput.startRecognition(
                    getApplicationContext(),
                    true
                    ,Domain.VOICE_SEARCH,
                     Languages.ENGLISH
            )

    Type II:

    //To start the voice search
          voiceInput.startRecognition(
              applicationContext,
              true 
          )

    For more details about the types check: API Reference

  4. (Optional) Abort the search process

         //To stop the voice searching forcefully
       voiceInput.cancel()
  5. (Optional) Finish the search process

         //To stop the voice searching forcefully and get the result
       voiceInput.finishInput()
  6. (Optional) To Set the No Input Timeout

      voiceInput.setNoInputTimeout(5.0)
  7. (Optional) To Set the TimeOut

      voiceInput.setTimeout(5.0)
  8. (Optional) To Set the Silence

      voiceInput.setSilence(2.0)
  9. (Optional) To Enable Logging

      import com.reverie.voiceinput.LOG;
    
       LOG.DEBUG=true
Java

Java based example implementation of the SDK:

  1. Prepare the constructor:

    Type I:

    //Preparing the Constructor with a valid API key, APP-ID, language, domain, and Logging
    
     RevVoiceInput voiceInput = new RevVoiceInput(
                 API_KEY,
                 APP_ID,
                 Domain.VOICE_SEARCH, Languages.ENGLISH, Logging.TRUE);
    

    Type II:

       //Preparing the constructor with a valid API key and APP-ID
       RevVoiceInput voiceInput = new RevVoiceInput(API_KEY, APP_ID,Logging.TRUE);
             

    For more details about the types check: API Reference

  2. Implement the listeners:

          //Implement the listener to get results and error details
       voiceInput.setListener(new VoiceInputListener() {
    
    
    
            @Override
            public void onResult(VoiceInputResultData result) {
                //Log.d(TAG, "onResult: " + result);
            }
    
            @Override
            public void onError(VoiceInputErrorResponseData error) {
    		//Log.d(TAG, "onError: " + error.toString());
            }
    
            @Override
            public void onRecordingStart(boolean isStart) {
    
            }
    
            @Override
            public void onRecordingEnd(boolean isEnd) {
    
            }
    
        });
  3. Starting the search Process.

    Type I:

    voiceInput.startRecognition(
    getApplicationContext(),
    true
    Domain.VOICE_SEARCH, 
    Languages.ENGLISH 
    )

    Type II:

    //To Start the Voice Input
          voiceInput.startRecognition(
              getApplicationContext(),//Context
              true//isUiNeeded
          );
          

    For more details about the types check: API Reference

  4. (Optional) Abort the search process

         //To stop the voice searching forcefully
       voiceInput.cancel();
  5. (Optional) Finish the search process

         //To stop the voice searching forcefully and get the result
       voiceInput.finishInput();
  6. (Optional) To Set the No Input Timeout

      voiceInput.setNoInputTimeout(5.0);
  7. (Optional) To Set the TimeOut

      voiceInput.setTimeout(5.0);
  8. (Optional) To Set the Silence

      voiceInput.setSilence(2.0)
  9. (Optional) To Enable Logging(Logcat)

        import com.reverie.voiceinput.LOG;
      
        LOG.Companion.setDEBUG(true);

License

All Rights Reserved. Copyright 2023. Reverie Language Technologies Limited.(https://reverieinc.com/)

Reverie Voice Input SDK can be used according to the Apache License, Version 2.0.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •