Pulseaudio with LD_PRELOADing libsoxr-lsr

Pulseaudio with default-sample-rate=192000 and resample-method=src-sinc-best-quality takes about 90% CPU on my i5, aplay via default (pulse plugin) complains about xruns, pulseaudio gets killed eventually (I do not know what kills it, CPU ulimit is unlimited, probably some laptop service watching CPU hogs).

Simply starting pulseaudio with LD_PRELOAD

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libsoxr-lsr.so.0 pulseaudio

drops pulseaudio CPU load down to 6-9% while resampling running (checked in the card’s hw_params).

That was simple 🙂

Integrating with client-spawn pulseaudio

Tested on Mint15:
1. Create executable script /usr/local/bin/pulseaudio.sh. Make sure to use correct path to your libsoxr-lsr library:
#! /bin/bash
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libsoxr-lsr.so.0
exec /usr/bin/pulseaudio $@

Do not forget to set it executable:
chmod a+x /usr/local/bin/pulseaudio.sh

2. Set path to the script as your pulseaudio daemon binary in /etc/pulse/client.conf
daemon-binary = /usr/local/bin/pulseaudio.sh

That’s it 🙂

This entry was posted in Linux Audio. Bookmark the permalink.

One Response to Pulseaudio with LD_PRELOADing libsoxr-lsr

  1. Name says:

    Thank you for this solution that drops the CPU significantly and give us really good resampling. The problem on my computer is that linux lose connection to Pulseaudio every now and then. You have an idea why this might happen? Secondly, what SoX resampling settings are being used?