Sunday, 6 September 2015

Speech to Test Conversion


What is Speech Recognition?


Speech Recognition is a technology that allows the Mobile device to identify and understand words spoken by a person using a microphone. The ultimate goal of the technology is to be able to produce a system that can recognize with 100% accuracy all words that are spoken by any person.

Even after years of research in this area, the best speech recognition software applications still cannot recognize speech with 100% accuracy. Some applications are able to recognize over 90% of words when spoken under specific constraints regarding content and previous training to recognize the speaker's speech characteristics.

Android API , that understands your speech enables you to have conversations with Mobile device. These conversations would include you and the device speaking as commands or in response to events, input, or other feedback.

Speaking is easier and more intuitive than selecting buttons in keyboards. Human speech has evolved over many thousands of years to become an efficient method of sharing information and giving instructions.





GUI Components - 

Image Button ( call promptSpeechInput())
Text view Button ( To show the result) 


// Showing google speech input dialog (This function should call from Image button click event)
     
    private void promptSpeechInput() {
        Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
        RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault());
        intent.putExtra(RecognizerIntent.EXTRA_PROMPT,
        getString("Say something"+…));
        try {
           startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
        }  
            catch (ActivityNotFoundException a) {
            Toast.makeText(getApplicationContext(),
            getString("Sorry! Your device doesn\'t support speech input"),
            Toast.LENGTH_SHORT).show();
        }
    }


  // Receiving speech input     

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch (requestCode) {
        case REQ_CODE_SPEECH_INPUT: 
           {
          if (resultCode == RESULT_OK && null != data) {
         ArrayList<String> result = 
         data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
         txtSpeechInput.setText(result.get(0));
            }
            break;
        }
        }
    }


No comments:

Post a Comment

How to do text writing animation?  In Android Development we do not have the option to use any other custom font in our default Tex...