jsalk
Posts: 11
Joined: Thu Jul 12, 2012 12:11 pm

USB to Class 2 Audio USB DAC comm issues

Sun Jul 22, 2012 2:40 pm

For about the last two years or so, I have been setting up MPD-based systems that stream audio from a sorage device of some sort (another computer, an NAS, etc.) to an outobard USB Class 2 Audio DAC. I have been quite successful in doing this on a number of hardware platforms and with a number of different distros. I have had systems running successfully for months at a time with no crashes and perfect audio reproduction.

When the RPi was announced, I thought it would be a fun project to set up a similar system. I'm now getting quite close to having a stable system, but there is a final hurdle I just can't seem to get past.

I am posting this for three reasons: 1) if someone is attempting the same thing, perhaps this will help them get up to speed faster; 2) hopefully someone can provide insight as to the steps that might be required to address the last few issues; and, 3) (I'll get to that later...)

I feel I am somewhat close to having this wrapped up, but there are two final issues I need to resolve.

While playback is mostly clean, there are occassional clicks and audio hash. By occassional, I mean perhaps 20 clicks in the playback of each song. This is certainly no worse than you would hear with vynil, but is a deal-breaker at this point. The audio hash seems to be somewhat related to the material, but is totally objectionable.

I am trying to decide if RPi is capable of this task and have gone about as far as I can without some input from others.

Here is what I did so far:

After trying a few linux distros ("official debian" and wheezy) I decided to try hexxeh's debian image as it was about the most stripped down version available. It seems to be about the best of the three for what I am trying to do.

To that, I used apt-get to add samba, nmap, alsa-base, alsa-utils, avahi, php5 and perhaps a few others that escape me at present.

Then I went about to modify some conf files for my purposes. The floowing represent the most important...

Comment out in /etc/modprobe.d/alsa-base.conf

Code: Select all

#options snd-usb-audio index=-2
This allows USB DAC to become hw:0,0

Comment out the following lines in /etc/hosts

Code: Select all

# The following lines are desirable for IPv6 capable hosts

#::1     ip6-localhost ip6-loopback
#fe00::0 ip6-localnet
#ff00::0 ip6-mcastprefix
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters
#ff02::3 ip6-allhosts
This eliminates problems with mpc "Connection refused" errors

In mpd.conf, I tried various settings for bind_to_address.
If I used "localhost" or "127.0.0.1" mpd could connect remotely, but I received an "Connection refused" error from mpc.
It I used the physical address of the RPi, say "192.168.1.113" mpc worked, but mpd would often fail to connect.
Finally, I tried the following:

Code: Select all

bind_to_address		"::"
port			"6600"
I tried many variations of this (default, 127.0.0.1, host IP address) and some things worked and others didn't. This final setting, by the way, is the setting I use on quite a few MPD setups on other processor boards. Both mpc and MPD work with this setting (although you do have to comment out all the IPv6 items in /etc/hosts.

Other mpd.conf settings include:

Code: Select all

user			"mpd"
group                   "audio"

audio_output {
	type		"alsa"
	name		"default"
	device		"plughw:0,0"
#	format		"44100:16:2"
#	mixer_device	"default"
#	mixer_control	"PCM"
#	mixer_index	"0"
	mixer_type    "software"
}

buffer_before_play		"10%"

Group can probably be commented out without issue.

I increased buffer_beore_play to 20%, but it had no effect. I don't think the buffer is related to the playback issues.

Based on another thread, I created an /etc/asound.conf file containing the following:

Code: Select all


pcm.!default {
        type hw
        card 0
}

ctl.!default {
        type hw
        card 0
}
This seemed to help at first, but I'm not sure it is required (I don't use an asound.conf file in any of my other setups).

I monitored CPU utilization during playback to see if the ARM processor just wasn't up to the task.

With 16/44 flac files, untilization rarely exceeded 10%. With 24/96 files, at times it hit 18 - 20% but rarely, if ever, exceeded that level. 24/192 files hit 35 - 40% (which were basically unlistenable).

