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.
Asked
Active
Viewed 719 times
1
-
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 Answers
-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
-
Sorry this is not what I am looking for. I need to this for already recorded file. – Mehul Kanzariya Jan 02 '17 at 06:58
-
whenever u can recording file that time u can convert into text using above code – Rahul Karande Jan 02 '17 at 07:02
-
But i already have an audio file. I want to convert that audio file into text. – Mehul Kanzariya Jan 02 '17 at 07:04