You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to get OpenBSD sndio working through ALSA on Linux
I used ARCH Linux
$ sudo pacman -S sndio
$ cat /etc/conf.d/sndiod
OPTS="-f rsnd/1"
Assumes your bdwrt5677 card is the second device. If it's the first device, use
OPTS="-f rsnd/0"
but you won't get full audio from 0-max volume, on say mplayer or mpv.
Try it as an exercise - change your index in the .conf file in /etc.modprobe-d/, and notice the lower volume range to be much louder when it's our second device, versus setting it as the first device, "...index=0".
Start sndiod as user or root
$ sndiod -dddd -f rsnd/1
$ sudo sndiod -dddd -a on -f rsnd/1
For some reason, I need the "-a on" flag when starting it as root.
If I try
$ sudo sndiod -dddd -f rsnd/1
sndiod won't open it's first device when called upon to play audio, sndiod first device, snd/0, is mapped to rsnd/1 - our bdwrt5677 card.
If I try
OPTS="-a on -f rsnd/1"
in /etc/conf.d/sndiod, and start it through systemctl, sndiod won't open snd/0 for some reason. It won't open snd/0 either, if I try "-a off", or no -a option. Starting it through systemctl seems to be broken, or I'm missing something.
In the ARCH install, I manually added /var/lib/sndiod - doesn't seem to create it, on installation.
I only get success starting it as the same user, or sudo sndiod with -a on.
A copy of .asoundrc, see below, was made to /etc/asound.conf whilst getting sndiod to start via systemctl.
pcm.sndio-play {
type plug
slave {
pcm "sndio-raw"
rate 48000
format s16_le
channels 2
}
}
pcm.sndio-raw {
type file
slave.pcm null
format raw
file "| aucat -f snd/0 -i -"
}
pcm.default sndio
Note: We need "channels 2" in the config, else we get scrambled output, like it's played at twice the speed. Try commenting it out, and hear the difference.
$ aplay -L
should show our new OpenBSD sndio PCM device
If you don't want sndio as the default just comment out "pcm.default sndio"
I've found a way to improve the latency. It's still not perfect, but may be acceptable for some playing say Touhou in wine. Set both sndiod and aucat to use a buffer size of 512 (-b 512). This should give you a latency close to 20ms.
How to get OpenBSD sndio working through ALSA on Linux
I used ARCH Linux
$ sudo pacman -S sndio
$ cat /etc/conf.d/sndiod
OPTS="-f rsnd/1"
Assumes your bdwrt5677 card is the second device. If it's the first device, use
OPTS="-f rsnd/0"
but you won't get full audio from 0-max volume, on say mplayer or mpv.
Try it as an exercise - change your index in the .conf file in /etc.modprobe-d/, and notice the lower volume range to be much louder when it's our second device, versus setting it as the first device, "...index=0".
Start sndiod as user or root
$ sndiod -dddd -f rsnd/1
$ sudo sndiod -dddd -a on -f rsnd/1
For some reason, I need the "-a on" flag when starting it as root.
If I try
$ sudo sndiod -dddd -f rsnd/1
sndiod won't open it's first device when called upon to play audio, sndiod first device, snd/0, is mapped to rsnd/1 - our bdwrt5677 card.
If I try
OPTS="-a on -f rsnd/1"
in /etc/conf.d/sndiod, and start it through systemctl, sndiod won't open snd/0 for some reason. It won't open snd/0 either, if I try "-a off", or no -a option. Starting it through systemctl seems to be broken, or I'm missing something.
In the ARCH install, I manually added /var/lib/sndiod - doesn't seem to create it, on installation.
I only get success starting it as the same user, or sudo sndiod with -a on.
A copy of .asoundrc, see below, was made to /etc/asound.conf whilst getting sndiod to start via systemctl.
Thanks to http://billauer.co.il/blog/2014/04/alsa-pipe-playback-capture/ for hints on creating my asound.conf file. I couldn't work out why I was getting scrambled noise, till I read it.
$ cat $HOME/.asoundrc
pcm.sndio {
type asym
playback.pcm "sndio-play"
}
pcm.sndio-play {
type plug
slave {
pcm "sndio-raw"
rate 48000
format s16_le
channels 2
}
}
pcm.sndio-raw {
type file
slave.pcm null
}
pcm.default sndio
Note: We need "channels 2" in the config, else we get scrambled output, like it's played at twice the speed. Try commenting it out, and hear the difference.
$ aplay -L
should show our new OpenBSD sndio PCM device
If you don't want sndio as the default just comment out "pcm.default sndio"
Test it works
$ aplay -D sndio -i /usr/share/sounds/alsa/Side_Right.wav
$ aplay -D default -i /usr/share/sounds/alsa/Side_Right.wav
$ aplay -i /usr/share/sounds/alsa/Side_Right.wav
and watch the messages scroll in the window we started sndiod.
mplayer doesn't sink audio / video in time, but it illustrates sndio via ALSA works.
$ mplayer -ao alsa:device=sndio _VIDEO_AUDIO_FILE
if sndio is our default device
$ mplayer -ao alsa _VIDEO_AUDIO_FILE
Enjoy!
The text was updated successfully, but these errors were encountered: