SpeechRecognizer with Audio recording in Android - android

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.

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

How to access Input and Output audio stream of a Voice call as well as VoIP call on Android?

I am trying to access the Input and Output audio stream of any Voice call as well as VoIP calls. The functionality should be very similar to the native call recorder already available.
I have already looked into MediaRecorder.AudioSource but Voice_uplink, Voice_downlink, and VOICE_COMMUNICATION are not allowed for Third-Party apps.
My use-case is, I am trying to build an application that needs access to the call audio, be it voice call or VoIP, etc. My app will do post-processing on the recorded audio, once the call gets over.
Any help would be highly appreciated.

Speech Recognition with MediaRecorder - Android

I am making an app in which I am recording a video and at the same time want to implement a speech-to-text recognition functionality without speech dialog, can someone tell me how to proceed.
I would recommend using the RecognizerIntent Class. The class sends the recorded speech to a Google cloud server. The server in turn converts the speech to text and sends the results to your app.
A worked out example can be found on the following site
right here.
Using this approach however does imply that your app will rely having a working internet connection. Only if the user decides to enable offline voice typing in the phone's settings, won't the app be relying on a working internet connection.

Chrome web audio api - how to play sound in a phone call

I cant find anything online but how can i use a chrome tab web audio api in an android app so i can play sound during a phone call.
i went to this site but when i play the sound during a phone call the far end doens't here anything. I thought one feature of web audio was that it can play change the sound of someones voice in a phone call, so i thought it had access to the audio phone call stream.
even here the tech says its ready for android but i cant even get hte audio recorder demo to work on android.
While you do (with the user permission) have access to the input of the device you only have access to the main output of the device (internal speakers or headphones). This is represented as the AudioContext.destination. The buffers in a call is (probably) a different output that you simply don't have access to in Web Audio (and that's probably a good thing. Imagine the security issues we'd have if apps were allowed to hijack calls!).

Android voice activity detection offline

I need to detect if there is voice in the environment, and I need to do all the processing in the phone without sending any sound information to a server because of privacy concerns.
I know there is a class in android called SpeechRecognizer http://developer.android.com/reference/android/speech/SpeechRecognizer.html
But as far as I know, it needs to be connected to a google server (or other server).
My question is if there is a way of using this class to detect voice without sending info through internet.
I read a tip from here http://www.itworld.com/mobile-wireless/327712/use-offline-speech-text-your-android-jelly-bean-device which says that I could "Download offline speech recognition", but I don't know if this is enough for my needs.
I have some knowledge of signal processing and classification and I think I could develop a voice activity detection by using the Android AudioRecord class, but I would like to know first if SpeechRecognizer permits the detection offline (And how it does) so I could save time.
Thanks in advance for your response.
SpeechRecognizer is a way of connecting apps to speech recognizers. These speech recognizers extend RecognitionService. Some of these speech recognizers might do offline recognition, some of them might claim that they do, but actually don't. So if you have privacy concerns then rather implement your own recognizer.
The other question is if speech recognition is the right tool for voice activity detection.
Regarding the API to the speech recognizer, i.e. the constants in RecognizerIntent, there is no boolean for online/offline or anything specific for voice activity.

sharing audio input on Android

I am doing some preparation research for an Android phone app that would involve voice search or speech recognition while the user is simultaneously engaged in a phone call. I'm finding that when I am in the middle of a call and attempt to invoke voice search or a similar action that would take input from the microphone I get an "audio error" message. Does the phone app take exclusive control over the microphone input of the phone such that other apps cannot get access to audio input?
In answer to the direct question, Yes. The phone app takes full exclusive control over the microphone input. This is the same with all apps that use the microphone. Only one app can have access to the microphone at a time. HOWEVER, in hope for your app, you can access the voice uplink stream, which is the same thing (it is what is spoken into the mic and uploaded to the service towers), plus it won't interfere with the call at all. You can do it like this:
MediaRecorder mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_UPLINK);
You will have to add the permissions to record to the Manifest and such, but that's about it for that. Luckily the speech recognition stuff is all built in, so you should be able to find out how to do that fairly easily by just poking around a bit on here or Googleing it. Unfortunately, I myself don't have anything to offer you in that field however.
Hope this helps!

Categories

Resources