为什么当pulseaudio运行时aplay可以工作,而在其他情况下则不能?
我安装了 ubuntu,默认安装了pulseaudio。当pulseaudio运行时,它可以工作: aplay -D hw:2,7 /usr/share/xbmc/sounds/Bursting\ Bubbles/nav.wav
但是当没有pulseaudio守护进程运行时它不会。该命令没有给出错误,但我听不到声音。
hw:2,7 是 Nvidia hdmi 设备。
这是为什么呢?我想不通。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
阅读此链接。
它指出 alsa (aplay) 默认配置为将其输出发送到pulseaudio(这是您的声音服务器)。
当您的声音服务器未运行时,您将无法听到您所观察到的声音。
另请参阅“PulseAudio 删除”部分将其与 alsa 分离。
我希望这有帮助。
Read this link.
It states that alsa (aplay) is configured to send its output to pulseaudio (which is your sound server) by default.
When your sound server is not running you will not be able to hear a sound as you have observed.
See also "PulseAudio Removal"section to detach it from alsa.
I hope this helps.
使用
-Dpulse
应该可以达到这样的效果:这样 aplay 应该使用pulseaudio 设备,您应该能够通过
aplay -L
找到该设备Using
-D pulse
should do the trick like:That way aplay should use the pulseaudio device which you should be able to find with
aplay -L
我遇到了完全相同的问题;我使用的是 Ubuntu 11.04 Natty。我禁用了
pulseaudio
启动(例如 10.10 - 如何我用 alsa 替换pulseaudio? - 询问 Ubuntu 或 PulseAudio - ArchWiki):在这种情况下,我会得到:
...但是,即使我明确指定了设备
hw0:0
,它也应该在设备上播放示例直接通过 ALSA,绕过任何服务器:...我什至会看到设备设置 - 和缓冲区位置正在更改 - 但仍然没有声音?甚至
alsamixer
显示所有控件都设置为最大!好吧,只是偶然,我首先启用了pulseaudio:
...大约一分钟的启动完成后,然后启动系统/首选项/声音,或者在这里:
...我意识到,在那里,在“输出音量”栏的右侧,有一个“静音”复选框 - 并且已选中!所以我取消选中它,声音测试开始工作;关闭
gnome-volume-control
,然后再次关闭pulseaudio
:现在,我无法再启动
gnome-volume-control
(无论如何) 10.10 - 如何在没有pulseaudio的情况下调整音量? - 询问 Ubuntu - 显然早期版本允许通过“设备”下拉菜单选择后端:old.png,但较新的没有:new.png 等等; code>pulseaudio,它们总是会失败并显示“等待声音系统响应”)。但是,现在当我运行
aplay
命令时 - 它会播放(正如它应该的那样)!此静音显然与
gconf-editor
中/desktop/gnome/sound/
路径下的按键有关(请参阅 gnome - 如何从命令行禁用警报音量? - 询问 Ubuntu),但我不知道哪一个是真的;我只是注意到,目前,enable_esd
、event_sounds
和input_feedback_sounds
都为我进行了检查 - 这显然使得aplay<即使没有
pulseaudio
,/code> 命令也能正常工作。希望这对某人有帮助,
干杯!
I had the exact same problem; I'm on Ubuntu 11.04 Natty. I had
pulseaudio
startup disabled (e.g. 10.10 - How can I replace pulseaudio with alsa? - Ask Ubuntu or PulseAudio - ArchWiki):In this context, I'd get:
... but, even if I specified explicitly device
hw0:0
, which should play samples on the device directly through ALSA, bypassing any server:... and I'd see even the device settings - AND buffer positions being changed - and still, no sound? And even
alsamixer
showed all controls set to the max!Well, just by accident, I first enabled
pulseaudio
:... and after like a minute of startup completed, then started System / Preferences / Sound, or here:
... and I realized that there, right by the "Output volume" bar, there is a "Mute" checkbox - and it was checked! So I unchecked it, sound test started working; closed
gnome-volume-control
and then shut downpulseaudio
again:Now, I cannot start
gnome-volume-control
anymore (regardless of the tips in 10.10 - How do I adjust the volume without pulseaudio? - Ask Ubuntu - apparently earlier versions allowed choice of a backend, via "Device" dropdown: old.png, but newer don't: new.png; and so withoutpulseaudio
, they will always fail with "Waiting for sound system to respond").However, NOW when I run the
aplay
command - it PLAYS (as it is supposed to)!This mute is apparently related to a key under
/desktop/gnome/sound/
path ingconf-editor
(see gnome - How to disable Alert volume from the command line? - Ask Ubuntu), but I can't tell which one really; I just note that at the moment,enable_esd
,event_sounds
andinput_feedback_sounds
are all checked for me - and this apparently makes theaplay
command work properly, even withoutpulseaudio
.Hope this helps someone,
Cheers!