Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ALSA - no sound? Then read this.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
JoeD
n00b
n00b


Joined: 21 Nov 2005
Posts: 5

PostPosted: Mon Nov 21, 2005 7:34 pm    Post subject: ALSA - no sound? Then read this. Reply with quote

Hey everybody, I struggled so much with alsa that I want to document my findings to help other people not to get mad (like I did).
Alsa was never really stable for me but after upgrading to 2.6.14-r2 it stopped working all together (= I don't hear sound).

Usually configuring alsa should be easy:
- install the drivers
- run alsaconf
- run alsamixer to unmute the channels
Voila! This should setup everything and for a lot of people it does. Well, not for me.

To get it working look at 3 parts that are necessary to produce something on your speakers: kernel, /dev, mixer.

Check the kernel:
If you use modules (kernel or alsa-driver) check if the modules are loaded (run lsmod) and check for snd_* modules it they are there that's good.
The ultimate check is to look in /proc/asound. This directory get's created when alsa gets initialized in the kernel. For example /proc/asound/version should give you your alsa driver level.
If you see /proc/asound alsa is setup and ready to go in the kernel!
(but I still had no sound)

Check /dev:
No matter if you use devfs or udev -
you should have a /dev/snd directory which are the devices for alsa
you should have a /dev/sound directory which is the OSS emulation of alsa only if you chose to set it up (in the driver config).
Check that the file permissions on those devices are read/write for your user (check user and group permissions)
You can check if the oss emulation is working by "cat /dev/urandom > /dev/dsp", this should produce noise. (for me it didn't)

Now the most delicate thing: The Mixer.
I think that most of the problems I read about in the forum are caused by the mixer. To make it work right do this as root:
- delete /etc/asound.state (remove mixer settings file)
- run "alsamixer"
-- unmute the necessary levers (master...) (if they are muted)
-- mute/umute all levers
-- increase/decrease all levers
-- exit alsamixer
- run "alsactl store"
- restart alsa: "/etc/init.d/alsasound restart"
(sometimes by upgrading alsa the mixer file contains invalid data for the new driver and this procedure should set it streight)

Well, I did all that and still didn't hear anything!
I had to run alsamixer and mute the sensor switches (headphone and line)
That fixed it for me!
ENJOY!
ciao
Joe
Back to top
View user's profile Send private message
Vortex375
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1739
Location: Deutschland

PostPosted: Mon Nov 21, 2005 7:54 pm    Post subject: Reply with quote

Quote:
-- unmute the necessary levers (master...) (if they are muted)
-- mute/umute all levers
-- increase/decrease all levers


That shouldn't be necessary.
Delete /etc/asound.state, restart alsa, then unmute the correct channels with alsamixer and run alsactl store. You should be all set!

Quote:
I had to run alsamixer and mute the sensor switches (headphone and line)


There are a lot of nasty traps set up inside the mixer and they are different for every card. I guess it's some kind of sick competition (to check you mixer skillz). :D :D


Nice (but short) troubleshooting guide, but isn't all this already described in the alsa-guide? :)
Back to top
View user's profile Send private message
JoeD
n00b
n00b


Joined: 21 Nov 2005
Posts: 5

PostPosted: Mon Nov 21, 2005 8:53 pm    Post subject: Reply with quote

yes, most of it is documented in the alsa guide. I read it but still couldn't get it to work. So, I wrote a little summary on how I got it working. Especially identifying where your problem is is a challenge. The most important thing is the mixer, I saw a lot of posts that I think are related to the mixer and this procedure is not documented. I just posted this to give others a little indication on where to look and then setup the mixer correctly.
If you think it's not necessary the moderator might remove this post.
ciao
Joe
Back to top
View user's profile Send private message
P.Kosunen
Guru
Guru


Joined: 21 Nov 2005
Posts: 309
Location: Finland

PostPosted: Tue Nov 22, 2005 12:47 pm    Post subject: Reply with quote

I still can't get sound from Asus K8V SE Deluxe motherboards VIA 8237/Analog Devices AD1980 integrated chip. Everything looks good, but no sound from optical spdif. I can see the red light from fiber when computer is on.

/etc/modules.d/alsa
options snd-via82xx dxs_support=4

I have also tried different dxs_support options in /etc/modules.d/alsa.

http://personal.inet.fi/surf/pkosunen/vdr/sound.debug.txt

If anyone have working spdif with same chip please post some info.
Back to top
View user's profile Send private message
VoVaN
l33t
l33t


Joined: 02 Jul 2003
Posts: 671
Location: The Netherlands

PostPosted: Tue Nov 22, 2005 1:34 pm    Post subject: Reply with quote

You can use this general script, it helps in 99% of all cases (you even can adjust it and run during startup):
Code:
#!/bin/sh
#
# setup alsa (especially the mixer config)
#
# runlevels: geexbox, debug

# Soundcard's ID (0 for first card, 1 for second, ...)
ALSA_CARD="0"

# Output mode (SPDIF or analog)
SOUNDCARD_MODE="analog"

# AC3 decoder mode (hardware or software)
# note: in analog mode this option is ignored and defaults to software.
AC3_DECODER="hardware"

# Playback channels
#   2 - Stereo
#   4 - Surround
#   6 - Full 5.1
# note: in SPDIF and hardware AC3 decoder mode this option is ignored.
CHANNELS="2"

echo "" > /etc/asound.conf

mixer() {
  parm=${3:-on}
  amixer -c $ALSA_CARD sset "$1" "$2" $parm >/dev/null 2>&1
  amixer -c $ALSA_CARD sset "$1" $parm >/dev/null 2>&1
}

# set common mixer params
mixer Master 90%
mixer PCM 90%
mixer Synth 90%
mixer CD 90%
mixer Line 90%
mixer Aux 90%
# mute mic
mixer Mic 0% mute
# ESS 1969 chipset has 2 PCM channels
mixer PCM,1 90%
# Trident/YMFPCI/emu10k1
mixer Wave 100%
mixer Music 100%
mixer AC97 100%
mixer Surround 90%
mixer 'Surround Digital' 90%
mixer 'Wave Surround' 90%
mixer 'Duplicate Front' 90%
mixer 'Sigmatel 4-Speaker Stereo' 90%
# CS4237B chipset:
mixer 'Master Digital' 90%
# Envy24 chips with analog outs
mixer DAC 90%
mixer DAC,0 90%
mixer DAC,1 90%
# some notebooks use headphone instead of master
mixer Headphone 90%
mixer Playback 100%

# set SPDIF mixer params
if [ "$SOUNDCARD_MODE" = SPDIF ]; then
  mixer 'IEC958' 90%
  mixer 'IEC958 Output' 90%
  amixer -c $ALSA_CARD sset 'IEC958 Playback AC97-SPSA' 0 >/dev/null 2>&1
  mixer 'IEC958 Coaxial' 90%
  mixer 'IEC958 LiveDrive' 90%
  mixer 'IEC958 Optical Raw' 90%
  mixer 'SB Live Analog/Digital Output Jack' 90%
  mixer 'Audigy Analog/Digital Output Jack' 90%
  mixer 'SPDIF Out' 90%
  mixer 'SPDIF Front' 90%
  mixer 'SPDIF Rear' 90%
  mixer 'SPDIF Center/LFE' 90%
else
  mixer 'SB Live Analog/Digital Output Jack' 0% off
  mixer 'Audigy Analog/Digital Output Jack' 0% off
  mixer 'SPDIF Out' 0% off
  mixer 'Analog Front' 90%
  mixer 'Analog Rear' 90%
  mixer 'Analog Center/LFE' 90%
fi

exit 0
Back to top
View user's profile Send private message
P.Kosunen
Guru
Guru


Joined: 21 Nov 2005
Posts: 309
Location: Finland

PostPosted: Tue Nov 22, 2005 5:28 pm    Post subject: Reply with quote

Script didn't help (with SOUNDCARD_MODE="SPDIF").

Some other people have same problem with digiital out on VIA 8237 chip according to alsa mailing lists, but didn't find any solution there.

I have tried almost every possible combination in alsamixer.
http://personal.inet.fi/surf/pkosunen/vdr/amixer.out
Back to top
View user's profile Send private message
joeybravo
n00b
n00b


Joined: 30 Aug 2002
Posts: 45
Location: PH

PostPosted: Wed Nov 23, 2005 9:50 am    Post subject: Re: ALSA - no sound? Then read this. Reply with quote

JoeD wrote:

Well, I did all that and still didn't hear anything!
I had to run alsamixer and mute the sensor switches (headphone and line)
That fixed it for me!




Two days i wasted trying to recompile reconfigure, genkernel/manual ...

Thank you sooooo much JoeD.
I've been trying to figure out why there's no sound coming out of my speaker while my applications seems to function like its playing the music. (beep media players indicators pumping up and down)

JoeD my hero of the day!! *bows to JoeD 3x*
_________________
--lucky are the pessimists
for they make backups..
Back to top
View user's profile Send private message
ozbird
Apprentice
Apprentice


Joined: 21 Oct 2003
Posts: 184

PostPosted: Wed Nov 23, 2005 12:27 pm    Post subject: Re: ALSA - no sound? Then read this. Reply with quote

After upgrading to genkernel-3.3.8 and rebuilding my kernel today, I no longer have audio.
This happened on all three on my Gentoo boxes: one AMD64, two x86 - different sound cards in each.

JoeD wrote:
[snip]

If you see /proc/asound alsa is setup and ready to go in the kernel!
(but I still had no sound)

Check /dev:
No matter if you use devfs or udev -
you should have a /dev/snd directory which are the devices for alsa
you should have a /dev/sound directory which is the OSS emulation of alsa only if you chose to set it up (in the driver config).
Check that the file permissions on those devices are read/write for your user (check user and group permissions)
You can check if the oss emulation is working by "cat /dev/urandom > /dev/dsp", this should produce noise. (for me it didn't)


I have /proc/asound with the correct sound card identified, but no /dev/snd or /dev/sound directories.
Running udevstart as root created the directories; running alsactl restore -f /etc/asound.state restored the mixer settings, and it seems to work okay.

I don't know if this will continue to work after a reboot. (Update: It doesn't.)
Back to top
View user's profile Send private message
JoeD
n00b
n00b


Joined: 21 Nov 2005
Posts: 5

PostPosted: Wed Nov 23, 2005 7:56 pm    Post subject: Reply with quote

Quote:

I have /proc/asound with the correct sound card identified, but no /dev/snd or /dev/sound directories.
Running udevstart as root created the directories; running alsactl restore -f /etc/asound.state restored the mixer settings, and it seems to work okay.

I don't know if this will continue to work after a reboot. (Update: It doesn't.)

My guess is that you didn't setup udev correctly. Look into the udev guide. Do you start coldplug/hotplug in boot runlevel?
ciao
JoeD
Back to top
View user's profile Send private message
ozbird
Apprentice
Apprentice


Joined: 21 Oct 2003
Posts: 184

PostPosted: Wed Nov 23, 2005 9:13 pm    Post subject: Reply with quote

JoeD wrote:
My guess is that you didn't setup udev correctly. Look into the udev guide. Do you start coldplug/hotplug in boot runlevel?
ciao
JoeD


No, I set it up correctly as per the Gentoo documentation at the time which said to add it to the default runlevel, and which worked fine until yesterday...

At any rate, changing it to the boot runlevel didn't fix the problem:
Code:
alsamixer: function snd_ctl_open failed for default: No such device


Some of the documentation has now been changed to add it to the boot runlevel, but not all e.g. http://www.gentoo.org/doc/en/gentoo-x86-quickinstall.xml
A Google search found the same instructions in the Gentoo Handbook, though the actual page has been changed.
Back to top
View user's profile Send private message
JoeD
n00b
n00b


Joined: 21 Nov 2005
Posts: 5

PostPosted: Wed Nov 23, 2005 11:00 pm    Post subject: Reply with quote

Hmm, you might want to look into your module config, the modules might not be loaded before you try to access the mixer. Usually running alsaconf will detect the soundcard and setup the modules. It also runs "modules-update" to update your modules config.
ciao
JoeD
Back to top
View user's profile Send private message
joeybravo
n00b
n00b


Joined: 30 Aug 2002
Posts: 45
Location: PH

PostPosted: Thu Nov 24, 2005 3:03 am    Post subject: Re: ALSA - no sound? Then read this. Reply with quote

ozbird wrote:
After upgrading to genkernel-3.3.8 and rebuilding my kernel today, I no longer have audio.
This happened on all three on my Gentoo boxes: one AMD64, two x86 - different sound cards in each.




Are you using the "alsa-drivers" (emerge alsa-drivers)? If you are you need to re-emerge that after each kernel recompile.
_________________
--lucky are the pessimists
for they make backups..
Back to top
View user's profile Send private message
ozbird
Apprentice
Apprentice


Joined: 21 Oct 2003
Posts: 184

PostPosted: Thu Nov 24, 2005 9:17 am    Post subject: Reply with quote

JoeD wrote:
Hmm, you might want to look into your module config, the modules might not be loaded before you try to access the mixer. Usually running alsaconf will detect the soundcard and setup the modules. It also runs "modules-update" to update your modules config.
JoeD

The modules are loaded, but the /dev links are missing. This points to a start-up order issue (i.e. baselayout).
udev is working, since udevstart creates the devices correctly when it is run after the normal boot sequence.
Coldplug/hotplug is working since it detects the card and loads the modules correctly during start-up.

joeybravo wrote:
Are you using the "alsa-drivers" (emerge alsa-drivers)? If you are you need to re-emerge that after each kernel recompile.

I'm using the kernel-provided drivers.

I'll try reverting to an earlier version of baselayout and see what happens.
(Edit: reverting from baselayout-1.12.0_pre11 to 1.12.0_pre10-r1 didn't help.)
Back to top
View user's profile Send private message
Decibels
Veteran
Veteran


Joined: 16 Aug 2002
Posts: 1616
Location: U.S.A.

PostPosted: Sat Nov 26, 2005 2:12 pm    Post subject: Reply with quote

I can't get mine sound to work either on x86 system. Just upgraded the kernel to 2.6.14-gentoo-r2 and EMU10K1
fails with
Code:
FATAL: Error inserting snd_emu10k1 (/lib/modules/2.6.14-gentoo-r2/kernel/sound/pci/emu10k1/snd-emu10k1.ko): Invalid argument

Even tried the vanilla kernel. Works fine on amd64 system. Checked all the alsa stuff against the kernel that works: 2.6.10
and all match.
Must be something funky with the 2.6.14 kernel, but still investigating.

**Minutes later: Okay had this in /etc/modules.d/alsa for long time, never had it stop the module from loading. Guess it isn't
handling errors as well now.
Code:
options snd_emu10k1 enable

Had that I think from the alsa emu10k1 page, the others were commented out already. Commented this out and started working.
Tested and it is the problem.
_________________
Support bacteria – they’re the only culture some people have.”

– Steven Wright
Back to top
View user's profile Send private message
sundialsvc4
Guru
Guru


Joined: 10 Nov 2005
Posts: 436

PostPosted: Sun Nov 27, 2005 10:03 pm    Post subject: Reply with quote

I've got ALSA built-in to my (current, up-to-date) kernel. I see /dev/sound and /dev/snd with reasonable things in them. I even hear a distinct pop! from the speaker when I end the command: cp /dev/random > /dev/dsp. The initscript has been run. There are no errors during any of these steps. And my mixer levels are 100%. But ... no sound.

When I turn the PCM output-level to 100% in the mixer, I hear a faint rushing-sound from the speakers, which subsides when I reduce it. Presumably background-static of some kind.
Back to top
View user's profile Send private message
P.Kosunen
Guru
Guru


Joined: 21 Nov 2005
Posts: 309
Location: Finland

PostPosted: Mon Nov 28, 2005 7:21 pm    Post subject: Reply with quote

My problem is solved, crappy optical cable probably, coaxial works.
Back to top
View user's profile Send private message
cheeby
n00b
n00b


Joined: 16 Jan 2003
Posts: 23
Location: Northern Wisconsin

PostPosted: Mon Nov 28, 2005 10:55 pm    Post subject: Reply with quote

Unmuting the sensor switches worked for me, too w/ the 2.6.14-r2 kernel. Of all things...

Thanks for the tip,

cheeby
_________________
"Regrets?" the ornitholgist answered, "No. I have no regrets. Only ... egrets."
Back to top
View user's profile Send private message
sundialsvc4
Guru
Guru


Joined: 10 Nov 2005
Posts: 436

PostPosted: Tue Nov 29, 2005 4:22 am    Post subject: Reply with quote

Magically, upon reboot, sound appeared. I never did hear static. Still don't. But I do hear sound. Go figure.
Back to top
View user's profile Send private message
schiegl
n00b
n00b


Joined: 21 Mar 2005
Posts: 3

PostPosted: Wed Nov 30, 2005 10:34 pm    Post subject: Reply with quote

ozbird wrote:
JoeD wrote:
Hmm, you might want to look into your module config, the modules might not be loaded before you try to access the mixer. Usually running alsaconf will detect the soundcard and setup the modules. It also runs "modules-update" to update your modules config.
JoeD

The modules are loaded, but the /dev links are missing. This points to a start-up order issue (i.e. baselayout).
udev is working, since udevstart creates the devices correctly when it is run after the normal boot sequence.
Coldplug/hotplug is working since it detects the card and loads the modules correctly during start-up.

joeybravo wrote:
Are you using the "alsa-drivers" (emerge alsa-drivers)? If you are you need to re-emerge that after each kernel recompile.

I'm using the kernel-provided drivers.

I'll try reverting to an earlier version of baselayout and see what happens.
(Edit: reverting from baselayout-1.12.0_pre11 to 1.12.0_pre10-r1 didn't help.)


i had exactly the same problem (~x86, no devices, modules loaded) since upgrading to 2.6.14x. After some research i found out you must have
Code:
CONFIG_HOTPLUG=y
in your kernelconfig. This was previously set on my system (kernel <= 2.6.13) and was not kept using make oldconfig
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum