Writing, publishing, geekdom, and errata.

Using SBaGen (or anything that uses /dev/dsp) with a 64-bit linux system and PulseAudio by Tweaking Padsp

No comments
I like SBaGen for a binaural beat white noise generator. It's pretty cool, and cross-platform, and lets you put other soundfiles in the background. (If you're commandline-phobic and run Windows, I used to use Raindrop for the same reason.) But SBaGen is FAR more configurable, with all sorts of scriptable options.

Do I buy the brainwave stuff? Hell, I don't know. But I do know that it's a fantastic tool to help with concentration and block out outside noise and distraction. Give it (or Raindrop) a try while wearing headphones.

But. I started having problems when firing it up on my 64-bit Debian Jessie (#!) system... especially since the venerable padsp trick stopped working. I managed to get it working flawlessly again, but I've put this here for my own reference and to help anyone else dealing with this problem:

PulseAudio is the newer system of sound servers for linux, but some older programs try to write directly to sound devices the "old way".   Padsp is a wrapper script that lets the old programs use the new sound interface.

Until 64 bit systems came along, and the old programs wanted a 32-bit sound library.  Then you get this error:

ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/pulseaudio/libpulsedsp.so' from LD_PRELOAD cannot be preloaded: ignored.

Here's the workaround: Download (but do not install) the 32-bit package that includes libpulsedsp (here they are for Debian and Ubuntu). Extract the file libpulsedsp.so.

dpkg-deb -x *.deb /tmp/extract/

Copy libpulsedsp.so to /usr/lib32/libpulsedsp.so
Edit /usr/bin/padsp so that the line "while getopts" now reads:

while getopts 'hs:n:m:MSDdi' param ; do

Before the line starting with *), add these lines:

i)
if [ x"$LD_PRELOAD" = x ] ; then
LD_PRELOAD="/usr/lib32/libpulsedsp.so"
else
LD_PRELOAD="$LD_PRELOAD /usr/lib32/libpulsedsp.so"
fi

export LD_PRELOAD
shift $(( $OPTIND - 1 ))
exec "$@"
exit 0
;;

Now change your script to call padsp -i /path/to/sbagen

No comments :