问题
I have just started working on android and I am trying to understand how android audio sub-system (alsa) works. I am running an android image in virtual-box running on windows-7 (64 bit).
I was fiddling with alsa-utils to record sound. I tried
alsa_aplay -C -f S16_LE -c 2 -r 44100 -d 5 foo.wav
it said something like:
Recording WAVE foo.wav : Signed 16 bit little endian, rate 44100, stereo
However, the output file created appears to be blank (after the wav file header).
od -x foo.wav
0000000 4952 4646 7574 000d 4157 4556 6d66 2074
0000020 0010 0000 0001 0002 ac44 0000 b110 0002
0000040 0004 0010 6164 6174 7550 000d 0000 0000
0000060 0000 0000 0000 0000 0000 0000 0000 0000
*
3272560 0000 0000 0000 0000 0000 0000
3272574
I also found that alsa_amixer
is seg faulting.
Simple mixer control 'Master',0
Capabilities: pvolume pswitch pswitch-joined penum
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Segmentation fault
alsa_ctl
init also throws an error but proceeds with some default config
Unknown hardware: "ICH" "Sigmatel STAC9700,83,84" "AC97a:83847600" "0x8086" "0x0000"
Hardware is initalized using a guess method
When I check the current config used by alsa using alsa_ctl store -f cur_config.txt
it has capture switch: true
and capture volume: value.0 = 8 & value.1 = 8
output of alsa_amixer scontrols
Simple mixer control 'Master',0
Simple mixer control 'Master Mono',0
Simple mixer control '3D Control - Switch',0
Simple mixer control '3D Control Sigmatel - Depth',0
Simple mixer control 'PCM',0
Simple mixer control 'PCM Out Path & Mute',0
Simple mixer control 'Surround Phase Inversion',0
Simple mixer control 'Line',0
Simple mixer control 'CD',0
Simple mixer control 'Mic',0
Simple mixer control 'Mic Boost (+20dB)',0
Simple mixer control 'Mic Select',0
Simple mixer control 'Video',0
Simple mixer control 'Phone',0
Simple mixer control 'Beep',0
Simple mixer control 'Aux',0
Simple mixer control 'Mono Output Select',0
Simple mixer control 'Capture',0
Simple mixer control 'Mix',0
Simple mixer control 'Mix Mono',0
Simple mixer control 'External Amplifier',0
Simple mixer control 'Sigmatel 4-Speaker Stereo',0
Simple mixer control 'Sigmatel ADC 6dB Attenuate',0
Simple mixer control 'Sigmatel DAC 6dB Attenuate',0
Any idea why I am not able to record?
[UPDATE]
The default audio controller in vbox was ICH AC 97
. I changed it to Intel HD Audio
and tried the same things and it worked. Now I am able to record sound. The lsmod | grep snd
output in both the cases is:
**`ICH AC 97`**
snd_intel8x0 19446 3 - Live 0xf80e9000
snd_ac97_codec 76811 1 snd_intel8x0, Live 0xf80bf000
ac97_bus 730 1 snd_ac97_codec, Live 0xf809a000
snd_pcm 47290 3 snd_intel8x0,snd_ac97_codec, Live 0xf8080000
snd_timer 12553 1 snd_pcm, Live 0xf805f000
snd_page_alloc 4893 2 snd_intel8x0,snd_pcm, Live 0xf804f000
**`Intel HD Audio`**
snd_hda_codec_idt 37680 1 - Live 0xf8108000
snd_hda_intel 16006 3 - Live 0xf80de000
snd_hda_codec 49045 2 snd_hda_codec_idt,snd_hda_intel, Live 0xf80ba000
snd_hwdep 3844 1 snd_hda_codec, Live 0xf809c000
snd_pcm 47290 3 snd_hda_intel,snd_hda_codec, Live 0xf8080000
snd_timer 12553 1 snd_pcm, Live 0xf805f000
snd_page_alloc 4893 2 snd_hda_intel,snd_pcm, Live 0xf804f000
output of ls /dev/snd
also differs:
**ICH AC 97**
controlC0
pcmC0D0c
pcmC0D0p
pcmC0D1c
timer
**Intel HD**
controlC0
hwC0D0
pcmC0D0c
pcmC0D0p
pcmC0D1c
pcmC0D1p
timer
I tried comparing the strace -f alsa_aplay -C foo.wav
, but couldn't find any thing useful there. The only difference is that, after the ioctl call, '0000' is being written in first case (with ICH AC 97), where as some meaningful data is written with 'Intel HD Audio'
Could this be because of some driver issues?
[UPDATE ENDS]
Thanks, Vikram
来源:https://stackoverflow.com/questions/5894582/alsa-aplay-not-recording-on-android