USB soundcard...Finally good (non HDMI) Analog Audio


144 posts   Page 1 of 6   1, 2, 3, 4, 5, 6
by ski522 » Tue Oct 23, 2012 11:24 pm
Well...took a bit of work, but I finally have decent sound out of my el-cheapo USB card. I couldn't take the popping between songs with the onboard analog port any more. So I bought a cheap CM802 based USB card. The one I got was Meritline http://www.meritline.com/usb-sound-adap ... 60824.aspx.

The PI reconginzed the card right away, but I was getting static playing songs or using Pianobar (Pandora shell app). So I did a few steps to fix it

1) Demoted the onboard card to the second device by
Code: Select all
sudo nano/etc/modprobe.d/alsa-base.conf
Made the following entries in the file
#options snd-usb-audio index=-2
options snd_bcm2835=-2

exit
reboot

2) Then I had to add the following to the /boot/cmdline.txt
Code: Select all
dwc_otg.speed=1

3) Created ~/.libao file in my home directory and entered the following:
Code: Select all
driver=alsa
dev=default

4) Lastly created a ~/.asoundrc in my home directory and entered the following:
Code: Select all
pcm.!default {
              type asym
              playback.pcm "defaultplayback"
              capture.pcm "defaultrec"
                hint{   show on
                   description "default play and rec koko"
                }
      }

      pcm.defaultrec {
              type plug
              slave {
                  pcm "hw:0,0"
                  rate 48000
                  channels 2
                  format S16_LE
              }
                hint{   show on
                   description "default rec koko"
                }

      }

  pcm.defaultplayback{
          type rate
          slave.pcm mix1
          slave.rate 48000

          #Intel(R) Core(TM)2 Duo CPU     E7500  @ 2.93GHz:

            #converter "samplerate_best"     # perfect: 16%cpu, maybe overkill
            #converter "samplerate_medium"   # almost perfect: 6%cpu
            #converter "samplerate"          # good: 4%cpu, definitely usable
            #converter "samplerate_linear"   # bad: 2%cpu, way better than default wine resampler
            #converter "samplerate_order"    # very bad: 2%cpu, like the default wine resampler

          converter "samplerate"

            hint{   show on
                   description "default play koko"
            }
  }

    pcm.mix1 {
            type dmix
            ipc_key 1024
            slave {
                pcm "hw:0,0"
                rate 48000
                periods 128
                period_time 0
                period_size 1024 # must be power of 2
                buffer_size 65536

            }
    }


Perfect sound and can now listen to pianobar from my PI and place all my CD's I ripped in FLAC. My next step will be tackling XBMC which requires some hacks from what I see in this post http://forum.stmlabs.com/showthread.php?tid=1052.

Slowly my PI is becoming a mini-media center I was looking for.
Posts: 389
Joined: Sun Sep 30, 2012 2:22 pm
by Argon » Wed Oct 24, 2012 12:05 pm
So, with this USB soundcard, no pops and no noise !?
I use Squeezeplug in the bathroom with the 3.5 audio out and I get always a lot of background noise when I play something...
Posts: 95
Joined: Thu Aug 25, 2011 11:04 am
by ski522 » Wed Oct 24, 2012 12:27 pm
Nope...none of that, no popping between songs, no static in music either once I got the configuration figured out.

BTW minor typo in my setting above

options snd_bcm2835 index=-2

forgot "index" in my original post.
Posts: 389
Joined: Sun Sep 30, 2012 2:22 pm
by redhawk » Wed Oct 24, 2012 12:48 pm
I have what looks like an identical USB dongle except it's black and based on the CM108 chipset.

Did you have any luck getting the buttons to work the volume control??

Richard S.
User avatar
Posts: 2951
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1
by ski522 » Wed Oct 24, 2012 1:03 pm
Yes, I beleive that are exactly the same (other than color), fairly certain mine has the CM108 as well. As for the volume controls, I don't need to use them since I'm connected to my home stereo, but just did a quick test and they don't seem to work. I set up my volume initially using alsamixer.
Posts: 389
Joined: Sun Sep 30, 2012 2:22 pm
by Argon » Wed Oct 24, 2012 8:08 pm
Alright, I purchased also one. Now 3 / 4 weeks waiting untill it arrieves...
Posts: 95
Joined: Thu Aug 25, 2011 11:04 am
by ski522 » Mon Oct 29, 2012 11:45 am
Okay, while the sound is vastly better than the on board sound, still not a 100%...maybe 95% happy. Decided now the best thing to do is just run digital to my home receiver and let it's DAC handle the conversion. So just threw down $14 to buy this guy http://www.aliexpress.com/store/product/PCM2704-USB-DAC-USB-Power-fiber-optic-coaxial-analog-output-sz-11/813037_654055749.html?tracelog=back_to_detail_a which should work with the PI.
Image

