Bass
Posts: 12
Joined: Tue Feb 21, 2012 7:21 am

USB audio distortion

Wed May 30, 2012 6:11 pm

Okay. So far:

I got the sound from the internal 3.5mm working. But I was really disappointed with the quality.... My old walkman did sound better in the 80's..

So I went and bought a http://www.terratec.net/en/products/Aur ... _9842.html
Problem is, when using "mpg123" the sound is _really_ distorted, sounds really crappy. (Both analog and optical digital).

If I try to use mplayer, the pi crashes.

But! If I use mplayer like this, it works like a charm, great sound quality:
mplayer -ao alsa:device=hw=0.0 abc.mp3



But, I don't want to use mplayer.
So the question is, how do I permanently fix this?
I guess there's some kind of issue with the alsa sound module, the usb sound module, or something similar....

Im on the latest firmware, and have tried the 3.2.18-rpi1+ kernel from bootc.net...

Bass
Posts: 12
Joined: Tue Feb 21, 2012 7:21 am

Re: USB audio distortion

Wed May 30, 2012 8:12 pm

Started to read up about Alsa and the solution was really easy (as it usually is).

1. Create/edit file /etc/asound.conf
2. Add:

Code: Select all

pcm.!default {
        type hw
        card 0
}

ctl.!default {
        type hw
        card 0
}
3. sudo /etc/init.d/alsa-utils restart (or reboot)

Now audio from shairport, mpg123 and XBMC works great.

I have had 1 kernel panic so far tho... Seems I cant have it all... yet.... :P

darkcity
Posts: 66
Joined: Wed Aug 03, 2011 3:01 pm
Contact: Website

Re: USB audio distortion

Wed Jun 06, 2012 1:41 pm

Thanks for posting solution :P

User avatar
ScoobyDoo
Posts: 111
Joined: Wed Apr 04, 2012 2:52 pm
Location: Staffordshire, UK

Re: USB audio distortion

Wed Jun 06, 2012 7:35 pm

Is this USB sound card working ok in openelec xbmc?
I need to get optical sound to my home cinema amp.

Does it run ok directly plugged into the pi?

medge
Posts: 2
Joined: Sat Jun 09, 2012 1:47 pm

Re: USB audio distortion

Sat Jun 09, 2012 2:27 pm

Hi Bass,
In the very first post you said:
Bass wrote:Okay. So far:

I got the sound from the internal 3.5mm working. But I was really disappointed with the quality.... My old walkman did sound better in the 80's..
How did you even do this? This is driving me mad :x
Mark Edgeworth

Bass
Posts: 12
Joined: Tue Feb 21, 2012 7:21 am

Re: USB audio distortion

Tue Jun 12, 2012 7:18 am

ScoobyDoo wrote:Is this USB sound card working ok in openelec xbmc?
I need to get optical sound to my home cinema amp.

Does it run ok directly plugged into the pi?
It uses the usb-sound module which worked out of the box in Debian with the latest 'firmware', and with the config file added the sound is clear.
I have only used it for stereo sound so far, and have not had the time to test it with XBMC yet, sorry, will do that asap.
I will also provide a syslog when connecting the USB-stick asap.
medge wrote:Hi Bass,
In the very first post you said:
Bass wrote:Okay. So far:

I got the sound from the internal 3.5mm working. But I was really disappointed with the quality.... My old walkman did sound better in the 80's..
How did you even do this? This is driving me mad :x
You need to load the sound kernel module and also force the sound to be outputted thru the 3.5mm jack if you use HDMI since it seem to default to that (would be great if it could output HDMI+3.5mm simultaneous but I have no idea if thats possible?).
  • 1. Update to the latest "firmware", reboot
  • 2. Load the module:

    Code: Select all

    sudo modprobe snd_bcm2835
  • 3. Switch output to the 3.5 mm jack:

    Code: Select all

    sudo amixer cset numid=3 1
The last digit works as this if I recall correctly:
0 - auto
1 - 3,5mm
2 - hdmi

If you cannot use the "amixer" tool, you need to install the alsa-tools thru apt/package-manager.

jetblackstar
Posts: 4
Joined: Wed Jul 18, 2012 10:56 pm

