Speech Recognition: Speech to text in Sketchware


We can implement Speech recognition using codes in add source directly block in Sketchware. Follow the steps below to implement Speech recognition in Sketchware.

1. Create a new android project in Sketchware.

2. In VIEW area add a Button button1 and an EditText edittext1 (or a TextView).

3. Add a new FilePicker component fp.

4. Add a new More Block extra.

5. To define this block extra, use an add source directly block and put following code in it:
}
public static final int REQ_CODE_SPEECH_INPUT = 1;
{

6. In the event button1 onClick, use an add source directly block and put following code:
Intent intent = new Intent(android.speech.RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE_MODEL, android.speech.RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()); intent.putExtra(android.speech.RecognizerIntent.EXTRA_PROMPT, "Speak Now");
try { startActivityForResult(intent, REQ_CODE_SPEECH_INPUT); }
catch (ActivityNotFoundException a) {
Toast.makeText(getApplicationContext(), "There was an error", Toast.LENGTH_SHORT).show(); }

7. Add the event FilePicker onFilesPicked. Here use an add source directly block and put following code:
}
break;
case REQ_CODE_SPEECH_INPUT:
if (_resultCode == RESULT_OK && null != _data) {
ArrayList<String> result = _data.getStringArrayListExtra(android.speech.RecognizerIntent.EXTRA_RESULTS);
edittext1.setText(result.get(0));

8. Save and run the project. Now in the app, the Button can be pressed to speak things to be written in the EditText field.

Comments

  1. Please , add video "how to your app work is background"

    ReplyDelete
  2. Please add video how to creat one time view activity(page)

    ReplyDelete
  3. i am sri lanka....i watched your all videos....i am your subscriber....👊👊👊👊

    ReplyDelete
  4. Thank you for this excellent tutorial...
    I'm working on an app, and I want to get the current location of the device, how can I do this in sketchware?
    Thank you!

    ReplyDelete
  5. Replies
    1. How to use your code on sketchware.. Please add screen shot

      Delete
  6. How to make a application like this ?

    https://github.com/AllAboutEE/Android-App-HTTP-Helper/blob/master/app/src/main/java/com/allaboutee/httphelper/HomeActivity.java

    ReplyDelete
  7. how to automatic screenshot method in sketchware

    ReplyDelete
  8. Dear admin...
    Can you tell me how to change the speech recognition language?? I want use another language. Thank you!

    ReplyDelete
  9. how can i limit the time of the speech function, because it doesn't stop recognizing sound if there's still some noise.

    ReplyDelete
  10. Svp comment faire une application d'enregistrement audio

    ReplyDelete
  11. Create a SONG reconation app
    Like Google assistant

    ReplyDelete

Post a Comment

Popular posts from this blog

A Flash Light App in Sketchware

Create Music Player app in Sketchware

In Sketchware: How to create a calculator for any simple formula?

Simple car racing android game in Sketchware

Firebase auth in Sketchware for Login Activity