What is nice about this card is that it has TOS and Coax ports...should have it in 2 weeks.

On a different note, it seems that the PI's USB interface has serious problems, since adding the sound card I'm seeing a lot of issue with the PI dropping network connection. More can be found at this thread http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=12097&hilit=usb+elephant. I had to put in a script to automatically reboot the PI every time it loses network connectivity...seeing this message constantly in the log
smsc95xx 1-1.1:1.0: eth0: Failed to write register index 0x00000014

I admit I'm getting to the point of wishing I hadn't bought the PI and just got a Roku XD...my cost would have be less now at this point! But I have the PI so I'm going to see if I can make this thing a good audio media player while hoping not to throw much more money at it!
Posts: 389
Joined: Sun Sep 30, 2012 2:22 pm
by Fixnode » Wed Nov 07, 2012 8:14 pm
Hey

I ordered the same sound card that you have, it will arrive in the next few days. I wanted to ask if you found a reliable way to get good sound in XBMC? I want to use this solution for a Car-PC project and wanted to know if this sound card is good with XBMC sound drivers

Let me know,
Phillip K
Posts: 12
Joined: Mon Sep 24, 2012 5:23 am
by ski522 » Wed Nov 07, 2012 8:21 pm
You need to follow this thread to get XBMC to work with external sound cards
http://forum.stmlabs.com/showthread.php?tid=1052
Posts: 389
Joined: Sun Sep 30, 2012 2:22 pm
by computaholic » Fri Nov 09, 2012 10:06 am
For those who care about HiFi Performance: http://www.thomann.de/de/behringer_ucontrol_uca_202.htm
Posts: 4
Joined: Mon Jun 25, 2012 8:36 pm
by RaTTuS » Fri Nov 09, 2012 10:20 am
computaholic wrote:For those who care about HiFi Performance: ...

Use the HDMI device as it was intended ;-p
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX - Prosliver FTW
"That's not right, the badgers have moved the goalposts."
User avatar
Posts: 4167
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
by ski522 » Fri Nov 09, 2012 11:22 am
RaTTuS wrote:
computaholic wrote:For those who care about HiFi Performance: ...

Use the HDMI device as it was intended ;-p


I would if it wasn't hooked up to my TV...I don't want to have to turn on my 100W TV everytime I want listen to Pandora via my stereo receiver...kind of defeats the whole concept of a low powered device.
Posts: 389
Joined: Sun Sep 30, 2012 2:22 pm
by ski522 » Fri Nov 09, 2012 11:23 am
computaholic wrote:For those who care about HiFi Performance: http://www.thomann.de/de/behringer_ucontrol_uca_202.htm


Moot point if I'm planning on using the SPDIF/TOS connection and let my receiver, which has a high quality DAC, do the conversion. That card would would do the job if I wanted to run analog signals to my stereo instead.
Posts: 389
Joined: Sun Sep 30, 2012 2:22 pm
by speculatrix » Sat Nov 10, 2012 4:16 pm
That looks like quite a fat USB device. Does it block the other USB port?

And do you think it would be possible to drive a small 8ohm or 4ohm speaker directly from the headphone jack?
User avatar
Posts: 48
Joined: Thu Apr 05, 2012 8:29 am
Location: France
by redhawk » Sat Nov 10, 2012 5:21 pm
Most audio dongles are too chubby and would obstruct the other USB port so a cable extender is certainly a requirement.
As for audio output they're nice and loud for headphones but not so for speakers due to their lower impedance however still better than the PI on-board crap.

Richard S.
User avatar
Posts: 2951
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1
by speculatrix » Sun Nov 11, 2012 8:41 am
Thanks for the info. Probably not going to work for me, then.

I'm building a 'dawn clock' - actually an upgrade of a current one based on an Arduino and wave shield. I need to be able to play MP3s programmatically. I tried amplifying the headphone output with one of these mono amps, but it doesn't work (don't know why). No output at all (although I've checked the amp works with other sources). My needs are simple - mono will do. I just want to get the Pi's audio output to a small 8ohm speaker. Why should that be so hard? ;)
User avatar
Posts: 48
Joined: Thu Apr 05, 2012 8:29 am
Location: France
by ski522 » Sun Nov 11, 2012 1:42 pm
Okay got my new board in and it works great! Actually shipping from China wasn't so bad...ordered the Oct 29th, received it yesterday Nov 10th.

Image