Re: USB audio distortion

Thu Jul 19, 2012 1:47 am

Just as a tip of the hat for posting the solution with asound.conf and the type=hw settings.

Got my Portable DAC AMP working Very smoothly.
I'm super grinning happy now :)

as a tip for others, for some reason my USB sound card was on card=1 not 0.
Can be discovered quickly with aplay -l to list your sound devices.

ihapenciuc
Posts: 7
Joined: Fri Jul 06, 2012 2:07 pm

Re: USB audio distortion

Tue Jul 31, 2012 2:56 pm

Dear raspberry fans,

I am trying to get sound out on my extremely cheap USB to audio.
I did followed your instruction but in the end when to play I get:
"
[email protected]:~/cam2bmp$ aplay test.wav
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
aplay: set_params:1087: Channels count non available
"
Please help.

my sound chip is some "Genius G-Talk" if you heard of it.

while tring aplay -l I get:
"
[email protected]:~/cam2bmp$ aplay -l
**** 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: Device [Generic USB Audio Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
"

And I did modified the asound.conf accordingly by replacing 0 with 1 for both "pcm" and "ctl"
AlasaMixer does see the card.

I would be very great full for any help

Andrei

newmiracle
Posts: 5
Joined: Thu Jun 07, 2012 2:51 am

Re: USB audio distortion

Tue Sep 25, 2012 3:20 am

I get the same problem as ihapenciuc. However, to make things more interesting...

I was trying to get my USB sound card to work so I could use a program called Puredata. I followed this guide (and others) and came to the same issue ihapenciuc has. But that's only when I test the sound via the command line. When I try to test audio, it works. There are some crackles, and I get error messages in the command line. But the test tones play.

So yeah, I'm at the end of my rope with USB audio. I'm going to be downloading the newest Raspbian, and hopefully that will help somewhat due to the USB fixes.

Can anyone point to a definitive, easy to understand guide for USB audio on the Pi?

mrraspberrypi
Posts: 10
Joined: Tue Sep 25, 2012 2:37 am

Re: USB audio distortion

Thu Oct 11, 2012 12:47 am

Anyone managed to get the usb audio working and successfully recording sound from a microphone? If so, how?

oloftangrot
Posts: 6
Joined: Mon Jul 23, 2012 9:18 pm

Re: USB audio distortion

Wed Jan 30, 2013 9:56 pm

Try something like:

aplay -D plughw:1,0 test.wav

plughw will fixed playing the mono file for me.

nconco
Posts: 1
Joined: Fri Apr 12, 2013 4:59 pm

Re: USB audio distortion

Fri Apr 12, 2013 5:07 pm

aplay -D hw:1,0 -r 96000 /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: set_params:1087: Channels count non available


It doesn't work for me either but this does:
speaker-test -c2 -D hw:1,0

I needed to mute then unmute the master volume is alsamixer for my USB soundcard.

So from speaker test I know I can access the soundcard and play white noise left and right speaker in turn but I can't get aplay to play a file. It works through the internal soundcard but not the USB soundcard

Odd! Any ideas?

Neil

hongangcn
Posts: 1
Joined: Sun May 19, 2013 6:17 am

Re: USB audio distortion

Sun May 19, 2013 6:26 am

It does not work with this kind of configuration.
pcm.!default {
type hw
card 0
channels 1
}
ctl.!default {
type hw
card 0
channels 1
}

The following two methods works after I verified with my Pi.

1. "aplay -D plughw:0,0 xxx.wav" rather than "aplay -D hw:0,0 xxx.wav"
2. "aplay -D sysdefault:CARD=Set xxx.wav" , Set is my USB sound card.

cweiske
Posts: 1
Joined: Tue Jan 30, 2018 9:58 pm

Re: USB audio distortion

Wed Jan 31, 2018 5:14 am

I did the following to make the USB soundcard default and get it work with mono audio on Debian 9 (/etc/asound.conf):

Code: Select all

pcm.!default {
  type plug
  slave {
    pcm "hw:1,0"
  }
}
ctl.!default {
  type hw
  card 1
}

Return to “Graphics, sound and multimedia”