ThePorgs / Roadmap

Public roadmap of the Exegol project
1 stars 0 forks source link

Sound sharing support #4

Open ShutdownRepo opened 1 year ago

TahiTi commented 1 year ago

Two different choices :

  1. ALSA : Native audio driver, can only support one audio source simultaneously.
  2. PulseAudio : PulseAudio works as a server/client solution. There are multiple possibilities to make it work:

I tried both approaches without success. Will look into it a bit more this week

Dramelac commented 1 year ago

I had already poc this subject a long time ago, it is possible to share the socket pulse of the host and also the simplest it allows to delegate the configuration to the host and bonus it will be also supported on windows with WSLg.

ShutdownRepo commented 1 year ago

I tried to get some inspiration from the following sources to make it work through a mac, to no avail...

It basically comes back to running this:

# from the host
brew install pulseaudio
sed -i '' 's/#load-module module-esound-protocol-tcp/load-module module-esound-protocol-tcp/' /opt/homebrew/Cellar/pulseaudio/14.2_1/etc/pulse/default.pa
sed -i '' 's/#load-module module-native-protocol-tcp/load-module module-native-protocol-tcp/' /opt/homebrew/Cellar/pulseaudio/14.2_1/etc/pulse/default.pa
pulseaudio --load=module-native-protocol-tcp --exit-idle-time=-1 --daemon --verbose
exegol start soundtest nightly --env "PULSE_SERVER=host.docker.internal" --volume "~/.config/pulse:/root/.config/pulse"

# from the container
apt-get update && apt-get install -y alsa-utils libasound2 libasound2-plugins pulseaudio pulseaudio-utils --no-install-recommends
usermod -aG audio,pulse,pulse-access root
wget https://raw.githubusercontent.com/jessfraz/dockerfiles/master/pulseaudio/client.conf -O /etc/pulse/client.conf
wget https://raw.githubusercontent.com/jessfraz/dockerfiles/master/pulseaudio/daemon.conf -O /etc/pulse/daemon.conf
wget https://raw.githubusercontent.com/jessfraz/dockerfiles/master/pulseaudio/default.pa -O /etc/pulse/default.pa
## add the host.docker.internal address subnet to /etc/pulse/default.pa auth-ip-acl
wget https://www.cjoint.com/doc/21_07/KGzngdVKbrk_Rick-Astley---Never-Gonna-Give-You-Up.wav -O rick.wav
paplay /workspace/rick.wav --verbose

But sadly I got no sound output on my mac. Here are a few things I checked

I've probably missed something more or less obvious 🤷

If we manage to make what I've described above work, I think it could apply to Linux and Windows as well

More generally we would need to have:

Sound support is important as it would allow to

Dramelac commented 1 year ago

More doc and tips: https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio