# sndio instead of pulse-audio



## Alain De Vos (May 8, 2021)

Is it possible to have a full desktop experience using sndio ?
The number of ports with explicit flags is limited,

```
audio/aqualung
audio/libao
audio/mpg123
audio/portaudio
audio/sox
devel/sdl12
devel/sdl20
multimedia/audacious-plugins
multimedia/ffmpeg
multimedia/mplayer
multimedia/vlc
www_qt5/webengine
```

Which browser ,music player, video player works best with sndio ?

For firefox the setting is it's "about:config"         "media.cubeb.backend sndio".
Music player strawberry is not bad


----------



## laurentis (May 8, 2021)

You missed a few..

```
allegro - SNDIO: off
aqualung - SNDIO: off
audacious-plugins - SNDIO: off
audacious-plugins-gtk2 - SNDIO: off
cava - SNDIO: on
chromium - SNDIO: on
citra - SNDIO: on
citra-qt5 - SNDIO: on
cmus - SNDIO: on
e16 - SNDIO: off
ffmpeg - SNDIO: off
firefox - SNDIO: on
firefox-esr - SNDIO: on
fluidsynth - SNDIO: off
gogglesmm - SNDIO: off
gstreamer1-plugins-all - SNDIO: on
jackit - SNDIO: off
kodi - SNDIO: off
libao - SNDIO: off
libxine - SNDIO: off
lmms - SNDIO: off
madplay - SNDIO: off
mous - SNDIO: off
mpg123 - SNDIO: off
mplayer - SNDIO: off
musicpd - SNDIO: off
obs-studio - SNDIO: on
openal-soft - SNDIO: off
portaudio - SNDIO: off
qt5-webengine - SNDIO: off
rsynth - SNDIO: off
scummvm - SNDIO: off
sdl - SNDIO: off
sdl2 - SNDIO: off
shairport-sync - SNDIO: on
siren - SNDIO: off
sox - SNDIO: off
thunderbird - SNDIO: on
vlc - SNDIO: off
waybar - SNDIO: on
xmp - SNDIO: off
yuzu - SNDIO: on
yuzu-qt5 - SNDIO: on
zynaddsubfx - SNDIO: off
```

All I can say is that it works seamlessly with chromium.


----------



## shkhln (May 8, 2021)

Chromium is hooked to sndio at the moment (OpenBSD patches, I suppose?). Firefox works directly with OSS since the last year.


----------



## Alain De Vos (May 8, 2021)

laurentis said:


> laurentis said:
> 
> 
> > You missed a few..
> ...


How do you get that list ?
I used "find /usr/ports -name Makefile | xargs grep -l -i SNDIO "


----------



## laurentis (May 8, 2021)

Alain De Vos said:


> How do you get that list ?
> I used "find /usr/ports -name Makefile | xargs grep -l -i SNDIO "


pkg roptions | grep SNDIO | sort -u


----------



## garry (May 10, 2021)

I use this script to check the options that are set for the ports that I build (i.e. it is for checking the options that will be used when building the port and does not require that the package is currently installed)

```
#!/bin/sh

# Print list of port origins of ports that have specified option
# set in the port options database. 
# If "on" or "off" is specified then only ports with that setting
# are listed.
#
#       port-option [ -l | <option> | <option> on | <option> off
#
#       port-option -l        lists all option names.
#
# e.g.
#       port-option OPENSSL
#       port-option OPENSSL on
#       port-option OPENSSL off
# Option names can be written in lower case for convenience:
#       port-option openssl on

OPTIONS_DIR=/srv/sources/FreeBSD/options

if [ $1 = "-l" ]; then
        grep -h COMPLETE_OPTIONS_LIST $OPTIONS_DIR/*/options | sed 's/.*=//' | sed
's/ /\n/g' | sort -u
        exit 0
fi

OPTION=`echo $1 | tr '[a-z]' '[A-Z]'`

if [ $# = 2 ]; then
        if [ $2 = "on" ]; then
                CONDITION='_SET+='
        elif [ $2 = "off" ]; then
                CONDITION='_UNSET+='
        else
                echo "$2?  Should be 'on' or 'off'"
        fi
        cd $OPTIONS_DIR
        grep SET */options | grep -w $OPTION | grep $CONDITION | sed 's/\/.*//' | t
r '_' '/' | sort -u
else
        cd $OPTIONS_DIR
        grep SET */options | grep -w $OPTION | sed 's/\/.*//' | tr '_' '/' | sort -
u
fi
```
Checking the options actually used in installed packages is simpler

```
#!/bin/sh

# Print list of port origins of installed packages that have specified option.
# If "on" or "off" is specified then only packages with that setting
# are listed.
#
#       pkg-option [ -l | <option> | <option> on | <option> off
#
#       pkg-option -l        lists all option names.
#
# e.g.
#       pkg-option OPENSSL
#       pkg-option OPENSSL on
#       pkg-option OPENSSL off
#
# Option names can be written in lower case for convenience:
#       pkg-option openssl on

if [ $1 = "-l" ]; then
        pkg-static query %Ok | sort -u
        exit 0
fi

OPTION=`echo $1 | tr '[a-z]' '[A-Z]'`

if [ $# = 2 ]; then
        pkg-static query "%o    %Ok     %Ov" | grep -w "$OPTION $2" | awk '{print $
1}'
else
        pkg-static query "%o    %Ok     %Ov" | grep -w "$OPTION" | awk '{print $1}'
fi
```

So I notice that I have enabled SNDIO in 20 ports and PULSEAUDIO in none.  I get good audio on a digital usb DAC.


```
% port-option sndio on
audio/fluidsynth
audio/jack
audio/libao
audio/mpg123
audio/musicpd
audio/openal-soft
audio/portaudio
audio/sox
devel/sdl12
devel/sdl20
mail/thunderbird
multimedia/audacious-plugins
multimedia/ffmpeg
multimedia/gstreamer1-plugins-all
multimedia/libxine
multimedia/mplayer
www/chromium
www/firefox
www/firefox-esr
www/qt5-webengine
```


----------



## zirias@ (May 10, 2021)

Alain De Vos said:


> Is it possible to have a full desktop experience using sndio ?


Assuming that "full desktop experience" means having a desktop with applications that can use the sound hardware, even simultaneously, the answer is: It's even possible without _any_ extra daemon! FreeBSD's implementation of OSS has everything you need.

Many applications support OSS, nothing to do here. Others support for example ALSA, and on FreeBSD, you can have ALSA just forward everything to OSS (in a library, no daemon needed). Yet another option is SDL, which has an OSS backend, again, no daemon needed. Some games support OpenAL → same story.

In some rare cases, none of these options are available, or maybe some are buggy. I don't remember exactly why, but I _do_ have sndio on my desktop machine, and some ports use it. If there's one thing I won't ever touch again, it's pulseaudio. There's only _one_ thing I came across that would absolutely require pulseaudio: remote audio with xrdp. Well then, my remote desktop on a FreeBSD machine will remain silent. Better than getting infected with that plague


----------

