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


144 posts   Page 2 of 6   1, 2, 3, 4, 5, 6
by zbicin » Wed Nov 14, 2012 11:05 am
@ski522

Thanks a lot, hope it'll do the work in my case :)
Posts: 7
Joined: Mon Jul 16, 2012 8:29 am
by ski522 » Wed Nov 14, 2012 12:32 pm
Metatronin wrote: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.


Strange, common problem with the board on the analog port unless it's been resolved with recent fixes.
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm
by 44922035 » Fri Nov 16, 2012 6:41 am
I have the black version of the SB Virtual 7.1 Channel Sound Adapter, with the volume buttons, etc.

I followed ski522's posts.

However:
Code: Select all
root@raspberrypi:~# play test.wav
ALSA lib dlmisc.c:254:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_rate_samplerate.so
ALSA lib pcm_rate.c:1399:(snd_pcm_rate_open) Cannot find rate converter
Posts: 8
Joined: Fri Nov 16, 2012 6:34 am
by ski522 » Fri Nov 16, 2012 9:44 am
44922035 wrote:I have the black version of the SB Virtual 7.1 Channel Sound Adapter, with the volume buttons, etc.

I followed ski522's posts.

However:
Code: Select all
root@raspberrypi:~# play test.wav
ALSA lib dlmisc.c:254:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_rate_samplerate.so
ALSA lib pcm_rate.c:1399:(snd_pcm_rate_open) Cannot find rate converter


Sounds like you're missing some files try
Code: Select all
sudo apt-get install libasound2-plugins
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm
by tescione » Fri Nov 16, 2012 1:26 pm
Hi Newby question here,
I have no other way to connect the HDMI to my receiver so I'm thought I was stuck to the analog audio. But like the TS mentioned: the popping-sound is terrible.

So if I buy this card from alienexpress, It's a matter of plug&play, or does it need configuration?
Posts: 2
Joined: Fri Nov 16, 2012 1:21 pm
by ski522 » Fri Nov 16, 2012 3:27 pm
Both are plug and play. Personally I wasn't a fan the initial el-cheapo USB sound stick I bought...it was okay, but I could hear hissing in the background when I cranked the tunes. but the PCM2704 USB DAC board I bought afterwards can't be beat...sounds great and no horrendous popping between songs.

You can also try installing pulseaudio, it got rid of most of the pops for me with the onboard analog port, I just didn't like the delay it added while play initially staring music...it was fine once it was playing unless you purposely skipped to the next song, then you'd get the delay again.
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm
by ski522 » Fri Nov 16, 2012 3:31 pm
tescione wrote:So if I buy this card from alienexpress, It's a matter of plug&play, or does it need configuration?


Notice the board is being sold on ebay too, not sure if it'd be a faster deliver this way, also found one that includes a nice case (no Toslink though). I haven't be able to source that case yet to buy for my board.

http://www.ebay.com/itm/PCM2704-USB-DAC ... 2c6899a580

http://www.ebay.com/itm/PCM2704-USB-DAC ... 2ec37eaa4c
Image
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm
by 44922035 » Fri Nov 16, 2012 5:49 pm
ski522 wrote:Sounds like you're missing some files try
Code: Select all
sudo apt-get install libasound2-plugins


Thanks, that fixed the sample rate problem. However it lead me to yet another head banger:
Code: Select all
root@raspberrypi:~# aplay test.wav
Playing WAVE 'ouch.wav' : Unsigned 8 bit, Rate 22050 Hz, Mono
aplay: set_params:1081: Sample format non available
Available formats:
- S16_LE
root@raspberrypi:~# arecord 3.wav
Recording WAVE '3.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
ALSA lib pcm_params.c:2162:(snd1_pcm_hw_refine_slave) Slave PCM not usable
arecord: set_params:1059: Broken configuration for this PCM: no configurations available
Posts: 8
Joined: Fri Nov 16, 2012 6:34 am
by ski522 » Sat Nov 17, 2012 11:26 am
Alsa can sometimes be a pain, the recording rate 8000Hz you chose for arecord is probably not supported by the card. Also you can try this .asound config in home directory.

