All Projects → maxwellobi → Android Speech Recognition

maxwellobi / Android Speech Recognition

Licence: mit
Continuous speech recognition library for Android with options to use GoogleVoiceIme dialog and offline mode.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android Speech Recognition

Avsr Deep Speech
Google Summer of Code 2017 Project: Development of Speech Recognition Module for Red Hen Lab
Stars: ✭ 43 (-40.28%)
Mutual labels:  speech-recognition
Biglittlenet
Official repository for Big-Little Net
Stars: ✭ 57 (-20.83%)
Mutual labels:  speech-recognition
Papers
A list of paper, books and sites for various different topics related to machine learning and deep learning along with various field in which it is implemented
Stars: ✭ 63 (-12.5%)
Mutual labels:  speech-recognition
Cortex M Kws
Cortex M KWS example with Tengine Lite.
Stars: ✭ 45 (-37.5%)
Mutual labels:  speech-recognition
Parrots
Automatic Speech Recognition(ASR), Text-To-Speech(TTS) engine for Chinese.
Stars: ✭ 48 (-33.33%)
Mutual labels:  speech-recognition
Syn Speech
Syn.Speech is a flexible speaker independent continuous speech recognition engine for Mono and .NET framework
Stars: ✭ 57 (-20.83%)
Mutual labels:  speech-recognition
Pncc
A implementation of Power Normalized Cepstral Coefficients: PNCC
Stars: ✭ 40 (-44.44%)
Mutual labels:  speech-recognition
Patter
speech-to-text in pytorch
Stars: ✭ 71 (-1.39%)
Mutual labels:  speech-recognition
Iflytek awaken asr
use iflytek's technology to realize awaken and order recognition
Stars: ✭ 53 (-26.39%)
Mutual labels:  speech-recognition
Dragonfire
the open-source virtual assistant for Ubuntu based Linux distributions
Stars: ✭ 1,120 (+1455.56%)
Mutual labels:  speech-recognition
Py Nltools
A collection of basic python modules for spoken natural language processing
Stars: ✭ 46 (-36.11%)
Mutual labels:  speech-recognition
Textnormalizationcoveringgrammars
Covering grammars for English and Russian text normalization
Stars: ✭ 46 (-36.11%)
Mutual labels:  speech-recognition
Audio Pretrained Model
A collection of Audio and Speech pre-trained models.
Stars: ✭ 61 (-15.28%)
Mutual labels:  speech-recognition
Formant Analyzer
iOS application for finding formants in spoken sounds
Stars: ✭ 43 (-40.28%)
Mutual labels:  speech-recognition
Speech ai
Simple speech linguistic AI with Python
Stars: ✭ 66 (-8.33%)
Mutual labels:  speech-recognition
Artyom.js
A voice control - voice commands - speech recognition and speech synthesis javascript library. Create your own siri,google now or cortana with Google Chrome within your website.
Stars: ✭ 1,011 (+1304.17%)
Mutual labels:  speech-recognition
Dolphinattack
Inaudible Voice Commands
Stars: ✭ 57 (-20.83%)
Mutual labels:  speech-recognition
Asr benchmark
Program to benchmark various speech recognition APIs
Stars: ✭ 71 (-1.39%)
Mutual labels:  speech-recognition
Openasr
A pytorch based end2end speech recognition system.
Stars: ✭ 69 (-4.17%)
Mutual labels:  speech-recognition
Angle
⦠ Angle: new speakable syntax for python 💡
Stars: ✭ 61 (-15.28%)
Mutual labels:  speech-recognition

License: MIT

Android Speech Recognition

This library lets you perform continuous voice recognition in your android app with options to either use Google Voice Ime in a Dialog or perform the recognition in-app. It also provides you with an option to enforce ONLY offline speech recognition.

Installation

Gradle

Add the Jitpack repository to your root build.gradle file

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

Add the dependency to your app's build.gradle file

dependencies {
	compile 'com.github.maxwellobi:android-speech-recognition:v1.0.0-beta.1'
}

Maven

Add the repository to your pom.xml file

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

Add the dependency

<dependency>
    <groupId>com.github.maxwellobi</groupId>
    <artifactId>android-speech-recognition</artifactId>
    <version>v1.0.0-beta.1</version>
</dependency>

Usage

To use SpeechRecognition library, initialize it, set a listener for handling callbacks, then start listening.

@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);

	SpeechRecognition speechRecognition = new SpeechRecognition(this);
	speechRecognition.setSpeechRecognitionPermissionListener(this);
	speechRecognition.setSpeechRecognitionListener(this);

	Button speakButton = findViewById(R.id.button);
    	speakButton.setOnClickListener(new View.OnClickListener(){
	    @Override
	    public void onClick(View view) {
		    speechRecognition.startSpeechRecognition();   
	    }
	});
}

Handling Permissions

By default, SpeechRecognition handles the request to grant RECORD_AUDIO permission internally and provides a callback via OnSpeechRecognitionPermissionListener interface. There is no need to request this permission in your manifest.

@Override
public void onPermissionGranted() {
	//RECORD_AUDIO permission was granted
}
@Override
public void onPermissionDenied() {
	//RECORD_AUDIO permission was denied
}

Note: use SpeechRecognition.handleAudioPermissions(false) to disable this behavior. If this is set but the permission was not granted, SpeechRecognition will throw a SecurityException

Note: Runtime permission request is available from API level 23 (Marshmallow). Lower API levels will request permissions on install, thus no callback will be triggered.

Callbacks/Listeners

To receive the speech recognition result and other event notification, you need to implement the OnSpeechRecognitionListener

@Override
public void OnSpeechRecognitionStarted() {}

@Override
public void OnSpeechRecognitionStopped() {}

@Override
public void OnSpeechRecognitionFinalResult(String s) {
	//triggered when SpeechRecognition is done listening.
	//it returns the translated text from the voice input
}
@Override
public void OnSpeechRecognitionCurrentResult(String s) {
	//this is called multiple times when SpeechRecognition is
	//still listening. It returns each recognized word when the user is still speaking
}
@Override
public void OnSpeechRecognitionError(int i, String s) {}

Note OnSpeechRecognitionCurrentResult will NOT be called if your are using the GoogleVoiceIme dialog.

Options

Method Default Description
setContext(Context) Null Use this to change SpeechRecognition current context
setPreferredLanguage(String) - Not yet implemented
handleAudioPermissions(boolean) true set false to handle audio permissions yourself. If false, then no need to setSpeechRecognitionPermissionListener()
useOnlyOfflineRecognition(boolean) false set true to force android to use its Offline Recognition Engine. By default, android uses either or both online and offline. false is recommended.
isSpeechRecognitionAvailable() - returns true or false whether the device supports speech recognition or not
useGoogleImeRecognition(boolean, String) false whether to use GoogleVoiceIme Dialog or not. If true, set a prompt to display on the dialog or null to use default.
startSpeechRecognition() - start listening for voice input
stopSpeechRecognition() - dispose resources

Errors

See SpeechRecognizer class for error definitions.

License

Copyright (c) 2018 Maxwell Obi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].