Page 1 of 1

resampling in alsa, libsamplerate

PostPosted: 17 Jul 2016, 15:33
by nbnb
hi, i'm using 0.3 beta on a raspberry pi 3.

i need fixed sample rate output. this works when using mpd. to get it also to work with shairport, i made a new alsa plugin with sample rate conversion in .asoundrc:
Code: Select all
defaults.pcm.rate_converter "samplerate"

pcm_slave.hifiat88 {
        pcm "hw:1,0"
        rate 88200
        # rate 44100
}

pcm.hifi88 {
        type plug
        slave hifiat88
}

i then try this with
Code: Select all
aplay -v -D plug:hifi88 test.wav

and get the error
Code: Select all
aplay: set_params:1297: Unable to install hw params:
.
it works at 44.1 kHz. in another slightly different version of the .asoundrc i had also
ALSA lib dlmisc.c:254:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/alsa-lib/libasound_module_rate_.so
.

this is weird since the shared library file name is incorrect -- it should end with 'samplerate' or 'libsamplerate'. i checked that libsamplerate is installed; i also installed alsa-plugins via pacman.

is it possible that the version of alsa that ships with runeaudio is compiled in such a way that sample rate conversion is not supported?

Re: resampling in alsa, libsamplerate

PostPosted: 27 Nov 2016, 22:02
by nbnb
I made another attempt. It turns out the only change required is to specify the pcm as "plughw:1,0" instead of "hw:1,0", for reasons I don't really understand. I placed this in /etc/asound.conf. Using this extra alsa device, I can now use shairport-sync to upsample all my incoming Airplay streams to 88.2 kHz, which is what my external DAC requires.