使用 snd-dummy 在服务器上配置虚拟声音设备

使用 snd-dummy 在服务器上配置虚拟声音设备

问题:

如何在没有声音硬件的 Ubuntu 14.04 服务器上配置虚拟声音设备?

我基本上只是希望各种应用程序(aplay作为具体目标)能够正常运行,就像系统有真正的声卡一样。解决方案如何混合 Alsa、Pulseaudio、OSS 或其他任何东西,这并不重要。

我目前所做的:

目前我刚刚添加了这一行/etc/modules

snd-dummy

重启后lsmod | grep snd输出如下:

snd_dummy              20483  0 
snd_pcm               102099  1 snd_dummy
snd_page_alloc         18710  1 snd_pcm
snd_seq_midi           13324  0 
snd_seq_midi_event     14899  1 snd_seq_midi
snd_rawmidi            30144  1 snd_seq_midi
snd_seq                61560  2 snd_seq_midi_event,snd_seq_midi
snd_seq_device         14497  3 snd_seq,snd_rawmidi,snd_seq_midi
snd_timer              29482  2 snd_pcm,snd_seq
snd                    69238  7 snd_dummy,snd_timer,snd_pcm,snd_seq,snd_rawmidi,snd_seq_device,snd_seq_midi
soundcore              12680  1 snd

但是,似乎我需要做更多,因为......

我看到了什么样的问题:

当我运行时aplay /usr/share/sounds/alsa/Noise.wav,我得到:

ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
aplay: main:722: audio open error: No such file or directory

那么,如何实现这一点呢?或者如何有效地解决声音问题?

答案1

好的,明白了。这只是一个权限问题!

因此,以 root 身份完成对我有用的步骤:

  • 添加snd-dummy行到/etc/modules
  • 编辑/etc/group并将所需用户添加到audio:x:29:行(我认为组 ID 可能不同)
  • 重新启动以使更改生效并验证它们是否仍然有效。

相关内容