Playing audio on the NSLU2

3D Sound USB Audio Device

I'm a happy NSLU2 user since a few months now, and I'm using it for all kinds of things, e.g. as a 24/7 remote ssh server at home (using DynDNS and the ddclient Debian package), as IRC logger (screen + irssi), etc. etc.

I was considering multiple options as to where/how to install the slug (USB thumb drive, Compact Flash, disk drive, ...) but I settled with a full Debian install on an 1 GB USB thumb drive for now. I implemented some measures to maximize the life time of the USB thumb drive, maybe I'll post some info on that later...

One new thing I've been trying lately is to use the slug as an audio player.

As it doesn't come with an integrated sound card, you have to use an external USB audio device. I've got mine (see photo) from eBay for ca. 5 Euro (+ shipping) and it works out of the box with Linux 2.6.18 using the snd_usb_audio kernel module. You simply attach it via USB (the module is automatically loaded) and then attach external speakers to it. Here's an lsusb of the device:

Bus 001 Device 011: ID 1130:f211 Tenx Technology, Inc.

One problem with playing audio on the slug is the slow CPU. At 266 MHz (and without FPU!) playing audio with "normal" audio players such as mplayer or mpg321 is not possible. But there are several ways to make the slug play your favorite music. Here's a list of players I tested and a status report of whether they work at all. If yes, I listed a rough percentage of CPU load resulting from playing the music.

  • MP3:
    • mplayer, mpg321, aplay, playsound, and splay don't work.
    • $ madplay foo.mp3: 17% CPU load
  • Ogg vorbis:
    • mplayer, aplay, playsound, and ogg123 don't work.
    • $ apt-get install libvorbisidec-dev
      $ cd /usr/share/doc/libvorbisidec-dev/examples
      $ make
      $ cat foo.ogg | ./ivorbisfile_example | aplay -f cd

      Result: 40% CPU load

  • MOD, XM, S3M, IT, etc.:
    • $ mikmod foo.mod: 10% CPU load (even with compressed MOD files)
  • WAV:
  • FLAC:
  • SPEEX:
    • $ speexdec foo.spx: doesn't work, 100% CPU load. Any known alternatives?
  • AU:
    • $ cat > /dev/dsp: 3% CPU load (but sounds crappy)
    • $ cat > /dev/audio: 3% CPU load (sounds better)
    • $ mplayer 5% CPU load
    • $ aplay 5% CPU load
    • $ playsound 5% CPU load
  • AIFF:
    • $ sox foo.aiff -t wav - | aplay: 50% CPU load (a bit stupid, but it works)
  • Streaming MP3:
    • $ mplayer doesn't work, 100% CPU load.
    • $ wget -O - | madplay - : 17% CPU load
  • Streaming Ogg Vorbis:
    • $ cd /usr/share/doc/libvorbisidec-dev/examples
      $ wget -O - | ./ivorbisfile_example | aplay -f cd
      : 40% CPU load

The SlugAsAudioPlayer page in the NSLU2-Linux wiki might have further information on this topic.

Feel free to add comments if you know of other audio types which can be played on an NSLU2.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Usb sound card and guruplug


