Record/Save Audio from Voice Recognition Intent

Android record audio while doing speech recognition

As the comments state, only one mic access is permitted/possible at a time.

For the SpeechRecognizer the attached RecognitionListener has a callback of onBufferReceived(byte[] buffer) but unfortunately, Google's native recognition service does not supply any audio data to this, it's very frustrating.

Your only alternative is to use an external service, which won't be free. Google's new Cloud Speech API has an Android example.

Android: Voice Recording and saving audio

There is an example of how to do audio capture using MediaRecorder in the Android Developer Documentation.

I would recommend saving the files on the SD Card and then have your gallery code check the SD card to see which files to display. You can get the directory of the SD Card using the Environment.getExternalStorageDirectory() method. It would be best to save your files in a subdirectory of the SD Card root directory.

Make sure you give your applications the Permissions it will need. At the very least it will need RECORD_AUDIO and WRITE_EXTERNAL_STORAGE.

Also you have to see these tutorials:

http://www.androiddevblog.net/android/android-audio-recording-part-1

http://www.androiddevblog.net/android/android-audio-recording-part-2

SpeechRecognizer with Audio recording in Android

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.



Related Topics



Leave a reply



Submit