So the issue does not appear to be related to exceeding the capabilities of the ARM processor.

That leads me to the conclusion that the issues are related to the USB implemenation on the RPi. But I am only speculating here. I ran into this post regarding RPi USB packet loss on another site:

https://github.com/raspberrypi/firmware/issues/19

In addition, there is currently a similar thread here:

http://www.raspberrypi.org/phpBB3/viewt ... =28&t=5249

I ran into a few perculiar issues with DACs as well.

First, I tried a "relatively" inexpensive Schiit BiFrost DAC. I had quite a few issues with this DAC. Sometimes it would work, but mostly it produced total audio hash. For some reason, the system would be come so unstable, I would lose my MPD client, Samba and SSH connections. So, of course, I could not stop playback and had to wait until the track was finished playing before I could re-establish connections with the RPi. I also had trouble rebooting with this DAC connected. At this point, I was ready to give up on the RPi as a candidate.

I happend to have a cheap SoundBlaster USB audio adapter laying around, so I thought I'd try that. This seemed to work (other than an occasional audio hash). Of course, this card is limited to 16/44, but at least I was able to determine that the RPi didn't like the BiFrost DAC (and still doesn't). Again, I suspect it is a USB issue since my other MPD systems have no issues with this DAC.

Next, I tried an DAC from Audio by Van Alstine. I had Frank modify this DAC to add an XMOS Audio Class 2 USB adapater to one of his Fet Valve DACs. This worked fairly well (if you don't mind clicks and occassional audio hash) on 16/44 and 24/96 tracks.

I have a Wavelength asyncronous DAC that I have not tested with this setup as it is in a different location. But somehow, even it if did work, it wouldn't seem to make sense to use a $7000 DAC with a $35 processor. So I won't bother testing with it.

I am hoping someone can shed some light on the issues I am having with USB/DAC communications. If I can get this resolved, that will lead to the #3 reason for this post as mentioned above.

The other issue is that when I have one of these USB DACs attached, I cannot re-boot. The system simply never comes back. If I power off and power on, the system comes up just fine.

Some time ago, I realized that many of our customers (we build custom high end speakers) would never be able to use this type of setup because they were not technical enough to use linux. So I developed a web-based front end that allow the users to configure the system without being aware that linux is involved. The user simply enters inforamtion in a web browser and the PHP will write all the appropriate linux conf files.

When I started work on this project, my goal was to polish the entire system, generate an .img file and make it available to anyone who wanted to use a RPi for this task but didn't want to bother with setting it all up. Of course, if I can't get these final issues resolved, it will never happen.

So, any help anyone would like to provide will be highly appreciated.

Sorry for the length of this post.

- Jim

jsalk
Posts: 11
Joined: Thu Jul 12, 2012 12:11 pm

Re: USB to Class 2 Audio USB DAC comm issues

Sun Jul 22, 2012 2:46 pm

One additional note...

All USB DACs I have tried so far are the only USB devices hooked up and with the exception of the SoundBlaster USB audio dongle, all are self-powered.

- Jim

piscicelli
Posts: 4
Joined: Tue Mar 06, 2012 1:15 am

Re: USB to Class 2 Audio USB DAC comm issues

Tue Jul 24, 2012 7:59 pm

Jim.

I just made a similar post regarding my experiments with the HRT Music Streamer II, one of the most popular asynchronous USB DACs out there. My clicks are actually much more frequent - about one every second.

There is also a related post on the subject here: http://www.raspberrypi.org/phpBB3/viewt ... =28&t=7662. It is interesting that Thomas of the Squeezeplug project, who created an image for the Pi to be used as a music streaming device, has not reported similar problems.

From the various threads on the topic, it looks like the Pi has serious USB reliability issues. The fact that there is no official power supply and that many USB devices require a powered USB hub compound the problem, because it makes it harder to analyse it in isolation and easier to blame some outside factor, such as the power supply/hub instead of the Pi's firmware and it's own USB hub.

It looks like the Foundation has shown scarce enthusiasm in fixing the issue for now. Hopefully they are not ignoring it simply because they have determined that there is a hardware flaw in the Pi that cannot be fixed with software upgrades.

Time will tell...

jsalk
Posts: 11
Joined: Thu Jul 12, 2012 12:11 pm

Re: USB to Class 2 Audio USB DAC comm issues

Tue Jul 24, 2012 10:23 pm

I had a HRT Music Streamer II I used for testing here for some time, but recently had a customer who wanted one. So I just sold him mine.

I also have a $3500 Wavelength Cosecant asynchronous USB DAC done by Gordan Rankin. This is an very high end DAC and I have not tested it yet. But based on tests so far, I probably won't bother until someone addresses the USB issues.

From posts I read recently, it just may be a driver issue (which could be solved relatively easy). Let's hope its that and not a hardware issue.

- Jim

clog
Posts: 11
Joined: Wed Jul 25, 2012 8:35 am

Re: USB to Class 2 Audio USB DAC comm issues

Wed Jul 25, 2012 8:48 am

I use the ODAC USB class 1 24 bits DAC. When I output 24 bits music in 44.1 khz and higher I get distorted sounds. when I limit output to 16 bits 44.1 khz sound is mostly ok. The reason that Thomas of the squeezeplug project hasn't reported similar problems is AFAIK that the squeezeserver is limited to 16 bits 44.1 khz. I followed the discussion about usb problems with the Raspi. I got the impression that it was about usb 1.0 and 1.1 devices. I'm not sure but I guess that our dacs are 2.0 devices. I tried several proposed remedies but so far no solution. I must say I'm very disappointed because the raspi seemed a perfect solution for an always on mpd music server.

dgently
Posts: 1
Joined: Tue Sep 25, 2012 2:12 pm

Re: USB to Class 2 Audio USB DAC comm issues

Tue Sep 25, 2012 2:22 pm

I am just lurking on the Raspberry Pi site (don't have one yet). But have been trying to setup MPD on an old netbook and have run into similar problems.
After wasting lots of time, I decided to look at the mpd.conf man page, and found the two following parameters: buffer_time, period_time.
I have not had time to tweak the yet, but the have reduce the number of click for me at all bitrates. I have to experiment with more values in hope of completely eradicating the clicks.

jsalk
Posts: 11
Joined: Thu Jul 12, 2012 12:11 pm

Re: USB to Class 2 Audio USB DAC comm issues

Tue Sep 25, 2012 7:01 pm

I gave up trying to get MPD to work without clicks and dropouts. It is too bad really as this would make a nice little MPD player.

I will continue to monitor this thread in hopes that the issue gets resolved. Once it is, I will make a ISO file of my setup, including a web interface for the player, available to all.

- Jim

clog
Posts: 11
Joined: Wed Jul 25, 2012 8:35 am

Re: USB to Class 2 Audio USB DAC comm issues

Wed Sep 26, 2012 7:14 am

@jsalk
I see you have a lot of experience with mpd on different platforms.
Like you i am disappointed in the raspi. At least for the tine being. I still hope for improvements on the usb packet loss problem.
Because of this i went looking for a similar platform but with hopefully better results. Therefore i bought an Iomega iconnect. People say it's very easy to install debian on it.
Do you have experience with this platform regarding mpd ???

piscicelli
Posts: 4
Joined: Tue Mar 06, 2012 1:15 am

Re: USB to Class 2 Audio USB DAC comm issues

Wed Sep 26, 2012 7:23 am

Has anyone tried with the latest wheezy images/RPI updates?

jsalk
Posts: 11
Joined: Thu Jul 12, 2012 12:11 pm

Re: USB to Class 2 Audio USB DAC comm issues

Wed Sep 26, 2012 11:12 am

clog wrote:@jsalk
I see you have a lot of experience with mpd on different platforms.
Like you i am disappointed in the raspi. At least for the tine being. I still hope for improvements on the usb packet loss problem.
Because of this i went looking for a similar platform but with hopefully better results. Therefore i bought an Iomega iconnect. People say it's very easy to install debian on it.
Do you have experience with this platform regarding mpd ???
I have not played with that device. What processor does it use? Have you looked at the Alix boards?

- Jim

clog
Posts: 11
Joined: Wed Jul 25, 2012 8:35 am

Re: USB to Class 2 Audio USB DAC comm issues

Wed Sep 26, 2012 2:42 pm

@jsalk
The Iomega iConnect is a Marvell Kirkwood (ARM) Linux-based device which comes with 4 USB ports, GbE and wireless support (802.11g). The iConnect has 256MB RAM memory and 512MB flash memory. It seems quit easy to install Debian on the Iconnect. I bought one secondhand for 20€.
I have read about the Alix board. A lot of high end audio guys seem to be very happy with an Alix Mpd solution.

raggis
Posts: 1
Joined: Sat Oct 20, 2012 7:23 pm

Re: USB to Class 2 Audio USB DAC comm issues

Sat Oct 20, 2012 7:29 pm

Did you ever solve this issue? I'm thinking of ordering a rpi and using it with an xmos usb dac, which is currently working pretty well with a mac mini.

It occurred to me that the rpi might not be able to supply enough current to class2 audio devices, so I'll try using a powered usb hub to see if that makes a difference.

jsalk
Posts: 11
Joined: Thu Jul 12, 2012 12:11 pm

Re: USB to Class 2 Audio USB DAC comm issues

Sun Oct 21, 2012 1:31 pm

I have been monitoring this thread in hopes this issue would be addressed. But I have yet to hear of any progress. I don't think it is an issue of being able to drive something like an XMOS card. There are simply drop-outs in the bit stream. I don't know if it is a hardware or OS driver issue, but I wouldn't waste your time with it until the issue is addressed. At present, the Pi simply won't work for this application.

- Jim

bgaughan
Posts: 1
Joined: Sun Oct 28, 2012 5:07 pm

Re: USB to Class 2 Audio USB DAC comm issues

Sun Oct 28, 2012 5:20 pm

Hi,

IIRC, ethernet on the rpi is over USB, so if you are pulling audio from a remote networked server, and sending it to a USB DAC, you are stressing the USB subsystem more severely then you may think. I've had similar issues on far more powerful hardware pulling audio from a USB HD and sending it to a USB DAC. In that case, when I pull audio from local hard drive or a NAS (ethernet not via USB), I do not experience the issue. Just to check, you might try playing audio from the local SD storage and see if the issue goes away.

User avatar
azeam
Posts: 194
Joined: Fri Oct 26, 2012 11:13 pm
Contact: Website

Re: USB to Class 2 Audio USB DAC comm issues

Thu Nov 15, 2012 11:53 am

Adding dwc_otg.speed=1 to /boot/cmdline.txt, as explained in one of the threads linked to in the inital message, finally pretty much resolved this issue for me. I haven't had time to fully experiment and I've noticed some occasional cracks but nothing like before and 24 bit flac is definitely listenable in my opinion.

I'm on 3.2.27+ #160 PREEMPT with an external USB DAC, no asound.conf and the following settings in mpd.conf:

Code: Select all

audio_output {
type "alsa"
name "Bit Perfect"
device "hw:0,0"
}

lintweaker
Posts: 33
Joined: Mon Jul 09, 2012 6:26 pm

Re: USB to Class 2 Audio USB DAC comm issues

Thu Nov 15, 2012 4:30 pm

azeam wrote:Adding dwc_otg.speed=1 to /boot/cmdline.txt, as explained in one of the threads linked to in the inital message, finally pretty much resolved this issue for me. I haven't had time to fully experiment and I've noticed some occasional cracks but nothing like before and 24 bit flac is definitely listenable in my opinion.

I'm on 3.2.27+ #160 PREEMPT with an external USB DAC, no asound.conf and the following settings in mpd.conf:

Code: Select all

audio_output {
type "alsa"
name "Bit Perfect"
device "hw:0,0"
}
With this you're limiting audio playback to USB Audio Class 1 i.e. 96k max.
That's not a real option for me.

User avatar
azeam
Posts: 194
Joined: Fri Oct 26, 2012 11:13 pm
Contact: Website

Re: USB to Class 2 Audio USB DAC comm issues

Fri Nov 16, 2012 3:17 pm

Yes, though I don't see that as a very big issue since I barely have any 24/192 files (and don't really see the point in having), and even if the output frequency is limited to 96kbps the few 24/192 files I have play just fine as well (~80% cpu usage).

There are however other obvious drawbacks when you limit the USB to 1.1, such as a much slower and less stable network connection, and in my case NFS share...

d1554573r
Posts: 1
Joined: Thu Mar 21, 2013 6:13 pm

Re: USB to Class 2 Audio USB DAC comm issues

Thu Mar 21, 2013 6:19 pm

About those clicks, i've encountered a post somewhere that suggested that they are a result of wrong usb connections on the PCB, so its RPI wide factory issue, to verify if this is true I pluged rpi to an active usb hub and used the hub to plug Musical Fidelity V-DAC 2 and Trends Audio UD 10 ... and guess what?

Clicks are gone :) playback is nearly flawless im having some issues with audio-video sync thou, when I fix AV sync by messing around with pulse audio conf the audio playback gets choppy so im still fighting with our little thing...

User avatar
azeam
Posts: 194
Joined: Fri Oct 26, 2012 11:13 pm
Contact: Website

Re: USB to Class 2 Audio USB DAC comm issues

Thu Mar 21, 2013 8:26 pm

d1554573r wrote:About those clicks, i've encountered a post somewhere that suggested that they are a result of wrong usb connections on the PCB, so its RPI wide factory issue, to verify if this is true I pluged rpi to an active usb hub and used the hub to plug Musical Fidelity V-DAC 2 and Trends Audio UD 10 ... and guess what?

Clicks are gone :) playback is nearly flawless im having some issues with audio-video sync thou, when I fix AV sync by messing around with pulse audio conf the audio playback gets choppy so im still fighting with our little thing...
Is that with 24 bit audio? Is it an USB 1.1 or 2.0 hub?

