Audio Capture on Beagle Board

79 views
Skip to first unread message

aney

unread,
Nov 13, 2009, 10:15:01 PM11/13/09
to android-porting
Hi all
I am working on TI's Beagle board running Android kernel on top of
it.I am validating Audio Interface on Beagle board. I tested Audio-out
by playing media file using Mediaplayer application.Audio out is
fine.Now i am facing problems in capturing Audio.I connect the Mic-in
of headset to audio-in on Beagle board and run the TonePicker and
SoundRecorder applications for capturing audio.But the size of the
captured file is always 0 bytes. Can someone tell me which application
to use for capturing audio?Can alsa utils be used for capturing audio?
The external/alsa_utils/aplay/aplay.c file speaks about audio
recording and playback.Can it be used for capturing audio?

Thanks & Regards
Ananth

Ben Friedberg

unread,
Nov 16, 2009, 8:46:21 PM11/16/09
to android-porting
Ananth,

I think that you should be able to symlink alsa_arecord to the
alsa_aplay binary for recording. What does your logcat output look
like? Any audio errors? What's the sound chip on the Beagle? Do you
have an /etc/asound.conf defined? For recording, one thing that I
found (can't remember where, unfortunately, but prolly on this board)
was that my sound hardware couldn't handle alsa's default 2-channel
record. I had to enable 1-channel record on the default device with
this:

include: git diff external/alsa-lib/include/config.h
diff --git a/include/config.h b/include/config.h
index 52dfc11..9b6ce18 100644
--- a/include/config.h
+++ b/include/config.h
@@ -46,10 +46,11 @@
/* #undef BUILD_PCM_PLUGIN_MULAW */

/* Build PCM rate plugin */
/* #undef BUILD_PCM_PLUGIN_RATE */

/* Build PCM route plugin */
/* #undef BUILD_PCM_PLUGIN_ROUTE */
+#define BUILD_PCM_PLUGIN_ROUTE "1"

/* Build raw MIDI component */
/* #undef BUILD_RAWMIDI */

and updating this line in hardware/alsa_sound/AudioHardwareALSA.cpp:

if (err < 0) {
// None of the Android defined audio devices exist. Open a
generic one.
//**** THIS ONE -> devName = "hw:00,0";
devName = "default"; //This is the line you want
err = snd_pcm_open(&mHandle, devName, mDefaults->direction,
0);
if (err < 0) {
// Last resort is the NULL device (i.e. the bit bucket).
devName = _nullALSADeviceName;
err = snd_pcm_open(&mHandle, devName, mDefaults-
>direction, 0);

aney

unread,
Nov 18, 2009, 12:57:07 PM11/18/09
to android-porting
Hi Ben

>I think that you should be able to symlink alsa_arecord to the alsa_aplay binary for recording:

You are spot on!!! I was able to symlink alsa_arecord to
alsa_aplay.Now i am able to capture audio using alsa_arecord:-)I
connected the Line-in of my Media Player to the line-in on my
beagleboard.I used the alsa_arecord application for capturing audio
and i could play it back sucessfully:-)thanks a lot for your
suggestion Ben.

>What does your logcat output look like? Any audio errors?
I dont get any audio errors.

>What's the sound chip on the Beagle?
The beagle board uses TWL4030 as its sound chip.It
performs as an audio codec engine as well as a power module.when i
do : #cat /proc/asound/cards i get the following:

0 [omap3beagle ]: twl4030 - omap3beagle
omap3beagle (twl4030)


> Do you have an /etc/asound.conf defined?
No i dont have /etc/asound.conf file.Is there any serious
consequence i might experience for not having this file?

Ben i have a couple of questions for you.Could you kindly clarify it ?

Q1.when i give : #alsa_amixer contents i see a lot of interfaces with
different values set as default.So before capturing audio do i need to
select a particular interface as capture source?Say for example i have
something like:

numid=17,iface=MIXER,name='Analog Left Capture Route'
; type=ENUMERATED,access=rw------,values=1,items=5
; Item #0 'Off'
; Item #1 'Main mic'
; Item #2 'Headset mic'
; Item #3 'AUXL'
; Item #4 'Carkit mic'
: values=0

Q2.Could you tell me how to set values for the above interface using
alsa_amixer?I wanted to choose 'AUXL' present above.How must i enable
it ?'values=1' what does this mean?

Q3.I am bit confused about line-in and mic-in.whats the difference
between line-in and mic-in?From the Beagle Board schematics i found
out that it uses line-in.Does this mean that i cannot capture audio
via my microphone ?If at all i need to record my own voice how can i
do it?


Thanks & Regards
Ananth
> > Ananth- Hide quoted text -
>
> - Show quoted text -

ani

unread,
Nov 24, 2009, 1:13:25 AM11/24/09
to android-porting
Please answer this question as i also have same queries!!

Misael Lopez

unread,
Nov 24, 2009, 1:58:59 AM11/24/09
to android...@googlegroups.com
>> Q1.when i give : #alsa_amixer contents i see a lot of interfaces with
>> different values set as default.So before capturing audio do i need to
>> select a particular interface as capture source?Say for example i have
>> something like:
>>
>> numid=17,iface=MIXER,name='Analog Left Capture Route'
>> ; type=ENUMERATED,access=rw------,values=1,items=5
>> ; Item #0 'Off'
>> ; Item #1 'Main mic'
>> ; Item #2 'Headset mic'
>> ; Item #3 'AUXL'
>> ; Item #4 'Carkit mic'
>> : values=0

That specific control select the analog source for the left channel on
the TWL4030 codec.
You should set it to the input you are interested in capture from,
using alsa_mixer.
There is a similar control for the analog source for right channel.

>> Q2.Could you tell me how to set values for the above interface using
>> alsa_amixer?I wanted to choose 'AUXL' present above.How must i enable
>> it ?

alsa_amixer is the renamed version of ALSA's amixer utility. To select
AUXL you can do:

alsa_amixer cset numid=17 3

>> 'values=1' what does this mean?

It means that the control can have a single value. Consider the case
of a stereo volume control, it should have values=2 as you can set the
volume (value) for each channel.

>> Q3.I am bit confused about line-in and mic-in.whats the difference
>> between line-in and mic-in?From the Beagle Board schematics i found
>> out that it uses line-in.Does this mean that i cannot capture audio
>> via my microphone ?If at all i need to record my own voice how can i
>> do it?

I think mic-in has a mic bias, and line-in does not. You should also
ensure that the analog sources are selected accordingly.

Regards,
-Misa

2009/11/24 ani <anish198...@gmail.com>:
> --
> unsubscribe: android-porti...@googlegroups.com
> website: http://groups.google.com/group/android-porting

ananth

unread,
Nov 24, 2009, 11:29:27 AM11/24/09
to android...@googlegroups.com
Hi Misa
    Thanks a lot for your explaination.You were crystal clear in your replies.I have one more doubt.A non-technical one.Ah, in the Android source provided by Embinux, the kernel has  ALSA SOC(ASOC) support only for OMAP3Beagle board and it doesn't have the ALSA SOC support for OMAP3EVM board.Without this ASOC support for OMAP3EVM Board we cant have Audio working on OMAP3EVM board.So, do you have any idea of how to go about in enabling ASOC for OMAP3EVM board?
Thanks & Regards
Aney

Misael Lopez

unread,
Nov 24, 2009, 12:15:35 PM11/24/09
to android...@googlegroups.com
Support for omap3evm board is already there in ASoC tree:

http://git.kernel.org/?p=linux/kernel/git/broonie/sound-2.6.git;a=blob;f=sound/soc/omap/omap3evm.c;h=f484dcd634089562727d189f14615cbf84246d60;hb=97cef58521288ade8d957e4d568a3d409dea7d64

You need to pick that machine file from SoC git tree and modify
sound/soc/omap/Kconfig & Makefile accordingly. I guess you already
have the kernel working for your omap3evm board.

-Misa

2009/11/24 ananth <ananth8...@gmail.com>:

ananth

unread,
Nov 24, 2009, 12:20:52 PM11/24/09
to android...@googlegroups.com
Hi Misa
    Since the kernel from Embinux did not have ASOC support for OMAP3EVM, so I am currently using the kernel provided by Mistral which has the ASOC support for OMAP3EVM board.I am trying to enable the ASOC support for OMAP3EVM board on the Embinux kernel.
Thanks & Regards
Ananth
Reply all
Reply to author
Forward
0 new messages