I am trying to use my guruplug ( that is running debian ( 2.6.32-00007-g56678ec ). The problem is, I don't see anything when I plug my usb 3D sound on the guruplug... here is the output of an lsusb when the usb is plugged in:

Bus 001 Device 003: ID 059b:0475 Iomega Corp.
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB [Hama]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Same output when it's not plugged in :

Bus 001 Device 003: ID 059b:0475 Iomega Corp.
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB [Hama]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I don't know what's going on. My goal is to use my guruplug as an audio player, with ampache ( ) as interface.

I know it's an old post, I hope you can help me !



Looks like a hardware issue maybe? Can the guruplug even be a USB host? Does the audio device work on another system? Any error messages in dmesg?



Thanks for really usefull article! you can get those same soundcards dirt cheap from dealextreme, 3.98 US dollars, free shipping!. I didn't know those work for linux, but thanks to you now I do

/dev/dsp (No such file or directory)

I was toying with the idea of purchasing a wireless radio receiver, when I had a light bulb moment, "Why not use my NSLU2 + Debian to play audio?" My Debian Slug has been serving me for about a year plus now, and attaching a USB Audio Device to it would have made it play online radio just as well. Brilliant!

So off I went, to the computer stores, bought myself the same USB Audio Device called "3D Sound" which you have. I have a full Debian running on my overclocked NSLU2.

What to do next? That's when I stumbled on your Blog

You're right that the USB Audio Device works out of the box on Debian 2.6.18-4-ixp4xx which is installed in my NSLU2

For people who plan to use this similar USB Audio Device and run into an error like /dev/dsp (No such file or directory) while trying to play audio, that's because this device uses ALSA drivers

mplayer and madplay search for /dev/dsp which is what OSS programs use

The following modules will have to be loaded for backward compatibility with OSS (Open Sound System) programs, ALSA uses /dev/snd/* devices.

modprobe snd-pcm-oss
modprobe snd-mixer-oss


That's it!

Works like charm :)

Thanks for the write up Uwe, nice read on the various players that work.

Unable to Play Streaming WMA/ASX Files with mplayer

Anyone experiencing extremely choppy audio while trying to play online ASX/WMA streams in mplayer?

Tried all sorts of solutions, from adjusting srate to tweaking -cache control in mplayer options, to no avail.

Would like to see some input from you guys.



Nice, thanks for the OSS sound tip.


USB Audio working how well?

hi, very interesting article.
I have exactly the same device as yours as usb audio card but
I have a problem with the mixer... it does not work!
The problem is that connecting to a pair of amplified speakers
it overdrives them and the only solution is to use software mixing but
it reduces audio quality.
Do you have the same problem?


Hm, I didn't notice mixer

Hm, I didn't notice mixer problems or overdriving problems the last time I tried. I used both passive and active speakers with good success.


Fixed Point?

Is that Vorbis decoder the floating point or fixed point version. (I ask this with the understanding that floating point is software emulated by the kernel on ARM processors that don't have some form of FPU).

Vorbis, Tremor

The "normal" ogg123 is floiting point, thus slow. The tiny program (ivorbisfile_example) uses "Tremor" which is a fixed-point version of the code and works fine (or at least better).

There's no Tremor support in ogg123 Debian package (yet), as far as I know.

fixed-point decoders

You should compile mplayer with tremor and libmad and configure it to use those. Then mplayer should work.


Yep, true. This is not compiled in the standard mplayer Debian package, though (maybe worth a wishlist bug report)...

Please do expand on the

Please do expand on the "implemented [...] measures to maximize the life time of the USB thumb drive". I'd think that it is pretty hard to destroy a flash drive, see the article about swap space on flash drives at Dan's Data.
Regardless of that I'd think that after the garanty on these things (5 or 10 year mostly) runs out, the replacement would would cost almost nothing (Moore's Law).

save flash life

On some (Unslung?) wiki page, I found a recommendation to make /var/log a ramdisk. Since it only said how to copy /var/log to memory but not back (which might be important), here's mine:

# /etc/init.d/
# Script section to create ramdisk for /var

# disable the oom-killer to use the full swap
/sbin/sysctl -w vm.overcommit_memory=1
# From JNC : this command does not exist on my slug (release 2.7)

# better only use /var/log then the full /var
# following lines might need to be adjusted according to your OS and/or installed services
/bin/echo "Creating ramfs for /var/log:"
/bin/mkdir -p /var/oldlog
/bin/mount -t ramfs ramfs /mnt -o maxsize=256
/bin/cp -rp /var/log/* /mnt/
/bin/mount -o bind /var/log /var/oldlog
/bin/mount -o bind /mnt /var/log
/bin/umount /mnt
return 1


# /etc/init.d/
# Script section to destroy ramdisk for /var

/bin/echo "Destroying ramfs for /var/log:"
#/bin/cp -rp /var/log/* /var/oldlog
/usr/bin/rsync -au /var/log/. /var/oldlog/.
/bin/umount /var/log
/bin/umount /var/oldlog
return 1

Together with these links
lrwxrwxrwx 1 root root 23 May 21 16:35 ../rc0.d/ -> ../init.d/
lrwxrwxrwx 1 root root 23 May 21 16:36 ../rc6.d/ -> ../init.d/
lrwxrwxrwx 1 root root 22 May 21 15:34 ../rcS.d/ -> ../init.d/
I suppose disk write access will be limited to software installs (and some swap, since ramdisk old contents will overflow to swap I suppose)

Suggestions welcome.

I'd be interested in how

I'd be interested in how well mpd would run on the nslu2

My experience

Hi !

I'm myself trying to configure my Turboslug to do lot of things, which include a music server. I'm writing down all the stuff I'm doing, to publish later on the webserver that is supposed to run on it (not yet online, that's why my webpage says "Forbidden access").

I work on the music part for the moment. My system is a Debian Etch 4.0r0 for now, and MPD runs fine, but only for MP3 and FLAC files. Ogg files (320kpbs I admit) takes up 98%+ of the CPU and are inaudible.

For MP3s (320kpbs also) it plays at ~7%, better than Mr Hermann it seems. Same for the FLACs, around 8-9%.

I will try to install the tremor decoder for ogg, and recompile mpd to use it. But I need to switch to testing for it... Or use a backport. I don't know yet.

I hope this will be useful to you.


Should run pretty good, lots of people seem to be using it (I haven't tried yet, don't need it). There's a good page in the NSLU2-Linux wiki on that...

HTH, Uwe.

The article is very good

The article is very good