sudo nano ~./.asoundrc

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:1,0"
                rate 48000
                periods 128
                period_time 0
                period_size 1024 # must be power of 2
                buffer_size 65536

            }
    }

No promises though if it doesn't work.
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm
by tescione » Sat Nov 17, 2012 4:41 pm
Notice the board is being sold on ebay too, not sure if it'd be a faster deliver this way, also found one that includes a nice case (no Toslink though). I haven't be able to source that case yet to buy for my board.

http://www.ebay.com/itm/PCM2704-USB-DAC ... 2c6899a580

http://www.ebay.com/itm/PCM2704-USB-DAC ... 2ec37eaa4c
Image


Thanks for your answer, I need the toslink though (edit, I also have coaxial :) ). Last question: does the usb from the raspberry power it or do I need another adapter?
Posts: 2
Joined: Fri Nov 16, 2012 1:21 pm
by ski522 » Sat Nov 17, 2012 10:18 pm
Powered from the PI, no external power required.
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm
by Mister Fab » Fri Nov 23, 2012 7:33 am
I've just read this topic, it seems that little usb card can solve my problems.

Can anyone tell me if it supports both DTS and Dolby digital passthrough from hd videos?
Posts: 16
Joined: Mon Aug 06, 2012 7:20 am
Location: France - Toulouse
by aidankk » Fri Nov 23, 2012 9:33 am
Hi,

I setup Squeezeplug on the PI and bought one of these Ubs Dacs Image along with a ta2020 chip amp and to my ear it sounds amazing, driving some old Technics Hi-Fi Speakers.

Thanks to this forum for making it possible, with the various good advise
Posts: 1
Joined: Fri Nov 23, 2012 9:29 am
by milhouse » Fri Nov 23, 2012 12:34 pm
aidankk wrote:Hi,

I setup Squeezeplug on the PI and bought one of these Ubs Dacs Image along with a ta2020 chip amp and to my ear it sounds amazing, driving some old Technics Hi-Fi Speakers.


FiiO D5, available on Amazon for £20. Shame it's got no optical out, but it certainly resolves the casing issue... some reviews here, and a more detailed review here. Headphone out has a lot of hiss (which seems to be what a lot of people use it for), but I presume the digital out is satisfactory.
Posts: 555
Joined: Mon Jan 16, 2012 12:59 pm
by ski522 » Fri Nov 23, 2012 1:48 pm
Mister Fab wrote:I've just read this topic, it seems that little usb card can solve my problems.

Can anyone tell me if it supports both DTS and Dolby digital passthrough from hd videos?


It should, but unfortunately I'm being bitten by the USB bug when trying to run omxplayer to test the passthrough. But if you're using the TOS or Digital COAX port then you're essentially just passing the PCM audio through to you receiver and it shouldn't matter whether the PCM stream is a 2.1 or 5.1 stream.
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm
by Peachmeister » Sat Nov 24, 2012 1:32 am
Does the spdif / optical output output full 5.1 surround or only stereo?

I am wanting to watch dvd rips and bd rips with xbmc but my av amp doesnt have hdmi so i cant get the audio from there and my tv obviously. Doesnt decode dolby / dts so my only choice is to use a digi out from a souncard straight to the amp and let the hdmi carry the video to my screen.
Posts: 14
Joined: Wed Nov 21, 2012 1:31 am
Location: Manchester, UK
by ski522 » Sat Nov 24, 2012 11:19 am
Peachmeister wrote:Does the spdif / optical output output full 5.1 surround or only stereo?

It outputs a digital stream whether 2.1 or 5.1 and then your stereo's DAC converts the digital stream into analog sound. So whatever the source material is, that's how the sound is going to be outputted.
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm
by Peachmeister » Sat Nov 24, 2012 11:31 am
But not the HD formats, True HD and DTS-MA if what I read is right???

