为什么当pulseaudio运行时aplay可以工作,而在其他情况下则不能?

发布于 2024-12-01 09:59:14 字数 229 浏览 2 评论 0 原文

我安装了 ubuntu,默认安装了pulseaudio。当pulseaudio运行时,它可以工作: aplay -D hw:2,7 /usr/share/xbmc/sounds/Bursting\ Bubbles/nav.wav

但是当没有pulseaudio守护进程运行时它不会。该命令没有给出错误,但我听不到声音。

hw:2,7 是 Nvidia hdmi 设备。

这是为什么呢?我想不通。

I have a ubuntu install with pulseaudio default installed. When pulseaudio is running this works:
aplay -D hw:2,7 /usr/share/xbmc/sounds/Bursting\ Bubbles/nav.wav

But when no pulseaudio daemon is running it doesn't. The command doesn't give an error but I can't hear a sound.

hw:2,7 is a Nvidia hdmi device.

Why is this? I can't figure it out.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如果没有你 2024-12-08 09:59:14

阅读此链接

它指出 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.

薄暮涼年 2024-12-08 09:59:14

使用 -Dpulse 应该可以达到这样的效果:

aplay -D pulse /usr/share/xbmc/sounds/Bursting\ Bubbles/nav.wav

这样 aplay 应该使用pulseaudio 设备,您应该能够通过 aplay -L 找到该设备

Using -D pulse should do the trick like:

aplay -D pulse /usr/share/xbmc/sounds/Bursting\ Bubbles/nav.wav

That way aplay should use the pulseaudio device which you should be able to find with aplay -L

羁绊已千年 2024-12-08 09:59:14

我遇到了完全相同的问题;我使用的是 Ubuntu 11.04 Natty。我禁用了 pulseaudio 启动(例如 10.10 - 如何我用 alsa 替换pulseaudio? - 询问 UbuntuPulseAudio - ArchWiki):

$ cat /etc/pulse/client.conf | grep -ve '^#\|^

在这种情况下,我会得到:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC269 Analog [ALC269 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=Intel
    HDA Intel, ALC269 Analog
    Default Audio Device
front:CARD=Intel,DEV=0
    HDA Intel, ALC269 Analog
    Front speakers
...
hw:CARD=Intel,DEV=0
    HDA Intel, ALC269 Analog
    Direct hardware device without any conversions
plughw:CARD=Intel,DEV=0
    HDA Intel, ALC269 Analog
    Hardware device with all software conversions
...

...但是,即使我明确指定了设备 hw0:0,它也应该在设备上播放示例直接通过 ALSA,绕过任何服务器:

aplay -f cd -v -Dhw:0,0 --test-position loop_s16_stereo.wav
...
BUFPOS: avg5507/16508 min0/0 max22016/22016 (22016) (0:0/0)
BUFPOS: avg2754/19261 min0/0 max22016/22016 (22016) (0:0/0)

...我什至会看到设备设置 - 和缓冲区位置正在更改 - 但仍然没有声音?甚至 alsamixer 显示所有控件都设置为最大!

好吧,只是偶然,我首先启用了pulseaudio:

pulseaudio --start

...大约一分钟的启动完成后,然后启动系统/首选项/声音,或者在这里:

gnome-volume-control

...我意识到,在那里,在“输出音量”栏的右侧,有一个“静音”复选框 - 并且已选中!所以我取消选中它,声音测试开始工作;关闭gnome-volume-control,然后再次关闭pulseaudio

pulseaudio --kill

现在,我无法再启动gnome-volume-control(无论如何) 10.10 - 如何在没有pulseaudio的情况下调整音量? - 询问 Ubuntu - 显然早期版本允许通过“设备”下拉菜单选择后端:old.png,但较新的没有:new.png 等等; code>pulseaudio,它们总是会失败并显示“等待声音系统响应”)。

但是,现在当我运行 aplay 命令时 - 它会播放(正如它应该的那样)!

此静音显然与 gconf-editor/desktop/gnome/sound/ 路径下的按键有关(请参阅 gnome - 如何从命令行禁用警报音量? - 询问 Ubuntu),但我不知道哪一个是真的;我只是注意到,目前,enable_esdevent_soundsinput_feedback_sounds 都为我进行了检查 - 这显然使得 aplay<即使没有 pulseaudio,/code> 命令也能正常工作。

希望这对某人有帮助,
干杯!

; default-sink = ; default-source = ; default-server = autospawn = no ; daemon-binary = /usr/bin/pulseaudio ; extra-arguments = --log-target=syslog ; cookie-file = ; enable-shm = yes ; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB $ pgrep pulse $

在这种情况下,我会得到:


...但是,即使我明确指定了设备 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_esdevent_soundsinput_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):

$ cat /etc/pulse/client.conf | grep -ve '^#\|^

In this context, I'd get:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC269 Analog [ALC269 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=Intel
    HDA Intel, ALC269 Analog
    Default Audio Device
front:CARD=Intel,DEV=0
    HDA Intel, ALC269 Analog
    Front speakers
...
hw:CARD=Intel,DEV=0
    HDA Intel, ALC269 Analog
    Direct hardware device without any conversions
plughw:CARD=Intel,DEV=0
    HDA Intel, ALC269 Analog
    Hardware device with all software conversions
...

... but, even if I specified explicitly device hw0:0, which should play samples on the device directly through ALSA, bypassing any server:

aplay -f cd -v -Dhw:0,0 --test-position loop_s16_stereo.wav
...
BUFPOS: avg5507/16508 min0/0 max22016/22016 (22016) (0:0/0)
BUFPOS: avg2754/19261 min0/0 max22016/22016 (22016) (0:0/0)

... 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:

pulseaudio --start

... and after like a minute of startup completed, then started System / Preferences / Sound, or here:

gnome-volume-control

... 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 down pulseaudio again:

pulseaudio --kill

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 without pulseaudio, 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 in gconf-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 and input_feedback_sounds are all checked for me - and this apparently makes the aplay command work properly, even without pulseaudio.

Hope this helps someone,
Cheers!

; default-sink = ; default-source = ; default-server = autospawn = no ; daemon-binary = /usr/bin/pulseaudio ; extra-arguments = --log-target=syslog ; cookie-file = ; enable-shm = yes ; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB $ pgrep pulse $

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 down pulseaudio 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 without pulseaudio, 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 in gconf-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 and input_feedback_sounds are all checked for me - and this apparently makes the aplay command work properly, even without pulseaudio.

Hope this helps someone,
Cheers!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文