How can i can create a virtual pulseaudio soundcard on Linux with no audio hardware?
I have a Docker that's running Alpine Linux. There is no hardware audio device at all.
I've managed to get pulseaudio running seemingly fine under the user.
I've been experimenting with trying to get PA to function as a virtual soundcard, with the intent of streaming the audio from the docker using ffmpeg. But so far without luck. And i've yet to come across examples that did not involve a machine that lacked audio hardware.
My main concern is getting VICE (x64 , The Commodore 64 emulator) to correctly utilize 'pulse' instead of 'dummy'. I've compiled VICE with '--with-pulse' , and 'pulse' does indeed show up in the settings menu.
Though, when i switch to 'pulse' instead of 'dummy' , x64 complains it can't initialize it and then disables it's own sound output.
pactl and pacmd seems to have no problem controlling the pulseaudio server though.
I've tried the following (and also module-pipe)
$ pacmd load-module module-null-sink sink_name=VirtSoundCard sink_properties=device.description=Virtual-Sound-Card
$ pacmd set-default-sink VirtSoundCard
Though without any luck so far. So hoping to hear from anyone who might know how it can be done, while i spend the rest of the night trying.
The 'default.pa' i'm using atm : https://bitbucket.org/duckhuntpr0/pyvice/src/pyvice_base/src/fs/home/pyvice/default.pa
Pulseaudio can create various sinks (what you call "virtual soundcards", but sinks are for output, sources are for input, and they also get associated to real sound hardware).
Have a look at the module list which includes the sinks, and syntax examples. You have the choice between using RTP/SDP, ROAP.
You can also access a pulseaudio server on the host via the native procotol, in that case you don't need to run a pulseaudio server in the docker client.
So far there was no need to use ffmpeg
. If you really want to use ffmpeg
, you can also create a null sink, and connect its monitor source up to ffmpeg
. That would come closest to your idea of a "virtual soundcard", but it's also the least efficient alternative.
Finally, I don't really understand why you have to run VICE (an emulator) inside a docker image - as it's already an emulator, you can just run it on the host; there's no danger of the emulated C64 program doing something bad.