4

I want to make a speech recognizer app which transcribes the user's speech. I do not want any dialog while doing that, so startActivityForResult with recognizerIntent is out of the option. (I know I can get audio if I use this approach)

I am using SpeechRecognizer for that and call startListening to listen user's audio. I am getting results with very good accuracy in onResults.

Now, I also need the audio of user stored in sdcard in my device. For that I have tried both MediaRecorder as well as AudioRecord, but not getting any success. I am always getting Network Error in onError of RecognitionListener. I can't find anyway on how to overcome this issue. I have also tried to get data from onBufferReceived, but in vain.

If anyone can throw some light on this, then that would be great.

[Edit]

Guys, this is not a duplicate of record/save audio from voice recognition intent, it's slightly different. The answer you gave is for Google Keep. Keep uses the dialog to get data. I do not need a dialog hanging on the screen.

Community
  • 1
  • 1
Name is Nilay
  • 2,743
  • 4
  • 35
  • 77
  • 1
    Duplicate of http://stackoverflow.com/questions/38759020/get-uri-of-saved-audio-in-onresultsbundle-result-in-speech-recognitionlistener – Nikolay Shmyrev Sep 14 '16 at 20:20
  • @NikolayShmyrev - Ok, but that too is an unanswered post !! – Name is Nilay Sep 15 '16 at 05:16
  • 1
    This isn't possible right now, but it should be. – brandall Sep 15 '16 at 06:54
  • 1
    Possible duplicate of [record/save audio from voice recognition intent](http://stackoverflow.com/questions/23047433/record-save-audio-from-voice-recognition-intent) – Kaarel Sep 16 '16 at 19:45
  • @Kaarel No, actually it's slightly different. The answer you gave is for Google Keep. Keep uses the dialog to get data. I do not need a dialog hanging on the screen. – Name is Nilay Sep 17 '16 at 07:23
  • @NameisNilay Well, the question there is "I want to save/record the audio that google recognition service used for speech to text operation (using RecognizerIntent or SpeechRecognizer)." i.e. the question is broader and the (current) answers just cover half of it. – Kaarel Sep 17 '16 at 09:44
  • @NameisNilay The question should specify which underlying recognizer are you using. E.g. http://kaljurand.github.io/K6nele/ supports onBufferReceived, but apparently you are using some other recognizer. Which one (incl version number)? Android itself (i.e. the public API of Android) does not provide any other way to receive the audio than onBufferReceived, but conforming recognizers are not required to implement this. – Kaarel Sep 17 '16 at 09:53
  • You have marked lot of other similar questions as duplicates today. It is clear you "searched and marked" them. Even though your answer might be correct, your actions are questionable. – PeakGen Sep 23 '16 at 12:43
  • @PeakGen - It was suggested to me by the moderator to do so. – Name is Nilay Sep 23 '16 at 12:52
  • You have linked all them to a thread with answers which do not work. I know because I tested them sometime back and found my own way of handling this issue successfully. It seems like you are targeting specific users and their posts. Also I noticed your comments disappearing without a reason. Not a best practice in staxkoverflow. Reporting to mods – PeakGen Sep 23 '16 at 13:01
  • @PeakGen I posted my solutions to all those questions, and mod deleted my post, saying the answer is duplicate and you should mark all as duplicates. Should I post my solution to the post I redirected all the other questions ? – Name is Nilay Sep 23 '16 at 13:09
  • Answer is duplicate???? – PeakGen Sep 23 '16 at 13:11
  • @PeakGen Yeah, I almost copied this same answer and pasted with it very little modification in all those posts. Edited each one as needed by that respective question. Hence deleted by moderator. – Name is Nilay Sep 23 '16 at 13:12

1 Answers1

1

I have successfully accomplished this with the help of CLOUD SPEECH API. You can find it's demo by google speech.

The API recognizes over 80 languages and variants, to support your global user base. You can transcribe the text of users dictating to an application’s microphone, enable command-and-control through voice, or transcribe audio files, among many other use cases. Recognize audio uploaded in the request, and integrate with your audio storage on Google Cloud Storage, by using the same technology Google uses to power its own products.

It uses audio buffer to transcribe data with help of Google Speech API. I have used this buffer to store Audio recording with help of AudioRecorder.

So with this demo we can transcribe user's speech parallely with Audio Recording.

Name is Nilay
  • 2,743
  • 4
  • 35
  • 77