You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On linux, we have the JACK professional audio server that provide both a constant sound latency (PulseAudio doesn't provide that) and a parallel execution of all its sound processes. That howto is intended for peoples that have JACK running all the time into their system.
As I don't use PA, I will focus on the first 2 solutions. But it should be easy to setup 3), because for how I understand it, One will have to setup the container to use PulseAudio as already explained into the wiki, and to setup PulseAudio in the host to use the JACK plugin.
The ALSA sound of a docker container need an ALSA sound device, which imply the JACK plugin will not work. We have to use the Loop device. It's a virtual audio loop device that will appear as a supplementary sound card into the system. We also want the same sound card order between reboot.
System configuration
A typical setup is a computer with 2 built-in sound cards, a PCM device and a HDMI device, and an external sound card of better quality. The Loop device will be configured as first sound card and default ALSA device. The order of the other devices doesn't matter as long it remain consistent between reboot.
root #lspci
04:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Renoir Radeon High Definition Audio Controller
04:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h/19h HD Audio Controller
root #lspci -s 04:00.1 -n
04:00.1 0403: 1002:1637
root #lspci -s 04:00.6 -n
04:00.6 0403: 1022:15e3
We instruct the kernel to load the virtual sound cards:
# /etc/modules-load.d/alsa.conf
snd-aloop
User ALSA configuration
This configure the ALSA JACK plugin as default ALSA sound device. Yes we need to configure it for the other ALSA only software. Using Cadence, we can skip that step because it will manage that file for You when the ALSA -> JACK (plugin) is set in its System tab.
# ~/.asoundrc
pcm.!default {
type plug
slave { pcm "jack" }
}
pcm.jack {
type jack
playback_ports {
0 system:playback_1
1 system:playback_2
}
capture_ports {
0 system:capture_1
1 system:capture_2
}
}
ctl.mixer0 {
type hw
card 0
}
Running a Docker container
After a reboot, we will get the following sound devices:
the aloop virtual card
the hda-intel pcm device
the hda-intel hdmi device
the usb card
I use Cadence to setup and control JACK. On its System tab, we must set Bridge Type: ALSA -> Loop -> JACK before running the docker container, as example: x11docker --home --group-add=audio --alsa=/dev/snd --desktop "x11docker-fvwm-tuxguitar"
The good news with that setup is that, when you are done with the docker, you can use Cadence to switch back on the fly to the more modern bridge solution: Bridge Type: ALSA -> JACK (Plugin).
The text was updated successfully, but these errors were encountered:
On linux, we have the JACK professional audio server that provide both a constant sound latency (PulseAudio doesn't provide that) and a parallel execution of all its sound processes. That howto is intended for peoples that have JACK running all the time into their system.
On https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio is explained how to get sound with ALSA and PulseAudio. It is also possible to get that sound into JACk audio. For that, the docker container will use its ALSA output, and a bridge between ALSA and JACK must be setup and running.
It is several ways to get such a bridge:
As I don't use PA, I will focus on the first 2 solutions. But it should be easy to setup 3), because for how I understand it, One will have to setup the container to use PulseAudio as already explained into the wiki, and to setup PulseAudio in the host to use the JACK plugin.
The ALSA sound of a docker container need an ALSA sound device, which imply the JACK plugin will not work. We have to use the Loop device. It's a virtual audio loop device that will appear as a supplementary sound card into the system. We also want the same sound card order between reboot.
System configuration
A typical setup is a computer with 2 built-in sound cards, a PCM device and a HDMI device, and an external sound card of better quality. The Loop device will be configured as first sound card and default ALSA device. The order of the other devices doesn't matter as long it remain consistent between reboot.
From https://wiki.gentoo.org/wiki/ALSA :
We fix the sound card order:
To get the model strings, use lspci:
We instruct the kernel to load the virtual sound cards:
User ALSA configuration
This configure the ALSA JACK plugin as default ALSA sound device. Yes we need to configure it for the other ALSA only software. Using Cadence, we can skip that step because it will manage that file for You when the ALSA -> JACK (plugin) is set in its System tab.
Running a Docker container
After a reboot, we will get the following sound devices:
I use Cadence to setup and control JACK. On its System tab, we must set Bridge Type: ALSA -> Loop -> JACK before running the docker container, as example:
x11docker --home --group-add=audio --alsa=/dev/snd --desktop "x11docker-fvwm-tuxguitar"
The good news with that setup is that, when you are done with the docker, you can use Cadence to switch back on the fly to the more modern bridge solution: Bridge Type: ALSA -> JACK (Plugin).
The text was updated successfully, but these errors were encountered: