1

Using google speech Api we can convert Speech to text using given link. But I already have an Audio file and I want that file to be converted into text. Please help. Thank You.

Mehul Kanzariya
  • 888
  • 3
  • 27
  • 58
  • Possible duplicate of [Speech to Text from own sound file](http://stackoverflow.com/questions/6989981/speech-to-text-from-own-sound-file) – Kartik Sharma Jan 02 '17 at 06:47
  • @KartikSharma That does not have a perfect solution. It's a workaround. In updated google speech API it is possible to do that without any workarounds. But there is no documentation provided. – Mehul Kanzariya Jan 02 '17 at 06:51

1 Answers1

-1

When u click on Speech button that time call

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(R.string.speech_prompt));
    try {
        startActivityForResult(intent, REQ_CODE_SPEECH_INPUT);
    } catch (ActivityNotFoundException a) {
        Toast.makeText(getApplicationContext(),
                getString(R.string.speech_not_supported),
                Toast.LENGTH_SHORT).show();
    }

@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;
    }

    }

I think it will help you

Rahul Karande
  • 259
  • 2
  • 9