mjsbeaton
Posts: 7
Joined: Wed Oct 31, 2012 3:34 pm

C-Media USB + Shairport sounds better on Raspian than Arch

Mon Mar 25, 2013 11:29 am

I have been playing around with setting up my RPi as some kind of media-centre/Shairport device. (Mainly so I can watch UK TV on my Pi, and play my iPhone music through it into my half way decent speakers.)

I have a cheap C-Media USB sound card (there seem to be a lot of these about).
logilink.jpg
Logilink USB Sound Card
logilink.jpg (10.42 KiB) Viewed 4539 times
I have found that on the latest Raspbian (fully updated), the card sounds fine with Shairport, but on the latest Arch Linux (fully updated, and with nothing installed except what is required for Shairport) the card sounds *really* bad. It has clicks (which seems to be a widely reported problem) but it also sounds really 'warbly' (like everyone singing and playing is warbling, not just singing!), which is a problem I haven´t seen reported as such anywhere else. (By the way, on both systems, the sound is perfect over HDMI digital out - but I don't want to have to have my TV switched on in order to get sound, and my TV only has digital out, too, so I still couldn't play on my analogue speaker system that way.)

I also noticed that aplay with a wav file sounds poor & clicky on both distros. But for some reason, Shairport sounds much better (& perfectly acceptable) on Raspian.

I understand (I think!) that ALSA audio has to do lots of additional processing to get the sound out of a USB card, and that this puts some strain on the relatively low powered RPi, but what I don't really understand is why Shairport with ALSA would sound fine on Raspian, but sound really rubbish on Arch Linux.

Unfortunately, I have found that lots of the suggestions for improving ALSA USB sound (on Arch, or just generally) talk about files that aren't present on the latest version of Arch Linux with ALSA.

Any thoughts or suggestions, anyone? (Especially, has anyone got a C-Media USB sound card working with acceptable sound quality with Shairport, on the latest version of Arch Linux on the RPi, and did you get anything like the problems I have? Did you find a fix?!)

Thanks.

Vulcan
Posts: 2
Joined: Fri Apr 05, 2013 4:04 pm

Re: C-Media USB + Shairport sounds better on Raspian than Ar

Fri Apr 05, 2013 4:12 pm

I am not surprised this card works well with Raspian (and no its not related to having incapable hardware). It works because Debian appears to have a more capable driver for it.

I have a pogoplug series 4 with Arch Linux ARM on it, and the same USB dongle plays audio full of static. I however have an NSLU2 that has Debian Squeeze on it and the dongle runs perfectly there. If you look at dmesg in both systems, it looks like Arch loads some sort of generic driver for the device while Debian loads a CMedia driver (so says dmesg anyway). The NSLU2 is really underpowered, even compared to the Pi but it still plays mp3s flawlessly and even plays a wireless stream directly off the wire with crystal clear audio.

So I am going to attempt building a CMedia driver for ArchLinux ARM which might mitigate the problem perhaps. Will let you know on progress

Best
V

Vulcan
Posts: 2
Joined: Fri Apr 05, 2013 4:04 pm

Re: C-Media USB + Shairport sounds better on Raspian than Ar

Sun Apr 07, 2013 2:28 pm

Ok try this :

echo "use_mmap=no" >> /etc/libao.conf
reboot

Credit goes to these guys : http://archlinuxarm.org/forum/viewtopic.php?f=18&t=3686

Worked for me!

mjsbeaton
Posts: 7
Joined: Wed Oct 31, 2012 3:34 pm

Re: C-Media USB + Shairport sounds better on Raspian than Ar

Wed Apr 10, 2013 5:35 am

I'll give your suggestion for Arch a go when I get a chance, and let you know. Thanks!

mjsbeaton
Posts: 7
Joined: Wed Oct 31, 2012 3:34 pm

Re: C-Media USB + Shairport sounds better on Raspian than Ar

Wed Apr 17, 2013 6:49 pm

Hi @Vulcan,

I have tried your suggestion - many thanks for taking the time to post it.

I added the line to /etc/libao.conf (and checked that it had worked by using cat on the same file), then I rebooted. I'm afraid no joy for me, the sound is exactly the same, warbly (which is worse on some tracks than others) and clicky.

I haven't gone in to the posts you linked to in full detail - just enough to read that memory mapped sound is somehow broken in Arch and to work out that what you posted presumably turns this off and uses another method. But it sounds the same for me, I'm afraid! Thanks for the suggestion, though, and maybe if I find time to read more into the posts you linked to, I'll figure out how to make it work for me.

Cheers, Mike

mjsbeaton
Posts: 7
Joined: Wed Oct 31, 2012 3:34 pm

Re: C-Media USB + Shairport sounds better on Raspian than Ar

Wed Apr 17, 2013 7:57 pm

OK - the below fixed it from me.

(It is from the thread you linked to, @Vulcan, so many thanks, but basically I had to do the other thing they suggested there instead of the one which worked on your set up.)

I completely replaced my /etc/asound.conf with one which reads:

Code: Select all

pcm.!default {
        type hw
        card 1
}

ctl.!default {
        type hw           
        card 1
}
This works for me - clear sound, no clicks on ShairPort on Arch Linux! 8-)

Notes:
  • I used card 1, not card 0 as in the other forum, because the Raspberry Pi USB sound card is card 1 not card 0.
  • The above involves replacing a pre-existing asound.conf, in (what looks like) a newer format. I'm sure there's a way to combine the two if you needed to, but just the above was enough for me.
  • For my setup, it seems I didn't need the other change, from @Vulcan's post, I removed the extra line from libao.conf and rebooted, and it is still fine.

Return to “Graphics, sound and multimedia”