Skip to content

vikramezhil/DroidSpeech2.0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DroidSpeech2.0

Android kotlin library for continuous speech recognition with localisations.

Supports from Android SDK version 16 and above.

Requires androidx.

About

Google's default speech recognition library doesn't allow to continuously listen to users voice and a manual stop and start mechanism is involved to use the speech recognition again. This proved to be a downfall for third party developers to optimise the user experience of having continuous speech recognition after each speech result. Adding to this the speech recognition server throws up an error when called upon frequently thus preventing an error free experience to the end user.

Droid Speech 2.0 aims to close this gap and provide unparalleled optimisation of continuous speech recognition without any of the above said issues. It is developed keeping in mind all the loopholes which needs to be blocked to have the speech recognition run seamlessly in an android device.

Usage

Gradle dependency:

Add the following to your project level build.gradle:

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Add this to your app build.gradle:

dependencies {
    implementation 'com.github.vikramezhil:DroidSpeech2.0:vx.y' 
}

change x.y to version number in the release page

Maven:

Add the following to the section of your pom.xml:

<repositories>
  <repository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
  </repository>
</repositories>

Add the following to the section of your pom.xml:

<dependency>
    <groupId>com.github.vikramezhil</groupId>
    <artifactId>DroidSpeech2.0</artifactId>
    <version>vx.y</version>
</dependency>

change x.y to version in the release page

Documentation

For a detailed documentation 📔, please have a look at the Wiki.

var dks = Dks(application, supportFragmentManager, object: DksListener {
    override fun onDksLiveSpeechResult(liveSpeechResult: String) {
        Log.d("DKS", "Speech result - $liveSpeechResult")
    }

    override fun onDksFinalSpeechResult(speechResult: String) {
        Log.d("DKS", "Final speech result - $speechResult")
    }

    override fun onDksLiveSpeechFrequency(frequency: Float) {
        Log.d("DKS", "frequency - $frequency")
    }

    override fun onDksLanguagesAvailable(defaultLanguage: String?, supportedLanguages: ArrayList<String>?) {
        Log.d("DKS", "defaultLanguage - $defaultLanguage")
        Log.d("DKS", "supportedLanguages - $supportedLanguages")
    }

    override fun onDksSpeechError(errMsg: String) {
        Log.d("DKS", "errMsg - $errMsg")
    }
})

Listen to user speech

dks.startSpeechRecognition()

Close speech operations

dks.closeSpeechOperations()