Docker with Volumio 3.x

Sorry to butt in but i’m really wondering why we can’t have a much simpler and more reliable dockerized solution running buster/volumio3 instead of having to burn on an ssd a dedicated (and perhaps limited) distro. Especially now that there are so many different setups wouldn’t that be really helpful?

Good question do you have a proof of concept that we could play with on Docker?

Yes this is the image i’m basing myself on

https://hub.docker.com/r/jbonjean/volumio/

I was able to reproduce sound in volumio by using pulseaudio but you have to edit the host daemon.conf to avoid resampling (you want this for USB DACs). With pulseaudio i was only able to play flac file properly (mp3 and wav are ok as well i guess), DSD/DSF are not played natively but (apparently) over PCM (at different freq)

I’m struggling with just using ALSA and the most strange thing is that i can hear the initial startup sound but then no matter what no sound is played by volumio.
aplay -D ...... can output sound but rate is always 44.1Khz or 48Khz (can only test wav file).
I’ve tried youtube-ytcr plugin but it is definitely broken.

Also logging does not work in the way we are normally used to.
You can docker-compose up (without -d) to read what’s happening.
journalctl and the /var/log folders are empty, also /dev page is not function properly.

You can have a look here as well (my tentatives)

I guess it might be worth using jessie as base image for Volumio2
Also can i assume that

is the buster/Volumio3 branch? i’m not sure where buster sources are

if i have to set milestones those would be:

  1. Find the right os, node, npm ecc
  2. Fix ALSA not reproducing sound properly with USB DACs (we don’t want pulseaudio especially due to dsd issues)
  3. Fix plugins not working
  4. Fix logging the way we are used to
  5. Other

Docker is really good when you have a self-contained service, like a web app or a web server.
It sucks if you need direct access to hardware (like a sound card for example). This is why we never did it and probably never will.

With docker is very hard to reliably output bit-perfect audio to a sound card, which is the main goal of Volumio. Here’s the reason why

2 Likes

Thank you for the feedback.
Fact is, i felt like i was so close without have that much of knowledge on alsa and pulseaudio.
Audio is there with standard 20.04 and i was wondering if perhaps you are tweaking the kernel/distro to make it work with ALSA directly.
I’ve also read about how docker can even mount an img file directly

so that might help as well.

No matter how much tweaking you do, there is still a layer between the container and the host. Docker is great for a lot of things but, as pointed out, audio is not one of them.

in case you really want to run Volumio in a “container”, there is a higher chance of succeeding with an x86 version in a virtual machine.
There is (still) no official support for it, but search this forum.
I have used Virtual Box during x86 image development but never focussed on using it as a “production” version including audio.

Not sure what you mean but i’m starting from ubuntu 20.04 x86 + nodejs 8
About the layer, while it is true what you are saying, a passthrough can almost always be achieved (worst case with priviliged=true)

https://www.virtualbox.org/wiki/Downloads

I second what others say here – I tinkered around a while with a type 1 hypervisor to get direct pass through for a USB DAC, but in the end, a 30$ RPi seemed the easier way. :slight_smile:

But then again, that being said, please don’t let that discourage your efforts - Docker is really great for quick testing and other stuff!

If you want a raw buster base – have a look at docker/ashthespy/volumio – it will need a lot of work, and it’s not an out of the box experience as what you have linked to, but it’s buster :slight_smile: I am running scarce of time these days, but I can try and update it, no promises though.

Are you referring to this?

https://hub.docker.com/r/ashthespy/volumio/tags?page=1&ordering=last_updated

it’s arm, isnt it? wouldnt it be better x86?

Ok so i’ve tested with virtualbolx “Volumio 3 x86 release 101” and it partially works but not as good as one would like (i haven’t tested plugins), specifically:

  1. If i set USB 2 Controller emulation you can hear a strong and continuous noise on top of the song.
  2. If i set USB 3 Controller emulation you can hear from time to time some noise/distorsion which is basically not acceptable.
  3. File format is passed correctly to the DAC, up to DSD512 as well and the higher the bandwidth the more frequent/evident is the noise
  4. I haven’t tested plugins yet

I will also try with vmware, i heard it provides higher perfomances.
Can anyone guess or reports previous findings about this? Can it be the USB perfomance affected by the emulation/vm layer? I thought the data was passed digitally to the DAC so it really must be a lag that it’s translated to a wrong “tone”.

Moreover i would like the following question to be answered, if possible.
Volumio is a distro with its kernel, boot and stuff. Is there anything that you are doing to the kernel or to ALSA during compilation that might be relevant? (e.g. patching for real-time kernel ecc).
I start to believe that even if USB is passing data digitally using an “RTOS” might ensure task deadlines (even in virtualization) but i might overthinking.

Regards,

“distorted” sounds familiar (pardon the pun), could you try Volumiobuster-3.077-2021-05-20-x86_amd64

This is your assumption and not correct, we are using unmodified kernels from either Raspberry foundation (PI), the vendor (Asus Tinkerboard) or kernel.org (x86).
With community portings, things are a bit more complicated.

Ok, i’ll give it a try.
Thank you for the clarification

That was it!
It works great even though for whatever reason i cant set a decent resolution.
I listened to a DSD512 and i’ve not noticed any issue but i will take my time a little bit more.
The process was quite simple

VBoxManage convertfromraw --format VDI Volumiobuster-3.077-2021-05-20-x86_amd64.img Volumio.vdi

then via Virtual Media Manager i’ve added the vdi and then i configured the vm with:

  1. ALSA Output Driver
  2. USB 3.0 and added my DAC from startup already (plug and play wasn’t so reliable)
  3. Mounted the Volumio.vdi as disk

this is interesting, same issue we have with Intel Atoms since v3.101
You already contributed by beta testing on x86 instead of C1 :wink:

You may want to test the alpha 3.112, it solves the issue we had with screeching sound/distorted sound on version >3.077 and did not work with your earlier VM version

Alpha works great, i’ve noticed that the noise is also dependant on the way i provide the songs to volumio.
If the song is on the same file system the read performance is probably much higher and you never hear a noise, differently with a USB3 HDD over samba sometimes you can hear it but only for DSD128/256 which have much higher bandwidth.

great, this proves the fixes were OK.
I will inform the responsible developers