gpt4 book ai didi

linux - 模拟声卡 ALSA snd-dummy (Docker - Kernel Rebuild - ALSA snd-dummy)

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:31:23 40 4
gpt4 key购买 nike

我正在使用没有可用的 ALSA snd-dummy 模块的 docker 镜像。我需要模拟声卡。我不需要(或不想)听音频。

根据我所做的许多搜索,我相当确定我想使用 ALSA 的 snd-dummy 模块来模拟声卡,它本质上是/dev/null。

查看 ALSA Matrix:Module-dummy 的指南,它指出如果“modinfo soundcore”返回您拥有此模块,那么您不需要重新编译内核。

在我的例子中,我没有可用的“soundcore”或“sound”。我想这意味着我必须重新编译内核。重新编译 docker 镜像的内核对我来说是一个新概念。 Docker 对我来说是一个新概念。

总之,我需要将 ALSA 的 snd-dummy 模块安装到 Linux docker 镜像上,该镜像没有将 soundcore/sound 编译到内核中。

docker 图像: https://github.com/fcwu/docker-ubuntu-vnc-desktop

ALSA 矩阵 snd-dummy: https://www.alsa-project.org/main/index.php/Matrix:Module-dummy

这对我来说是一个潜在的解决方案吗?: https://github.com/torvalds/linux/blob/master/sound/drivers/dummy.c

编辑:

将 ~/.asoundrc 替换为以下内容并运行“alsactl restore”时,我得到以下输出。此外,我的主机音量也受到影响。

# .asoundrc

pcm.dummy {
type hw
card 0
}

ctl.dummy {
type hw
card 0
}

$ alsactl restore

alsactl: load_state:1683: Cannot open /var/lib/alsa/asound.state for reading: No such file or directory Found hardware: "HDA-Intel" "Realtek ALC269VB" "HDA:10ec0269,10280446,00100100 HDA:80862805,80860101,00100000" "0x1028" "0x0446" Hardware is

initialized using a generic method Found hardware: "Dummy" "Dummy

Mixer" "" "" "" Hardware is initialized using a generic method

最佳答案

我认为解决方案是将声音设备安装到 docker 中,这里的问题是您必须使用 privileged:

docker run  -v /dev/snd:/dev/snd --privileged myImage ...

更新您也可以插入内核模块 snd-aloop 并指定 2 作为主机上声音循环设备的索引:

sudo modprobe snd-aloop index=2
docker run -it --rm -p 6080:80 --device /dev/snd -e ALSADEV=hw:2,0 dorowu/ubuntu-desktop-lxde-vnc

关于linux - 模拟声卡 ALSA snd-dummy (Docker - Kernel Rebuild - ALSA snd-dummy),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57882375/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com