You are not logged in.

#1 2009-04-20 10:20:06

teepee47
Member
Registered: 2009-04-20
Posts: 24

[Solved] Sound issues (alsa)

Hi!

Ok so the situation is I'm a huge noob at linux sound stuff. Essentially I had sound that worked perfectly but then I went and tried to get my PCI sound card working (instead of sticking with onboard sound card....I'm pretty sure the PCI sound card doesnt have drivers at the moment). I ended up screwing the sound up in that it wasn't able to play sound from multiple apps at once. Upon attempting to fix this it broke even more. Someone on IRC told me to setup pulse audio instead of dmix so I tried this and i think I've destroyed it even more now. Essentially I'm pretty sure my sound is an absolute mess and I dont know where to go from here.

At the moment I can get mpd working and flash (eg youtube) working but not at the same time. If i try playing something in mplayer I get the errors including: '[JACK] cannot open server' and 'DVB card must be between 1 and 4'. Alsamixer returns the error

ALSA lib control.c:874:(snd_ctl_open_conf) Cannot open shared library /usr/lib/alsa-lib/libasound_module_ctl_pulse.so

alsamixer: function snd_ctl_open failed for default: No such file or directory

I think this is because I uninstalled pulseaudio. Before I uninstalled pulseaudio however, alsamixer showed a single master channel which didn't affect audio when I changed its volume.

Here is the output of lsmod|grep '^snd'

snd_pcsp                9164  0 
snd_seq_oss            29888  0 
snd_seq_midi_event      5972  1 snd_seq_oss
snd_seq                48176  4 snd_seq_oss,snd_seq_midi_event
snd_seq_device          6080  2 snd_seq_oss,snd_seq
snd_hda_codec_realtek   189784  1 
snd_hda_intel          25384  1 
snd_hda_codec          60340  2 snd_hda_codec_realtek,snd_hda_intel
snd_pcm                67992  4 snd_pcsp,snd_hda_intel,snd_hda_codec
snd_timer              19260  2 snd_seq,snd_pcm
snd_page_alloc          8092  2 snd_hda_intel,snd_pcm
snd_hwdep               6904  1 snd_hda_codec
snd_mixer_oss          14388  0 
snd                    51460  12 snd_pcsp,snd_seq_oss,snd_seq,snd_seq_device,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_pcm,snd_timer,snd_hwdep,snd_mixer_oss

and here is the output of ls -l /dev/snd/

crw-rw---- 1 root audio 116,  8 2009-04-20 19:54 controlC0
crw-rw---- 1 root audio 116, 11 2009-04-20 19:54 controlC1
crw-rw---- 1 root audio 116,  7 2009-04-20 19:54 hwC0D0
crw-rw---- 1 root audio 116,  6 2009-04-20 19:54 pcmC0D0c
crw-rw---- 1 root audio 116,  5 2009-04-20 19:56 pcmC0D0p
crw-rw---- 1 root audio 116,  4 2009-04-20 19:54 pcmC0D1p
crw-rw---- 1 root audio 116,  3 2009-04-20 19:54 pcmC0D2c
crw-rw---- 1 root audio 116, 10 2009-04-20 19:54 pcmC1D0p
crw-rw---- 1 root audio 116,  9 2009-04-20 19:54 seq
crw-rw---- 1 root audio 116,  2 2009-04-20 19:54 timer

Aargh its a mess. Any help would be greatly appreciated. I really want to just get rid of everything I've done and start from scratch except I don't quite know how to do that.
Thanks!

Last edited by teepee47 (2009-04-30 09:31:50)

Offline

#2 2009-04-22 10:33:09

teepee47
Member
Registered: 2009-04-20
Posts: 24

Re: [Solved] Sound issues (alsa)

Ok so I've had a tiny bit of progress... I managed to get rid of pulseaudio a bit more effectively this time. Now alsamixer works just fine and mplayer can play sound (although it still returns the error: "[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory".

However, if I stop mpd from playing then play from another source (eg mplayer) then try and go back and play from mpd again, it doesnt work (mpc says: ERROR: problems opening audio device). Also, as with before, no two programs can use sound at the same time.

So the main issue now is trying to get dmix working again.
Cheers

