RafaelThomasGozCoutinho

Why Android cannot record in Stereo? IMX53 QSB

Discussion created by RafaelThomasGozCoutinho on Aug 17, 2012
Latest reply on Aug 22, 2012 by RafaelThomasGozCoutinho

I try to record audio in stereo and it always fails, when I get the minbuffersize i get the error:

 

I/ActivityManager( 2147): Start proc com.example.recorder for activity com.example.recorder/.MainActivity: pid=3478 uid=10035 gids={1015}
E/AudioRecord-Java( 3478): [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
I/System.out( 3478): Buffer size -2
I/SurfaceFlinger( 2147): mHw->getFormat() 4

and if I force a min buffer size it throws:

W/dalvikvm( 3553): threadid=1: thread exiting with uncaught exception (group=0x2aac0560)
E/AndroidRuntime( 3553): FATAL EXCEPTION: main
E/AndroidRuntime( 3553): java.lang.IllegalStateException: Could not execute method of the activity
E/AndroidRuntime( 3553):     at android.view.View$1.onClick(View.java:2288)
E/AndroidRuntime( 3553):     at android.view.View.performClick(View.java:2629)
E/AndroidRuntime( 3553):     at android.view.View$PerformClick.run(View.java:9374)
E/AndroidRuntime( 3553):     at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 3553):     at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 3553):     at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 3553):     at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 3553):     at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3553):     at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 3553):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 3553):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 3553):     at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 3553): Caused by: java.lang.reflect.InvocationTargetException
E/AndroidRuntime( 3553):     at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3553):     at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 3553):     at android.view.View$1.onClick(View.java:2283)
E/AndroidRuntime( 3553):     ... 11 more
E/AndroidRuntime( 3553): Caused by: java.lang.IllegalArgumentException: Invalid audio buffer size.
E/AndroidRuntime( 3553):     at android.media.AudioRecord.audioBuffSizeCheck(AudioRecord.java:324)
E/AndroidRuntime( 3553):     at android.media.AudioRecord.<init>(AudioRecord.java:225)
E/AndroidRuntime( 3553):     at com.example.recorder.MainActivity.startRecording(MainActivity.java:207)
E/AndroidRuntime( 3553):     at com.example.recorder.MainActivity.startRecording(MainActivity.java:163)
E/AndroidRuntime( 3553):     ... 14 more
W/ActivityManager( 2147):   Force finishing activity com.example.recorder/.MainActivity
W/ActivityManager( 2147): Activity pause timeout for HistoryRecord{2b0c6578 com.example.recorder/.MainActivity}

 

 

It's odd cuz alsamixer for SGTL5000 gives me the option of capture left/right volume levels:

Simple mixer control 'Capture',0
  Capabilities: cvolume penum
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 15
  Front Left: Capture 15 [100%]
  Front Right: Capture 15 [100%]

 

However I cannot test it cuz i don't have alsa_arecord (that's another problem i'm having).

Outcomes