1

So I'm trying to make an app accessible for deaf/HoH people and so far I'm able to get the audio bytes that is being currently played in the app (I think).

The thing is, can I use this SpeechRecognizer to send the audio bytes and get the text results?

Couldn't find a method for this and I'm wondering if I'm in the right library to perform this task.

I looked up for Speech APIs and I couldn't find nothing for free (obviously) so I'm looking in the android libraries.

Any information is helpful for me.

Question edit: Is there any library or something that could do this speech to text from audio bytes or any other information that need?

Barrufet
  • 495
  • 1
  • 11
  • 33
  • Have you tried [AudioBytes](https://developers.google.com/android/reference/com/google/android/gms/nearby/messages/audio/AudioBytes)? – Ric17101 Nov 03 '21 at 01:56
  • coz' there's a method you can call `toMessage()` – Ric17101 Nov 03 '21 at 01:57
  • 1
    SpeechRecognizer streams audio to remote servers to perform speech recognition and you can get the text via RecognitionListener#onResults(Bundle) and RecognitionListener#onPartialResults(Bundle) methods. You can use the startListening(Intent recognizerIntent) to start listening for speech. If you already have the audio bytes the SpeechRecognizer currently doesn’t support any method to convert them to text. – MariosP Nov 03 '21 at 09:22
  • Hey @MariosP I don't want to listen nothing I already got the audio bytes, I want this audio bytes to text, is that possible? – Barrufet Nov 08 '21 at 11:37
  • I took a look and I don't think that's what I'm looking for @Ric17101 – Barrufet Nov 08 '21 at 11:38
  • @Barrufet check this https://github.com/Azure-Samples/Cognitive-Speech-STT-Android as mentioned here https://stackoverflow.com/questions/34942196/can-i-convert-an-mp3-file-to-text-in-android and modify the code based on your needs. – MariosP Nov 08 '21 at 13:35
  • Already tried to use it but I need an api key and probably set up some billing as they say it's only free for some months @MariosP – Barrufet Nov 08 '21 at 19:02

1 Answers1

0
ArrayList<String> data = bundle.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
editText.setText(data.get(0));

See this Medium post that goes into more detail.

Nullable
  • 761
  • 5
  • 17
TrivPants
  • 79
  • 9