Or did I misunderstand?
Posts: 14
Joined: Wed Nov 21, 2012 1:31 am
Location: Manchester, UK
by ski522 » Sat Nov 24, 2012 12:03 pm
Correct, those signals are only transmitted via HDMI.
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm
by s7mx1 » Sat Nov 24, 2012 1:51 pm
PulseAudio will work better in most cases than alsa as it has much better plug and play support. You can easily swap sound card with pulseaudio without worrying updating configuration files etc. Digital Audio output and passthrough is only one command away and best of all you can monitor/configure pulseaudio using any linux PC.

See step one in this post
http://forum.stmlabs.com/showthread.php ... 34#pid9134

If you want to try usb soundcard with xbmc try this update here
http://forum.stmlabs.com/showthread.php ... 4#pid36764
Posts: 79
Joined: Fri Sep 30, 2011 9:28 am
by speculatrix » Wed Dec 05, 2012 6:15 pm
Okay, so I got one of the same USB sound cards you got. It seems to be recognised by the system. But I can't get anything to play through it using command-line tools. I have the RPi in a box running as a headless server and one of the things it does is play music as an alarm clock, so I need to play tunes programmatically. I've been using mpg123 but am also experimenting with aplay.

The output of 'aplay -l' is:
Code: Select all
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 1: DAC [USB Audio DAC], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

And the output of 'aplay -L' is:
Code: Select all
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
sysdefault:CARD=DAC
    USB Audio DAC, USB Audio
    Default Audio Device
front:CARD=DAC,DEV=0
    USB Audio DAC, USB Audio
    Front speakers
surround40:CARD=DAC,DEV=0
    USB Audio DAC, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=DAC,DEV=0
    USB Audio DAC, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=DAC,DEV=0
    USB Audio DAC, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=DAC,DEV=0
    USB Audio DAC, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=DAC,DEV=0
    USB Audio DAC, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=DAC,DEV=0
    USB Audio DAC, USB Audio
    IEC958 (S/PDIF) Digital Audio Output

So it looks to me like the card has been found. I've tried specifying which output device to use for playback with the 'aplay -D <PCM_devicename>' and 'mpg123 -a <device>' options but can't find any values to put in there that work. Anybody have any ideas?
User avatar
Posts: 48
Joined: Thu Apr 05, 2012 8:29 am
Location: France
by ski522 » Wed Dec 05, 2012 6:58 pm
Your USB sound card is registering as device 1, you want to change that to device 0.

sudo nano /etc/modprobe.d/alsa-base.conf

find the line "options snd-usb-audio" and change it to:
Code: Select all
options snd-usb-audio index=0 nrpacks=1

reboot your pi and try it again. running aplay -l should now show your USB sound card similar too:
Code: Select all
card 0: DAC [USB Audio DAC], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm
by speculatrix » Wed Dec 05, 2012 7:41 pm
That sorted it - thanks!
User avatar
Posts: 48
Joined: Thu Apr 05, 2012 8:29 am
Location: France
by G_P » Thu Dec 06, 2012 6:30 pm
After I did proposed modification, seems USB ports stops to work (USB keyboard not responding). Also no connection via ssh stops to work as well.

Any ideas?
I want to check if that helps to remove click=post-noise when playing sound via USB DAC.


Initial file
Code: Select all
cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Modyfied file
Code: Select all
dwc_otg.speed=1 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
Posts: 2
Joined: Wed Dec 05, 2012 2:46 pm
by ski522 » Thu Dec 06, 2012 7:14 pm
dwc_otg.speed=1 just puts the USB port in 1.1 mode, but shouldn't have affected your keyboard. It's possible you seeing issues related to the USB driver on the PI. I suggest review this post viewtopic.php?f=28&t=23544&hilit=redux
Posts: 394
Joined: Sun Sep 30, 2012 2:22 pm