// Add more local mounts to container
"mounts": [
"source=/opt/local/renv/cache,target=/renv/cache,type=bind,consistency=cached",
"source=/etc/alsa,target=/etc/alsa,type=bind,consistency=cached",
"source=/usr/share/alsa,target=/usr/share/alsa,type=bind,consistency=cached",
"source=/run/user/1000/pulse/native,target=/run/user/1000/pulse/native,type=bind,consistency=cached"
],
"containerEnv": {
"PULSE_SERVER": "unix:/run/user/1000/pulse/native"
}
paplay some_file.wav -d SoundBoard
system2("paplay", args = c("some_file.wav", "-d", "SoundBoard"), wait = FALSE)
Key is to get pulse audio working in container and mounted to host processes. Post at https://joonas.fi/2020/12/audio-in-docker-containers-linux-audio-subsystems-spotifyd/ gives a nice overview. Here's what i got working:
More links:
TODO
Implementation
libpulse0 libasound2 libasound2-plugins pulseaudio-utilsdevcontainer.jsonpaplay(which the{beepr}package wraps:To route the sound to a custom pulse audio sink:
where
SoundBoardis an example of the name