Hi,

My issue is resolved. I thought it may be helpful for others. So
posting the solution for the issue I was facing.

For the samplerate problem, we commented the code in frameworks/base/
libs/audioflinger/AudioHardwareInterface.cpp in

size_t AudioHardwareBase::getInputBufferSize(uint32_t sampleRate, int
format, int channelCount) function

 /* if (sampleRate != 8000) {
        LOGW("getInputBufferSize bad sampling rate: %d", sampleRate);
        return 0;
    }*/

Incase you don't have voicesearch.apk in your hardware you can get it
from net. I got it from this link http://www.chadhaney.com/droidXDefault/

You should also have GoogleServicesFramework.apk. you can download
from the above link

Also you need to download libspeech.so. You can get it in net.

Initially we were getting 'Connection problem'  when we ran the
application. Even though we are connected to the network (using
ethernet).

Since Androidframework didnt have support for ethernet in the
connectivity framework, application is not able to connect to
internet.

So to add ethernet support we took the patches from following links:

https://review.source.android.com/#dashboard,1001873
https://review.source.android.com/#dashboard,1001874

If you have wifi or data connection you need not use the above
patches.


Thanks and Regards,
ksp

On Dec 2 2010, 9:02 pm, Satya <[email protected]> wrote:
> Hi,
>
> I am new to Audio module and new to Android.
> I am getting the following error when I start "Voice Search"
> application.
>
> #########################
> W/InputManagerService(  965): Window already focused, ignoring focus
> gain of: com.android.internal.view.IInputMethodClient$S8
> D/dalvikvm( 1196): GC_EXPLICIT freed 1145 objects / 53992 bytes in
> 80ms
> I/ActivityManager(  965): Starting activity: Intent
> { act=android.intent.action.MAIN
> cat=[android.intent.category.LAUNCHER] }
> I/ActivityManager(  965): Displayed activity
> com.google.android.voicesearch/.RecognitionActivity: 539 ms (total 539
> ms)
> I/AudioService(  965):  AudioFocus  requestAudioFocus() from
> android.media.audiomana...@43f1eb48
> I/MicrophoneInputStream( 1196): Starting voice recognition with audio
> source VOICE_RECOGNITION
> W/AudioHardwareInterface(  919): getInputBufferSize bad sampling rate:
> 16000
> D/ALSAModule(  919): open called for devices 00040000 in mode 0...
> E/ALSALib (  919): external/alsa-lib/src/pcm/pcm.c:2210:
> (snd_pcm_open_noupdate) Unknown PCM AndroidCapture
> I/ALSAModule(  919): Initialized ALSA CAPTURE device default
> D/AcousticsModule(  919): Acoustics set_params stub called with 0.
> W/AudioHardwareInterface(  919): getInputBufferSize bad sampling rate:
> 16000
> E/AudioRecord( 1196): Recording parameters are not supported:
> sampleRate 16000, channelCount 1, format 1
> E/AudioRecord-JNI( 1196): Error creating AudioRecord instance:
> initialization check failed.
> E/AudioRecord-Java( 1196): [ android.media.AudioRecord ] Error code
> -20 when initializing native AudioRecord object.
> W/GoogleRecognitionService( 1196): Audio problem
> W/GoogleRecognitionService( 1196): java.lang.IllegalStateException:
> not open
> W/GoogleRecognitionService( 1196):      at
> com.google.android.voicesearch.endpointer.MicrophoneInputStream.<init>(Micr­ophone)
> W/GoogleRecognitionService( 1196):      at
> com.google.android.voicesearch.GoogleRecognitionService.setupMicrophoneInpu­tStrea)
> W/GoogleRecognitionService( 1196):      at
> com.google.android.voicesearch.GoogleRecognitionService.setupMicrophone(Goo­gleRec)
> W/GoogleRecognitionService( 1196):      at
> com.google.android.voicesearch.GoogleRecognitionService.startRecognitionInt­ernal()
> W/GoogleRecognitionService( 1196):      at
> com.google.android.voicesearch.GoogleRecognitionService.access
> $000(GoogleRecognit)
> W/GoogleRecognitionService( 1196):      at
> com.google.android.voicesearch.GoogleRecognitionService
> $1.handleMessage(GoogleRec)
> W/GoogleRecognitionService( 1196):      at
> android.os.Handler.dispatchMessage(Handler.java:99)
> W/GoogleRecognitionService( 1196):      at
> android.os.Looper.loop(Looper.java:123)
> W/GoogleRecognitionService( 1196):      at
> android.os.HandlerThread.run(HandlerThread.java:60)
> W/AudioPolicyManagerBase(  919): getOutput() could not find output for
> stream 3, samplingRate 0, format 0, channels c, flags0
> E/MediaPlayer( 1196): error (-19, 0)
> E/MediaPlayer( 1196): Error (-19,0)
> D/dalvikvm( 1040): GC_EXPLICIT freed 1822 objects / 107272 bytes in
> 89ms
> #####################################################
>
> As per my understanding, the sample rate that the Voicesearch
> Application is trying to set is not being supported by the
> AudioHardwareInterface module:
>
> AudioHardwareInterface(  919): getInputBufferSize bad sampling rate:
> 16000
>
> Even in the code the function(in AudioHardwareInterface.cpp) is
> returning error if the sample rate any other value other than 8000:
>
> ##############################
> size_t AudioHardwareBase::getInputBufferSize(uint32_t sampleRate, int
> format, int channelCount)
> {
>     if (sampleRate != 8000) {
>         LOGW("getInputBufferSize bad sampling rate: %d", sampleRate);
>         return 0;
>     }
>     if (format != AudioSystem::PCM_16_BIT) {
>         LOGW("getInputBufferSize bad format: %d", format);
>         return 0;
>     }
>     if (channelCount != 1) {
>         LOGW("getInputBufferSize bad channel count: %d",
> channelCount);
>         return 0;
>     }
>
>     return 320;
>
> }
>
> ########################################
>
> Not able to understand why this restriction on SampleRate/channelCount
> is there in the hardware Interface layer
> Are we expected to change this code to suit our hardwares.Can some one
> help me in resolving this error.
>
> Thanks in Advance.
>
> Regards,
> Satya

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to