PDA

View Full Version : Squeezeslave sound distorted on SheevaPlug over USB DAC



zoop
2011-02-09, 05:17
I'm currently running SBS on a SheevaPlug and since it's located near a stereo, I just added a USB DAC (Project USB Box) to it and installed Squeezeslave and in principle, everything is working.

However, the sound is so distorted that it's barely recognizable as music anymore.

I'm first of all interested in whether anyone has faced this problem. But I'm also willing to get my hands dirty if someone can point me in the right direction. I know C well, but unfortunately, I don't know too much about audio, so any pointers as to how I could debug this problem would be greatly appreciated.

Here are a few additional pieces of information that should help narrow the problem down:


The strangest thing first: If I create load on the SheevaPlug, for instance by running "while true; do ls; done" or setting the refresh rate of top to .000001, the distortions are gone!
I tried with the latest precompiled version from here (http://squeezeslave.googlecode.com/files/squeezeslave-1.0-231-alsa-armel-lnx26.tar.gz) and the trunk version from SVN. The results are the same.
Adding "-y 1000" helped a lot already, but I still get distortions every few seconds.
Elevating squeezeslave to real-time priority using "chrt 99 nice -n -20" did not help
Squeezeslave on my laptop works just fine (with or without USB Hub in between)
Other audio players work just fine on the SheevaPlug (tried with mpg123)


Any help with this problem would be greatly appreciated!

minscof
2011-12-11, 04:56
Hi,

I have the same problem with another hardware : Iomega Iconnect. I notice that sound crackles a lot when using alsa (my USB DAC is an E-MU 0204), but when I use Pulseaudio, sound is great. I don't know why such a difference.

Maybe, it can help you.

Have you found a solution to your problem ?

Thanks

ralphy
2011-12-11, 05:17
It's a "bug" in the sheeva kernel

The kirkwood arm cpu doesn't handle Memory Mapped pcm devices.

Version 4.0+ of squeezeplug (http://squeezeplug.eu) has a kernel with this patch applied.

Here's the patch.



--- linux-2.6.38.8/sound/usb/pcm.c.orig 2011-06-02 21:35:11.000000000 -0400
+++ linux-2.6.38.8/sound/usb/pcm.c 2011-08-21 12:10:44.000000000 -0400
@@ -423,8 +423,8 @@

static struct snd_pcm_hardware snd_usb_hardware =
{
- .info = SNDRV_PCM_INFO_MMAP |
- SNDRV_PCM_INFO_MMAP_VALID |
+ .info = /* SNDRV_PCM_INFO_MMAP | */
+ /* SNDRV_PCM_INFO_MMAP_VALID | */
SNDRV_PCM_INFO_BATCH |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |

zoop
2011-12-11, 06:54
I can confirm that this fixes the issue for me! Thanks a lot for posting this.

Do you know more about the source of the problem? It would be nice if this could be made to work out-of-the-box in future kernel versions. Do you know if disabling MMAP is the proper solution or is it just a workaround and the problem lies somewhere else?

@minscof: I wrote a small program that keeps the CPU busy because then the problem disappears. But cleary applying ralphy's patch is the much better solution.

minscof
2011-12-11, 10:19
Hi,

Ty for this explanation, but I don't use squeezeplug on Iconnect but arch linux. I try to understand what you describe and I think the actual problem is not really there, because some USB audio device can support mmap, so I think, the solution should be to use a specific driver for my sound card with mmap support disabled.

But I continue to look for a solution and I see this post :
http://www.linuxquestions.org/questions/linux-hardware-18/alsa-or-oss-sampling-rate-change-439281/

I change in /usr/share/alsa/alsa.conf the default rate for dmix : it was 48000 ans I put 44100, and restart alsa /etc/rc.d/alsa force-restart

The sound is good now, maybe not excellent but really better. I don't understand why this parameter was so important for my configuration, because I thought , I didn't use dmix pcm, and I did a lot of try in /etc/asound.cfg to change the rate without success.

I would be interested to understand if someone can help me again.

Thanks a lot