8

I have an Android application that begins recording from the microphone when the application starts. In my current version, the user must press a STOP button to stop recording.

How do I detect that the user has stopped talking and use that to trigger the recorder to stop?

Similar to what is implemented in the Speech Recognition functionality in Android. The user stops talking and then the speech is translated. I have seen other apps that do it, like Talking Tom type apps.

As a side note I would also love to show some type of visual indicating that the microphone is receiving sound. Something to show the sound level coming in.

Any help appreciated.

Doug
  • 1,991
  • 4
  • 25
  • 35

2 Answers2

5

An approach is to use threads on recording and the speech power analyzing process on the recorded bytes, there's a sample code for your reference: http://musicg.googlecode.com/files/musicg_android_demo.zip

dennisy
  • 211
  • 4
  • 3
0

What are you using to record audio? This may provide some clues:

android.media.MediaRecorder:

  • the constant MEDIA_RECORDER_INFO_MAX_DURATION_REACHED can be used with an onInfoListener.

android.speech.SpeechRecognizer:

  • attach a RecognitionListener and call onEndofSpeech().
Ian
  • 3,500
  • 1
  • 24
  • 25
  • I am using MediaRecorder to record. And I can't use SpeechRecognizer because I need to save the audio file. I can't find a way to save to audio from SpeechRecognizer and I can't connect both the MediaRecorder and the SpeechRecognizer to the mic at the same time. I will check out MEDIA_RECORDER_INFO_MAX_DURATION_REACHED – Doug Mar 09 '11 at 16:36
  • it looks as though others want to also recognize speech from an saved audio file: http://stackoverflow.com/questions/2319735/voice-recognition-on-android-with-recorded-sound-clip If you don't need the same voice you could convert the response of speechrecognizer and then record the TextToSpeech output of the text. Although these seems needlessly complicated and probably very prone to transcription errors. – Ian Mar 09 '11 at 17:28
  • I saw that thread too. Actually, I want the opposite. I want to use Google's STT engine and get the text transcription back but also save the audio that the user spoke. Well, not the opposite but a different order. Can't do it though. – Doug Mar 09 '11 at 17:34
  • what's your final conclusion? – Ian Mar 11 '11 at 01:45
  • did you get any solution to this problem, i am also looking into it. – UMAR-MOBITSOLUTIONS Nov 25 '11 at 14:34
  • You cant use recognizer and recorder together; because you have only one microphone. Microphone must be used only one listener in one time – dnkilic Mar 07 '16 at 13:28