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:

Bash | view plain | copy to clipboard by clicking on icon (via flash)  
#! /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:

Bash | view plain | copy to clipboard by clicking on icon (via flash)  
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.

3 Responses to Pulseaudio with LD_PRELOADing libsoxr-lsr

  1. dolce moda says:

    Hello There. I discovered your blog the use of msn. This is an extremely smartly written article.

    I will be sure to bookmark it and come back to read
    more of your useful information. Thanks for the post. I will certainly comeback.

  2. moda shoes says:

    Hi there to all, because I am really keen of reading this blog’s post to be updated daily.
    It includes fastidious material.

  3. 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?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*
captcha

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>