EDIT: Sorry I didn't test that properly...it turns out that two programs can use audio at the same time! I've tested that with two instances of mplayer at once as well as an instance of mplayer at the same time as a youtube video. However the issue with mpd remains... The error log says things like:

Apr 22 20:35 : Error opening ALSA device "hw:0,0": Device or resource busy
Apr 22 20:35 : problems opening audio device while playing [FILENAME]

Last edited by teepee47 (2009-04-22 10:40:41)

Offline

#3 2009-04-22 10:51:15

teepee47
Member
Registered: 2009-04-20
Posts: 24

Re: [Solved] Sound issues (alsa)

Ok so after a reset of the computer everything seems to be working ok >_<. I have no idea how it's working now, this is seriously screwing with my mind...Next time I get the chance I'm going to sit down for a weekend and try and understand what the hell is going on.

Although I am kind of pleased I managed to sort this out without any help smile

Offline

#4 2009-04-23 07:47:00

teepee47
Member
Registered: 2009-04-20
Posts: 24

Re: [Solved] Sound issues (alsa)

So I've gotten rid of the solved tag from the first post because it's not actually solved...the problem has reverted to this situaiton:

teepee47 wrote:

it turns out that two programs can use audio at the same time! I've tested that with two instances of mplayer at once as well as an instance of mplayer at the same time as a youtube video. However the issue with mpd remains... The error log says things like:

Apr 22 20:35 : Error opening ALSA device "hw:0,0": Device or resource busy
Apr 22 20:35 : problems opening audio device while playing [FILENAME]

So this issue has returned and I have no idea why it worked fine last night because now its totally not working anymore. This happened seemingly spontaneous...it was working last night and I woke up this morning and it wasn't (computer was on the whole time doing basically nothing). Now after a reset it still retains this problem. Thoughts?

EDIT: It might be useful if i provide the mplayer output when mpd is already running:

[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
[AO_ALSA] alsa-lib: pcm_hw.c:1321:(snd_pcm_hw_open) open /dev/snd/pcmC0D0p failed: Device or resource busy
[AO_ALSA] alsa-lib: pcm_dmix.c:1008:(snd_pcm_dmix_open) unable to open slave
[AO_ALSA] Playback open error: Device or resource busy
[JACK] cannot open server
[AO SDL] Samplerate: 48000Hz Channels: Stereo Format s16le
[AO_ALSA] alsa-lib: pcm_hw.c:1321:(snd_pcm_hw_open) open /dev/snd/pcmC0D0p failed: Device or resource busy
[AO_ALSA] alsa-lib: pcm_dmix.c:1008:(snd_pcm_dmix_open) unable to open slave
[AO SDL] Unable to open audio: No available audio device

Last edited by teepee47 (2009-04-23 07:50:38)

Offline

#5 2009-04-23 08:00:59

3nd3r
Member
From: /dev/null
Registered: 2002-12-08
Posts: 301
Website

Re: [Solved] Sound issues (alsa)

i have a simular issue, when running virtualbox i cant play any audio from anythnig else. no mplayer/vlc/firefox/flash etc..

Last edited by 3nd3r (2009-04-23 08:01:13)

Offline

#6 2009-04-23 10:20:36

stryder
Member
Registered: 2009-02-28
Posts: 500

Re: [Solved] Sound issues (alsa)

Hi, I'm no alsa expert but I have been messing with sound on my system as well - in my case, oss. Just thought I'd put in my 2 cents in case you find it helpful:

1. The alsa wiki says if you had used alsaconf "the entries alsaconf adds to the modprobe.conf file might break udev's autodetection". You might want to check /etc/modprobe.conf for anything suspicious and comment them out to see if it makes a difference. The lack of /dev/dsp for example seems to show that things are not installed properly.

2. The oss wiki says to blacklist soundcore in rc.conf to prevent alsa loading. And when you then install oss it will replace alsa in managing sound. I'm wondering if you might want to do this - this means that alsa will be taken out of your system. Perhaps oss might work for you. If so you should just stick to it - most people think it sounds better. But the reason I am suggesting installing oss is that I have no problems in getting alsa back when I remove oss. Just -Rsn oss, (remove the blacklist of soundcore and assuming you don't start alsa as a daemon), reboot, and alsa's back. This might be a way to "just get rid of everything I've done and start from scratch". In doing so, perhaps the "reinstallation" of alsa might just do the trick. I would move /etc/asound.state if I were to try this.