ac_dsp
Posts: 1
Joined: Fri Nov 06, 2015 9:20 pm

Re: USB to Class 2 Audio USB DAC comm issues

Fri Nov 06, 2015 9:33 pm

We are starting to work with some other Cortex A solutions. In some cases, we will want to interface to Raspberry Pi as well.

Has anyone gone a bit further with this since the original posts.

User avatar
r3d4
Posts: 942
Joined: Sat Jul 30, 2011 8:21 am
Location: ./

Re: USB to Class 2 Audio USB DAC comm issues

Sat Nov 07, 2015 9:53 am

ac_dsp wrote:We are starting to work with some other Cortex A solutions. In some cases, we will want to interface to Raspberry Pi as well.

Has anyone gone a bit further with this since the original posts.
AFAIK the firmware has been 'updated' to address some usb problems
also i think i remember hearing linux usb bug has been fixed squashed .

The original post was @ 22 Jul 2012 :!:

+ i think now( 2015 ) you can find " off the shelf " gpio audio 'HAT' sloutions, that avoid usb ( usb is not ideal for serious audio IMO )

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1788
Joined: Thu Jul 11, 2013 2:37 pm

Re: USB to Class 2 Audio USB DAC comm issues

Sat Nov 07, 2015 10:52 am

Please don't necro 2-year-old threads.

Also, USB on Pi is a known quantity - see the documentation here:

https://www.raspberrypi.org/documentati ... /README.md
Rockets are loud.
https://astro-pi.org

Return to “Troubleshooting”