Slug USB Audio

I use a Linksys NSLU2 (slug) network attached storage device on my home network. The device is great, primarily because it is low power and runs full-fledged Debian GNU/Linux which makes it extremely versatile. I use mine as

  • File server – runs Samba, serves up music, videos and photos to home network
  • Print server – allows wired and wireless PC/Mac/Linux computers to print to the laser printer
  • Backup Server – makes automatic rsync backups of my website
  • Music Server – serves up MP3s from a web interface to play on other computers
  • Music Jukebox – has web interface to play songs through the stereo, using a USB Audio device

All this, and for less than 25W — 14W for the slug, which has no moving parts, and 5W each for 2x320GB USB hard drives.

Update: Tenx chipset USB adapters suck! See the end of the post for more details.

Hardware Requirements

Basically, for this to work, you need

  1. A Linksys NSLU2 – I got mine on eBay for about $70
  2. A USB Hard disk – as large as you like. 3.5" drives are cheaper but they need a seperate power supply. I partitoned my main drive into a 5GB root partition, a 512MB swap partition and a 315GB data partition. I use ext3 for my filesystem.
  3. A USB sound device. After looking at the advice on I picked up a super-cheap usb dongle from eBay. It’s the green one with the text "3D sound" on the side. This one is identified as being made by Tenx Technology, with USB ids 1130:f211. It works with the snd-usb-audio driver
  4. Amplifier/Reciever/Speakers etc – you need to play the audio through speakers. A decent set of computer speakers will do, or connect the audio output to an input on your hifi system.

Setting Things Up

It’s pretty easy to set most of this up.

  1. Follow the instructions to install Debian on the NSLU2
  2. Make the suggested changes in the README (in particular the FSCK fix which fixes a hang on reboot problem on my setup)
  3. Setup Samba and Cups (described elsewhere)
  4. Insert the USB audio device. Check the dmesg output to make sure it has been recognized
  5. Install alsa-base, alsa-utils, linux-sound-base, madplay and esound
  6. Try playing some audio: aplay /usr/share/sounds/alsa/Front_Right.wav
  7. See if madplay works: madplay /path/to/musicfile.mp3

The problem – distorted sound, no master volume

If that works, then fine: For me, sound would play but it was really distorted. I wanted to turn down the master volume but for some reason the usb-audio driver only provided a PCM volume control for my hardware. To fix this I used softvol from ALSA.

Create a ~/.asoundrc file like this:

pcm.softvol {
    type            softvol
    slave {
        pcm         "ossmix"
    control {
        name        "SoftMaster"
        card        0

pcm.!default {
    type             plug
    slave.pcm       "softvol"

‘SoftMaster’ won’t show up in alsamixer until you use it, so:

aplay -Dsoftvol /usr/share/sound/alsa/Front_Center.wav

Now, run alsamixer and set "SoftMaster" to something less than 100%.

In order to get madplay to work properly, I had to run it through esd.

  1. Start esd: esd --nobeeps --as 4 --noterminate -r 44100
  2. run madplay like: madplay -o esd: /path/to/musicfile.mp3

So now it’s working, how do you set up a web interface to browse, select and play songs through the speakers? Well, I’m working on something special for that. Watch this space.


I thought this had solved the problems I was having with distortion but in fact it only mitigated them a little. The Tenx chipset USB audio products do not work well in Linux and I do not recommend buying them to use with a slug.

I tried to find a C-Media chipset adapter but ended up with yet another Tenx P.O.S. I wish I could find somewhere that had the C-Media usb audio adapters, but most places don’t mention the chipset and I am NOT going to buy a third Tenx adapter. If anyone wants the Tenx one, just ask.