No problems when testing SPDIF via the the coax and TOS connections. The sound quality is excellent and I can't tell the difference from my main HTPC which has a more expensive sound card...that horrendous popping noise you get on the Pi's analog output between songs is gone now running this board's SPDIF connections :D! I haven't tested the analog connection on the board, not something I actually need to use.

The only problem I have is dealing with the USB elephant issue (see post viewtopic.php?f=28&t=12097&hilit=elephant) to see what I'm talking about.

The USB issue rears its ugly head when I try to run CPU intensive apps like XBMC. Pianobar (Pandora Client) and playing rip FLAC CD's via mplayer doesn't cause problems. I hope they get the USB issues resolved soon, the PI will then make a pretty decent media server!

So anyone looking for great sound digitally and can't use the HDMI connection can't go wrong with this card, especially for $14! Next step is to figure out good way to mount it and/or find a small case to fit the card in.
Posts: 389
Joined: Sun Sep 30, 2012 2:22 pm
by zbicin » Tue Nov 13, 2012 8:19 pm
@ski522

Can you test the analog output, please? I'm really interested in the result :)
Posts: 7
Joined: Mon Jul 16, 2012 8:29 am
by Argon » Tue Nov 13, 2012 8:23 pm
+1 !
Posts: 95
Joined: Thu Aug 25, 2011 11:04 am
by Metatronin » Tue Nov 13, 2012 10:59 pm
I couldn't take the popping between songs with the onboard analog port any more.


You can get rid of this by matching the impediance between the rpi and your stereo receiver, that is if the receiver doesn't have this built in already. Usually takes a capacitor and resistor to ground, per channel. The Pi seems not to have any active impedance matching or any type of amplification.
Posts: 55
Joined: Sat Aug 04, 2012 5:19 am
by ski522 » Tue Nov 13, 2012 11:22 pm
zbicin wrote:@ski522

Can you test the analog output, please? I'm really interested in the result :)

Okay, took a few minutes to test the analog port...this card is a winner! The sound is excellent out of the analog port, almost as good at the digital PCM out of the SPDIF connection. It was actually so good that I thought my stereo was masking/improving the analog output, so I plugged in a decent pair of headphones into the card to make sure and music through the headphones was excellent as well! Can't hear any background hiss during quiet moments in songs and no popping at all between songs...everything from ripped FLAC to Pandora sounded great!

The DAC on this board is based on TI's PCM2704 which seems to get decent reviews in general. More info on the chip can be found http://www.ti.com/product/pcm2704c.

As a side note, the dimensions for the card are wrong on the web link I provided, it's actually smaller than what's listed being 5.4cm x 5cm (L x W), next step is finding a decent way of mounting or enclosing the board.
Posts: 389
Joined: Sun Sep 30, 2012 2:22 pm
by ski522 » Tue Nov 13, 2012 11:29 pm
Metatronin wrote:
I couldn't take the popping between songs with the onboard analog port any more.


You can get rid of this by matching the impediance between the rpi and your stereo receiver, that is if the receiver doesn't have this built in already. Usually takes a capacitor and resistor to ground, per channel. The Pi seems not to have any active impedance matching or any type of amplification.


I believe the problem occurs within the audio driver itself when it initializes/de-initializes between songs and not so much a impedance problem IMHO. I actually found a way around the popping for the onboard analog port by install pulseaudio. Pulseaudio keeps the sound driver active all the times so the popping between songs disappears. The only thing I didn't like about pulse was that there was about 300ms delay between the start of a playing a song to actually hearing the music.

At the end of the day, I'd rather let my stereo do the conversion to analog using it's DAC, so the $14 I spent on this board was well worth it!
Posts: 389
Joined: Sun Sep 30, 2012 2:22 pm
by Argon » Tue Nov 13, 2012 11:35 pm
Is the front of the dac a normal usb connector? I don't see this on the picture.
Posts: 95
Joined: Thu Aug 25, 2011 11:04 am
by ski522 » Tue Nov 13, 2012 11:46 pm
Argon wrote:Is the front of the dac a normal usb connector? I don't see this on the picture.

No, it's a type B adaptor. The link I provided on the DAC shows additional pics.

Image

Also for new readers, my original post was regarding an el-cheapo card that plugged into the USB port of the PI. It was okay, but I didn't really like the card and my last few post are regarding this card I got at http://www.aliexpress.com/store/product ... o_detail_a

Image
Posts: 389
Joined: Sun Sep 30, 2012 2:22 pm
by Metatronin » Tue Nov 13, 2012 11:55 pm
Wierd. Why would the sound not always be on? I'm just asking because I have never had this problem as of yet. Maybe my stereo is masking it with some type of "electrical thump" protection on the inputs? I don't hear it through my DIY headphone amp either.
Posts: 55
Joined: Sat Aug 04, 2012 5:19 am