6

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

4

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.

  • Thanks for the tips. I'll try them out today. As for why using a docker; Is so that i don't have to mess with my own system. And to make it easier for others to setup. The idea is to make a simple base solution for having an (python in my case) AI playing Commodore. Hence why it has telnet port to VICE's monitor,and vnc (for now) open. And ffmpeg would be useful for recording any "NEAT" evolution, to a remote machine is desire. All of it hopefully making it to run for lengthy sessions without messing too much with the host- or the users personal computer. :) – DhP Jul 14 '18 at 15:48
  • "and they also get associated to real sound hardware" , I guess there is where the problem lies then. Cheers again – DhP Jul 14 '18 at 15:58
  • I'm not sure if I understand the second comment, but in case my phrasing was unclear: There are sources and sinks that get associated to real sound hardware (the modules have ALSA in their name), and there are sources and sinks that don't. I don't see any problem with this (except to get the terminology right). – dirkt Jul 14 '18 at 18:11
  • Yes you understood it correct i think. The modules i've been trying are even listed under Device Drivers , when there is no real device. Somehow i'd missed that. So i'm thinking using i.e the loopback network device combined with your tips of protocols (e.g using netcat) might be the best solution – DhP Jul 14 '18 at 19:44
  • 1
    The ALSA loopback device (if you mean that one) really sucks, I've tried it. And you'll incur a lot of delay. The loopback network device lo won't help you to get out of your container; after all, you want to reach your host to make it play audio. I'm not sure why you don't try to use any of the other solutions I've listed? But it's your problem... – dirkt Jul 15 '18 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.