sndio is a small audio framework, part of the OpenBSD project, it has been ported to FreeBSD and Linux. Its available from most distributions’ packaging systems. Sndio was created circa 2010, and is actively maintained (as of end 2018). You might consider some alternatives as PulseAudio, ALSA, JACK and OSS.
My use case for sndio is to play media (videos), and watch the action on a local machine, while the audio is being outputted on another. See the diagram below:
I’ve done this with PulseAudio over bluetooth, but the video and audio were never in sync. I should try PA over network again. Anyway, here is how to do it.
I’m using Ubuntu on my local machine, and FreeBSD on the remote side with the speakers. However, this method should be OS agnostic, and should work for any sndio supported system.
The media is played using VLC, more on this at the end.
Install the needed software:
pkg install sndio
As root, run the aduio server, and configure it to listen on the network:
sndiod -dd -L 0.0.0.0
Depending on your setup you’ll want to have that run on boot.
Install the needed software:
apt install vlc sndio
Tell VLC which server to use, then start:
AUDIODEVICE="snd@192.168.1.104/0" vlc
Once VLC has started, you need to tell it which audio backend to use.
Tools -> Preferences -> Audio -> Output: Output Module: OpenBSD sndio audio output
Restart VLC, play a video and see how much in sync the audio and video are. :)
I have PulseAudio running on both machines, I can have firefox running on the server playing audio from YouTube whilst sndio is doing its thing.
While this works perfectly with VLC in Ubuntu. Firefox is not built with the sndio output in the Ubuntu repositories, so kinda rubbish if I want to watch plex locally in Firefox then have the audio output on the server.
The good news is that Firefox, and many other programs have support for sndio, so not really a sndio problem, just a personal issue. Update If you are stuck with PA, there is a good plugin that adds sndio as output. pulseaudio-module-sndio.
There is a really good blog post by Ivy Foster on using sndio on Linux, which if you liked this post, I’d recommend you go check it out.
18 Nov 2018
Website Last Updated on 4 Oct 2024 (CC BY-SA 4.0)
This site uses JQuery and nanogallery2 hosted by jsdelivr.net
for the Flickr photo feed and GoatCounter for user insights.