alsa_aplay 不在 Android 上录制
我刚刚开始研究 android,我试图了解 android 音频子系统(alsa)是如何工作的。我正在 windows-7(64 位)上运行的虚拟盒中运行 android 映像。
我正在摆弄 alsa-utils 来录制声音。我试过 alsa_aplay -C -f S16_LE -c 2 -r 44100 -d 5 foo.wav 它说的是这样的: 录制 WAVE foo.wav :签名 16 位小端,速率 44100,立体声
但是,创建的输出文件似乎是空白的(在 wav 文件头之后)。
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
我还发现 alsa_amixer
存在段错误。
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 也会抛出错误,但当
Unknown hardware: "ICH" "Sigmatel STAC9700,83,84" "AC97a:83847600" "0x8086" "0x0000"
Hardware is initalized using a guess method
我使用 alsa_ctl store -f cur_config.txt 检查 alsa 使用的当前配置时,会继续执行一些默认配置 它有捕获开关:true
和捕获音量:value.0 = 8 & value.1 = 8
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
知道为什么我无法录制吗?
[更新]
vbox 中的默认音频控制器是 ICH AC 97
。我将其更改为 Intel HD Audio
并尝试了相同的操作,结果成功了。现在我可以录制声音了。 lsmod | grep snd 两种情况下的输出都是:
**`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
ls /dev/snd 的输出也不同:
**ICH AC 97**
controlC0
pcmC0D0c
pcmC0D0p
pcmC0D1c
timer
**Intel HD**
controlC0
hwC0D0
pcmC0D0c
pcmC0D0p
pcmC0D1c
pcmC0D1p
timer
我尝试比较 strace -f alsa_aplay -C foo.wav ,但在那里找不到任何有用的东西。唯一的区别是,在 ioctl 调用之后,在第一种情况下(使用 ICH AC 97)写入“0000”,而使用“Intel HD Audio”写入一些有意义的数据,
这可能是因为某些驱动程序问题吗?
[更新结束]
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 triedalsa_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]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论