3. I would also reinstall alsa-lib and alsa-utils just in case.

Good luck. :-)

Offline

#7 2009-04-23 12:53:50

teepee47
Member
Registered: 2009-04-20
Posts: 24

Re: [Solved] Sound issues (alsa)

Thanks for the feedback stryder.

1: I've checked modprobe and its empty so I guess I can rule that one out. The odd thing is, in reference to /dev/dsp, when I'm running mplayer without any other program accessing the sound (so the sound actually does work) I still get this error (can't open audio device /dev/dsp) even though sound plays properly.

2: I would prefer to get alsa working rather than install OSS at this stage, although after your post I realise how easy it is to setup so I might consider giving it a go sometime. But nevertheless I would still prefer to get alsa happening. Also I don't think your suggestion would work because isn't that just 'not loading' alsa rather than making any changes? I suppose I could give it a go but I don't see how it will help.

3: Already tried this

Thanks for the advice smile

Offline

#8 2009-04-29 02:44:44

bradbajuz
Member
From: Orlando, FL
Registered: 2009-01-11
Posts: 5
Website

Re: [Solved] Sound issues (alsa)

teepee47,

Since you uninstalled PulseAudio, check /etc/asound.conf.  I was having a similar issue and I removed everything inside asound.conf, which was:

pcm.pulsefront {
    type pulse
    device front
}
pcm.pulserear {
    type pulse
    device rear
}
ctl.pulsefront {
    type pulse
    device front
}
ctl.pulserear {
    type pulse
    device rear
}


After I removed everything above, alsa was working again.

Offline

#9 2009-04-29 07:39:24

Wilco
Member
Registered: 2008-11-09
Posts: 440

Re: [Solved] Sound issues (alsa)

Well m8, here's your one stop solution:
- blacklist "snd_seq_oss" (or use rmmod)
- don't use asound.conf, pulseaudio or jack to see that it works.

Your problem is sound is being played through oss which locks your soundcard. Lots of apps default to oss and if they can't find it they use alsa which can use multiple sounds at the same time.

Offline

#10 2009-04-29 08:33:16

teepee47
Member
Registered: 2009-04-20
Posts: 24

Re: [Solved] Sound issues (alsa)

bradbajuz, I have already done that...that was what actually made my alsamixer work again as well as fix up audio for programs not including mpd.

wilco, forgive the noob question but how do i blacklist snd_seq_oss? and I'm not using asound.conf or pulseaudio however jack is installed and I can't remove it because it is a dependency for mplayer and portaudio...is it possible to remove it anyway? Otherwise, how would I go about 'not using' jack?

Thanks for the replies

Offline

#11 2009-04-29 09:23:03

Wilco
Member
Registered: 2008-11-09
Posts: 440

Re: [Solved] Sound issues (alsa)

blacklisting is described in the documentation and helps to avoid loading modules at boot. you can also try to
# rmmod snd_seq_oss

And all other moduels with oss in their names.

Offline

#12 2009-04-29 09:38:27

teepee47
Member
Registered: 2009-04-20
Posts: 24

Re: [Solved] Sound issues (alsa)

Ok so that didn't seem to work using rmmod. I tried put 'blacklist 'snd_seq_oss' in /etc/modprobe.d/sound as well to stop it loading at boot but that didn't work so I guess I've done that wrong. anyway from your suggestion (black list snd_seq_oss, dont use asound.conf,pulseaudio or jack) the only thing im not sure about is not using jack. However when I try to play something in mplayer it says [JACK] cannot open server, so I assume it isn't running. I'm still at a loss here :S. Thanks for the assistance anyway.

Offline

#13 2009-04-29 09:49:16

Wilco
Member
Registered: 2008-11-09
Posts: 440

Re: [Solved] Sound issues (alsa)

You don't need jack for audio. It's real crap just like pulseaudio.
Try to remove mplayer, jack, pulseaudio and then install only mplayer.

After that, don't use /etc/modprobe.d/sound but /etc/rc.conf and look for MODULES. In that section remove *oss* if it's there (so remove snd_seq_oss for example) and add !snd_seq_oss (see the exclamation mark in front?) and possibly other modules with oss in their name.
rmmod snd_seq_oss should work. Do you get an error?

Offline

#14 2009-04-29 13:07:17

teepee47
Member
Registered: 2009-04-20
Posts: 24

Re: [Solved] Sound issues (alsa)

Wilco wrote:

You don't need jack for audio. It's real crap just like pulseaudio.
Try to remove mplayer, jack, pulseaudio and then install only mplayer.

Pulseaudio is not on my system anymore. I tried removing jack and mplayer but I can't reinstall  mplayer without reinstalling jack, so I tested the audio both with mplayer/jack uninstalled and both of them reinstalled, neither situation resolves my problem.

After that, don't use /etc/modprobe.d/sound but /etc/rc.conf and look for MODULES. In that section remove *oss* if it's there (so remove snd_seq_oss for example) and add !snd_seq_oss (see the exclamation mark in front?) and possibly other modules with oss in their name.
rmmod snd_seq_oss should work. Do you get an error?

snd_seq_oss does not appear in MODULES in /etc/rc.conf but I already had the other oss modules blacklisted in there.
I should also have clarified before with rmmod snd_seq_oss... what I meant was that it successfully removed the module but it did not fix the issue.

So after all oss modules in /etc/rc.conf being blacklisted (this is only snd-mixer-oss and snd-pcm-oss) and doing rmmod snd_seq_oss, this is the output of lsmod | grep '^snd'

snd_pcsp                9164  0 
snd_seq_midi_event      5972  0 
snd_seq                48176  1 snd_seq_midi_event
snd_seq_device          6080  1 snd_seq
snd_hda_codec_realtek   189784  1 
snd_hda_intel          25384  1 
snd_hda_codec          60340  2 snd_hda_codec_realtek,snd_hda_intel
snd_pcm                67992  4 snd_pcsp,snd_hda_intel,snd_hda_codec
snd_timer              19260  2 snd_seq,snd_pcm
snd_page_alloc          8092  2 snd_hda_intel,snd_pcm
snd_hwdep               6904  1 snd_hda_codec
snd                    51460  10 snd_pcsp,snd_seq,snd_seq_device,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_pcm,snd_timer,snd_hwdep

Offline

#15 2009-04-29 13:49:55

Wilco
Member
Registered: 2008-11-09
Posts: 440

Re: [Solved] Sound issues (alsa)

Some background info on your problem:
A good soudcard will have hardware mixing which lets you play multiple sound streams at the same time.
Most computers these days have an onboard soundcard (often something like AC97) which does not support hardware mixing. To play multiple streams simultaneously alsa can use dmix which is a software emulation solution for the lack of hardware mixing.

Now, can you try to play a video file with mplayer using the alsa driver:
mplayer -ao alsa video.avi

Then open another terminal and use the same command. You should now have the same video twice both with sounds. If not, post the mplayer output here.

Offline

#16 2009-04-30 02:15:44

teepee47
Member
Registered: 2009-04-20
Posts: 24

Re: [Solved] Sound issues (alsa)

Wilco,

Please refer to this post as this is my current situation:

teepee47 wrote:

It turns out that two programs can use audio at the same time! I've tested that with two instances of mplayer at once as well as an instance of mplayer at the same time as a youtube video. However the issue with mpd remains... The error log says things like:

Apr 22 20:35 : Error opening ALSA device "hw:0,0": Device or resource busy
Apr 22 20:35 : problems opening audio device while playing [FILENAME]

So the current issue is that nothing can use audio at the same time as mpd. Two videos playing in different instances of mplayer can both use sound at the same time.

Offline

#17 2009-04-30 07:57:22

Wilco
Member
Registered: 2008-11-09
Posts: 440

Re: [Solved] Sound issues (alsa)

Then try to use the "default PCM audio device" instead of "hw:0,0" with mpd

Offline

#18 2009-04-30 09:31:31

teepee47
Member
Registered: 2009-04-20
Posts: 24

Re: [Solved] Sound issues (alsa)

Wow that's it! All fixed now smile Thanks a lot Wilco, really appreciate it.

Offline

Board footer

Powered by FluxBB