• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Droidcon ppt

Droidcon ppt



ppt for the

ppt for the



Total Views
Views on SlideShare
Embed Views



1 Embed 4

http://www.linkedin.com 4



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.


11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • Explain the 4 models – their definitions.

Droidcon ppt Droidcon ppt Presentation Transcript

  • Move as I speakUnderstanding the development of a game that is controlled through voice commands
  • Agenda Voice recognition in androidImplementing Voice recognition in android Using Android speech input API Using IMEIntegrating Voice recognition in the GameControlling the Game through voice commandsLimitations
  • Voice Recognition in Android
  • Voice Recognition in Android Available in android since Android 1.5 . voice recognition can be used only when connected to the internet until Android 4.0.X(ICS) . Voice sent to the cloud which returns an array of results . Voice recognition is available in offline mode in Android 4.1(Jelly bean) . English(US) is given as default language and many other languages are available for download.
  • Google’s Speech RecognizerGoogle’s Speech Recognizer Google speech ser ver ! Japanese! US English! …! Acoustic Dictionar y! Acoustic Dictionar y! Model! Model! Search Dictation Search Dictation Language Language Language Language Model! Model! Model! Model!
  • Implementing VoiceRecognition in Android
  • Android Speech Input API Android’s open platform makes it simple to access Google’s speech recognizer programmatically from your application(or any other recognizer that registers for RecognizerIntent) Simple to Use the API to: • Prompt the user to start speaking, • Stream the audio Googles Servers, • Retrieve the recognition hypothesis
  • Example Code//called when someone clicks on a button in the app public void onClick(View v) {// create a recognition request Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);// Set the language model intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);// Send the request to display propmpt, record audio, and return a result intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech recognition demo"); startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE); } // Called when speech recognition is finished protected void onActivityResult(int requestCode, int resultCode, Intent data) { //Get the n-best list ArrayList<String> matches = data.getStringArrayListExtra( RecognizerIntent.EXTRA_RESULTS);//Do something with best result DoSomething(matches.get(bestResult));}
  • Parameters Language(EXTRA_LANGUAGE), e.g• Ja_jp (Japanese)• en_us (US English) If not set ,then the phones default language is used. Language Model hints(EXTRA_LANGUAGE_MODEL)• Search - Good for short queries, business names, cities. The types of things people search for on Google.• Free Form - For dictation . Sending e-mail, SMS, etc.
  • Using IMEpublic void onCreate() {super.onCreate(); // Create the voice recognition trigger // The trigger has to unregistered, when the IME is destroyed.mVoiceRecognitionTrigger = new VoiceRecognitionTrigger(this); //register the listener. mVoiceRecognitionTrigger.register(new VoiceRecognitionTrigger.Listener() { @Override public void onVoiceImeEnabledStatusChange() { // The call back is done on the main thread. updateVoiceImeStatus(); } });}
  • Using IME// Use this method to start voice recognition.mVoiceRecognitionTrigger.startVoiceRecognition(“en_us”);public void onDestroy() { if (mVoiceRecognitionTrigger != null) { // To avoid service leak, the trigger has to be unregistered //when the IME is destroyed. mVoiceRecognitionTrigger.unregister(this); } super.onDestroy(); }
  • Integrating Voice recognition in the Game Google voice API can not be used for a game because an intent has to be fired every time to fetch the results for every voice command. IME has to be used which provides continuous feed back of the voice commands to the application.
  • Controlling the game through Voice commands// Called when speech recognition is finished protected void onActivityResult(int requestCode, int resultCode, Intent data) { //Get the n-best list ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULT); //store the best result into a variable which is used as acommand in the game voiceRecognizer.command=matches.get(bestResult));
  • Controlling the game through Voice commands// Method which is used to render . This method is calledcontinuously in the gamepublic void animRender(Canvas c){ String voiceCommand = voiceRecognizer.command; if(voiceCommand.equalsIgnoreCase("left")) { //do some action } else if(voiceCommand.equalsIgnoreCase("right")) { //do some action }}
  • Limitations Similar to other assistive technologies, voice recognition systems have their own limitations. The most significant limitation is that they can be inaccurate. You always have to make your voice clear and easy to understand. Lastly, not all persons with motor disabilities can use voice recognition systems.