Open rpodcast opened 2 years ago
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:
https://linux.die.net/man/1/paplay
https://github.com/rasmusab/beepr/blob/master/R/beepr.R
https://code.visualstudio.com/remote/advancedcontainers/environment-variables
Try setting options for error in R to play sound
libpulse0 libasound2 libasound2-plugins pulseaudio-utils
devcontainer.json
// 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
{beepr}
paplay some_file.wav
To route the sound to a custom pulse audio sink:
paplay some_file.wav -d SoundBoard
where SoundBoard is an example of the name
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:
https://linux.die.net/man/1/paplay
https://github.com/rasmusab/beepr/blob/master/R/beepr.R
https://code.visualstudio.com/remote/advancedcontainers/environment-variables
TODO
Try setting options for error in R to play sound
Implementation
libpulse0 libasound2 libasound2-plugins pulseaudio-utils
devcontainer.json
paplay
(which the{beepr}
package wraps:To route the sound to a custom pulse audio sink:
where
SoundBoard
is an example of the name