You are not logged in.

#1 2011-08-22 23:17:38

helmut
Member
Registered: 2008-10-10
Posts: 65

[SOLVED] sound not working

I have installed arch linux on my laptop. Up to now I have been unable to get the sound working.

Running speaker-test I get:
> ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
> Playback open error: -2,No such file or directory

lspci yields
> 00:01.1 Audio device: ATI Technologies Inc Device 1314


From "lsmod | grep snd" I get the information that the relevant drivers seem to be installed

> snd_hda_codec_conexant    38797  1
> snd_hda_codec_hdmi     20068  1
> snd_hda_intel          19101  4
> snd_hda_codec          66954  3 snd_hda_codec_conexant,snd_hda_codec_hdmi,snd_hda_intel
> snd_hwdep               4942  1 snd_hda_codec
> snd_pcm                60015  3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec
> snd_timer              15374  1 snd_pcm
> snd                    43593  15
> snd_hda_codec_conexant,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer
> soundcore               4986  1 snd
> snd_page_alloc          5869  2 snd_hda_intel,snd_pcm

I have no conf files for alsa, neither in /etc nor in my home directory.

Any idea?

Thanks
Helmut

Last edited by helmut (2011-08-25 03:36:29)

Offline

#2 2011-08-23 00:34:28

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: [SOLVED] sound not working

Please make sure your system is up to date, and post the output of
# ls -la /dev/snd/
and
# aplay -l
for a start, maybe that will tell us what's up :-)

Offline

#3 2011-08-23 01:09:03

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] sound not working

Show what has sound open:

fuser -fv /dev/snd/* /dev/dsp*

Failing that, show a lot of useful info:

wget -O alsa-info.sh http://www.alsa-project.org/alsa-info.sh
bash alsa-info.sh --upload

Then show us the URL that the script shows at the end.

Last edited by brebs (2011-08-23 01:10:44)

Offline

#4 2011-08-23 13:07:18

helmut
Member
Registered: 2008-10-10
Posts: 65

Re: [SOLVED] sound not working

#ls -la /dev/snd/

drwxr-xr-x   3 root root      240 Aug 23 18:23 .
drwxr-xr-x  16 root root     5280 Aug 23 18:23 ..
drwxr-xr-x   2 root root       80 Aug 23 18:23 by-path
crw-rw----+  1 root audio 116,  4 Aug 23 18:23 controlC0
crw-rw----+  1 root audio 116,  8 Aug 23 18:23 controlC1
crw-rw----+  1 root audio 116,  3 Aug 23 18:23 hwC0D0
crw-rw----+  1 root audio 116,  7 Aug 23 18:23 hwC1D0
crw-rw----+  1 root audio 116,  2 Aug 23 18:23 pcmC0D3p
crw-rw----+  1 root audio 116,  6 Aug 23 18:23 pcmC1D0c
crw-rw----+  1 root audio 116,  5 Aug 23 18:23 pcmC1D0p
crw-rw----   1 root audio 116,  1 Aug 23 18:23 seq
crw-rw----+  1 root audio 116, 33 Aug 23 18:23 timer

#aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 0: CONEXANT Analog [CONEXANT Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

#fuser -fv /dev/snd/* /dev/dsp/*
Cannot stat /dev/dsp/*: Bad address
                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  helena     1151 F.... xfce4-mixer-plu
/dev/snd/controlC1:  helena     1151 F.... xfce4-mixer-plu


#ls -la /dev/snd/*
crw-rw----+ 1 root audio 116,  4 Aug 23 18:23 /dev/snd/controlC0
crw-rw----+ 1 root audio 116,  8 Aug 23 18:23 /dev/snd/controlC1
crw-rw----+ 1 root audio 116,  3 Aug 23 18:23 /dev/snd/hwC0D0
crw-rw----+ 1 root audio 116,  7 Aug 23 18:23 /dev/snd/hwC1D0
crw-rw----+ 1 root audio 116,  2 Aug 23 18:23 /dev/snd/pcmC0D3p
crw-rw----+ 1 root audio 116,  6 Aug 23 18:23 /dev/snd/pcmC1D0c
crw-rw----+ 1 root audio 116,  5 Aug 23 18:23 /dev/snd/pcmC1D0p
crw-rw----  1 root audio 116,  1 Aug 23 18:23 /dev/snd/seq
crw-rw----+ 1 root audio 116, 33 Aug 23 18:23 /dev/snd/timer

/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root  80 Aug 23 18:23 .
drwxr-xr-x 3 root root 240 Aug 23 18:23 ..
lrwxrwxrwx 1 root root  12 Aug 23 18:23 pci-0000:00:01.1 -> ../controlC0
lrwxrwxrwx 1 root root  12 Aug 23 18:23 pci-0000:00:14.2 -> ../controlC1

bash alsa-info.sh --upload
http://www.alsa-project.org/db/?f=04f85 … f95bfb5959

Offline

#5 2011-08-23 14:19:22

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] sound not working

Remove the XFCE Mixer applet - it is presumably locking the soundcard.

Offline

#6 2011-08-23 14:22:34

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: [SOLVED] sound not working

Are you in the "audio" group? This is not necessary in Gnome/KDE where ConsoleKit will give you the right perms, but I don'tk now about XFCE.

Offline

#7 2011-08-23 14:29:53

helmut
Member
Registered: 2008-10-10
Posts: 65

Re: [SOLVED] sound not working

Removing the xfce mixer applet does not change anything.

Yes, I am in the audio group.

Offline

#8 2011-08-23 14:41:09

helmut
Member
Registered: 2008-10-10
Posts: 65

Re: [SOLVED] sound not working

The problem is certainly not connected with the desktop. Even if I don't start the graphical desktop xfce and just login as root in a tty, I get a failed "speaker-test" as described above.

Offline

#9 2011-08-23 15:48:43

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [SOLVED] sound not working

helmut, please do not post in such quick succession. Use the "Edit" button instead.


To know or not to know ...
... the questions remain forever.

Offline

#10 2011-08-23 22:49:36

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: [SOLVED] sound not working

Give  "speaker-test -c 2 -D plughw:1"  a try.

Offline

#11 2011-08-23 23:01:17

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED] sound not working

See thread:

options snd-hda-intel model=,asus

I've never seen a comma there before, but that's what they say...

Offline

#12 2011-08-23 23:50:47

helmut
Member
Registered: 2008-10-10
Posts: 65

Re: [SOLVED] sound not working

"speaker-test -c 2 -D plughw:1" gives a result. The Front Left speaker sounds, the Front Right speaker not.

Changing "plughw:1" to "plughw:0" or "plughw:2" gives
:1
> Playback open error: -2,No such file or directory
:2
>ALSA lib pcm_hw.c:1401:(_snd_pcm_hw_open) Invalid value for card
>Playback open error: -2,No such file or directory

I don't understand what "plughw:1" stands for, because a cannot find a device with that name in "/dev/snd".

Offline

#13 2011-08-24 07:23:18

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: [SOLVED] sound not working

Welcome to the confusing and poorly documented world of ALSA wink

First of all, ALSA thinks that your laptop has 2 sound cards; and will act accordingly. You already showed the cards in the output of "aplay -l"...

#aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 0: CONEXANT Analog [CONEXANT Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

In your case, Card 0 is connected to your HDMI port and Card 1 is connected to your speakers (and any sound jacks). If you ran "arecord -l", you'll see that if you wanted to record sound, you'll need to use Card 1.

When you simply entered "speaker-test", you were (trying to) pump audio to your HDMI port (Card 0).

When you use a sound application that "talks" directly to ALSA (like speaker-test, aplay, arecord, and even audacious and many others do), you'll either need to tell the application which card (and maybe subdevice) to use, or it will use the "default" one.

In the ALSA world, one way to do this by using the following format:

hw:<card number>,<subdevice>

where the "card number" obviously comes from the info above; and "subdevice" would be a subsection of that sound card (if any), such as any optical digital outputs verses any analog outputs that may be on the card.

For example, "hw:0,1"

If there is no "subdevice", or you want "subdevice 0", the format is simply "hw:<Card Number>".

For example, "hw:1"

BUT... when you use this "hw:" type of format, the application is going to take the sound file and send it directly to your sound card. If the audio file was recorded in 2 channels, 24 bits, 192000 samples per second and your sound card hardware can't handle that, then ALSA and the application will barf.

BUT... if prepend the word "plug" in front of that format (example: "plughw:1") then you're telling ALSA to dither and/or resample the audio file to something that your sound card hardware can handle. No more error.

SO... if you had read the "speaker-test" man page, you'd see some of this stuff being used in the "USAGE EXAMPLES" section wink There's also a somewhat better explaination than mine on one of ALSA's old FAQ pages:

http://alsa.opensrc.org/FAQ022

It's possible to swap the "Card 0" and "Card 1" designations on your laptop, and/or also set a "default" ALSA device, but that's beyond the scope of this lesson (it's very late here).

All this (and more) confusing stuff is what programs like Pulseaudio are trying to shield you from, but IMO, they only create a whole new set of problems.

Last edited by pigiron (2011-08-24 07:50:09)

Offline

#14 2011-08-24 14:37:55

helmut
Member
Registered: 2008-10-10
Posts: 65

Re: [SOLVED] sound not working

@Pigiron: Thanks for the explanation. Now I begin to understand a little bit.

If I understand you correctly, then my alsa configuration does use hw:0 as a default, but the speakers and the mic are driven by hw:1. Obviously I need an asound.conf file, in order to change that setting. I have already read the asound.conf description. But I have not yet found a way to set the default device (i.e. how to set the parameters). Can you give me some hint to that topic as well? Thanks in advance.

Last edited by helmut (2011-08-24 14:38:32)

Offline

#15 2011-08-25 02:04:19

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: [SOLVED] sound not working

Glad to help.

As usual, the Arch Wiki does has a decent (but terse) method to setting sound card info...

https://wiki.archlinux.org/index.php/Ad … sound_card

I'll only add a tiny bit to that.

Basically, in order to change the sound card designations (Card 0 <-> Card 1) you need to set it in the module (or kernel) parameters. Also, I've had the card numbers swap on me between boots, so I've been forced to add these parameters in some cases. But this may not happen to you. I've never tried the "slots" parameter used in the wiki, instead I used the "index" parameter for my individual sound modules. But hey, whatever works!

Next, a little more info about the config file(s). The ALSA configuration files use a strange sort of object oriented structure. A whole book can probably be written on this subject, so I'll only talk a tiny bit about the "default" stuff. Super basically, if you put the "!default" keyword on a structure, you're telling ALSA that this is the "default" device. Obviously, you should do this only once for a device type. What happens is that most, if not all, ALSA sound applications will check if you passed in a specific device that you want to use. If not, then the application will (usually) literally open the "default" ALSA device.

For example, if your config file looked like this:

pcm.!default {
    type hw
    card 1
}

ctl.!default {
    type hw
    card 1
}

then Card 1 would be your default sound device and your default control device.

For some more info, try these out:

http://alsa.opensrc.org/FAQ026
http://alsa.opensrc.org/.asoundrc

Hope this helps.

Offline

#16 2011-08-25 03:30:16

helmut
Member
Registered: 2008-10-10
Posts: 65

Re: [SOLVED] sound not working

Thanks for the hint. I have tried that. At first it didn't work. But after a reboot, the sound card worked well.

You helped me a lot to solve that problem and thanks for the "lesson".

Offline

Board footer

Powered by FluxBB