You are not logged in.

#1 2009-01-03 15:35:59

cmtptr
Member
Registered: 2008-09-01
Posts: 135

[solved; by fluke, no real solution] ALSA, Flash blocks sound

Hi,

Until recently I've been using OSS because I simply got fed up with having to fight ALSA through everything, and OSS seemed to work fine out of the box.  However, I can't get Wine to cooperate with OSS, so as of a few days ago I've switched back to ALSA to give it a second chance.  The problem is that I'm on a laptop - no hardware mixing support - and although ALSA's software mixing seems to be working better this time around, I've noticed a couple of issues which I cannot seem to find a solution for.

Some applications seem to block ALSA's software mixing.  The only two I've noticed so far are ZSNES and the Flash plugin for Firefox.  When either of these two are running, the command "aplay /usr/share/sounds/alsa/Front_Center.wav" outputs the following:

[corey@sariss ~]$ aplay /usr/share/sounds/alsa/Front_Center.wav 
ALSA lib pcm_dmix.c:1008:(snd_pcm_dmix_open) unable to open slave
aplay: main:590: audio open error: Device or resource busy

However, I can play music with VLC, then run ZSNES and have the sound mix... but the quality of sound from ZSNES it nothing short of unbearable.

I've realized that I can fix both the mixing and quality problems with ZSNES by invoking it with "aoss zsnes," but this hardly seems like an acceptable solution; not to mention that it isn't practical for Firefox, since it may be launched by Pidgin or other programs when links are clicked.

I have run alsaconf, and it was able to detect and configure my sound card.
The following are some command outputs which may be useful.  Let me know if I need to post any more...

[corey@sariss ~]$ lsmod | grep snd
snd_hda_intel         370736  0 
snd_hwdep               8964  1 snd_hda_intel
snd_seq_oss            31872  0 
snd_seq_midi_event      8192  1 snd_seq_oss
snd_seq                49968  4 snd_seq_oss,snd_seq_midi_event
snd_seq_device          8332  2 snd_seq_oss,snd_seq
snd_pcm_oss            40192  0 
snd_pcm                69636  2 snd_hda_intel,snd_pcm_oss
snd_timer              21384  2 snd_seq,snd_pcm
snd_page_alloc          9224  2 snd_hda_intel,snd_pcm
snd_mixer_oss          16512  1 snd_pcm_oss
snd                    50724  9 snd_hda_intel,snd_hwdep,snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_pcm,snd_timer,snd_mixer_oss
soundcore               8160  1 snd
[corey@sariss ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC880 Analog [ALC880 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC880 Digital [ALC880 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 6: Si3054 Modem [Si3054 Modem]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Any suggestions would be greatly appreciated.  Also, I hold no loyalty to either driver; should anyone provide a solution which involves returning to OSS, that would be fine so long as it works.

Last edited by cmtptr (2009-01-08 19:35:46)

Offline

#2 2009-01-03 17:14:04

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [solved; by fluke, no real solution] ALSA, Flash blocks sound

Did you try running winecfg, going into the audio tab, unselecting alsa and selecting oss? That did the trick for me.
If you still want to use alsa you may want to try this

ctl.!default {
    type "hw"
    card 0
}

pcm.!default {
    type plug
    slave.pcm "duplex"
}

pcm.non_block_duplex {
    type plug
    slave.pcm "duplex"
}

pcm.dmixer {
    type dmix
    ipc_key 1234
    ipc_key_add_uid yes
    slave {
        pcm "hw:0"
    }
}

pcm.dsnooper {
    type dsnoop
    ipc_key 5678
    ipc_key_add_uid yes
    slave {
        pcm "hw:0"
    }
}

pcm.duplex {
    type asym
    playback.pcm "dmixer"
    capture.pcm "dsnooper"
}

Then when possible tell your programs to use non_block_duplex (still, some programs seem to hijack the sound card though hmm ).
On the hw:0 it might be hw:0,0 or 0.0 can't remember which one now, I had it by the name of my card -> hw:SB and card SB.
Still it solved the hogging problem but it didn't solve the crappy sound alsa was outputting. Now I'm using OSS and each time I use my headphones to listen to any music I'm big_smile

Last edited by R00KIE (2009-01-03 17:15:37)


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#3 2009-01-03 17:43:45

cmtptr
Member
Registered: 2008-09-01
Posts: 135

Re: [solved; by fluke, no real solution] ALSA, Flash blocks sound

R00KIE wrote:

Did you try running winecfg, going into the audio tab, unselecting alsa and selecting oss? That did the trick for me.

Yes, I know all about that.  The problem in Wine with OSS was that it wouldn't play sound for only a few games... I went to #winehq on freenode and instead of actually addressing the problem, they told me to use ALSA instead, so that's where I'm at now.

R00KIE wrote:

If you still want to use alsa you may want to try this

ctl.!default {
    type "hw"
    card 0
}

pcm.!default {
    type plug
    slave.pcm "duplex"
}

pcm.non_block_duplex {
    type plug
    slave.pcm "duplex"
}

pcm.dmixer {
    type dmix
    ipc_key 1234
    ipc_key_add_uid yes
    slave {
        pcm "hw:0"
    }
}

pcm.dsnooper {
    type dsnoop
    ipc_key 5678
    ipc_key_add_uid yes
    slave {
        pcm "hw:0"
    }
}

pcm.duplex {
    type asym
    playback.pcm "dmixer"
    capture.pcm "dsnooper"
}

Then when possible tell your programs to use non_block_duplex (still, some programs seem to hijack the sound card though hmm ).
On the hw:0 it might be hw:0,0 or 0.0 can't remember which one now, I had it by the name of my card -> hw:SB and card SB.
Still it solved the hogging problem but it didn't solve the crappy sound alsa was outputting. Now I'm using OSS and each time I use my headphones to listen to any music I'm big_smile

I pasted that into ~/.asoundrc and restarted ALSA, but noticed no change.  I'm not sure what you mean by "tell your programs to use non_block_duplex."  Perhaps you could elaborate on this a bit more?  Pretend I'm an idiot in your explanation. wink

Thanks.

Offline

#4 2009-01-03 18:54:37

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [solved; by fluke, no real solution] ALSA, Flash blocks sound

Oh! Sorry, I forgot to tell you where to put it.
I have been using that in /etc/asound.conf
All programs that use the default alsa device should not block the sound card anymore (they shouldn't block the card to start with because they should used dmix by themselves), the default is the "duplex" that uses dmix (that shouldn't block the sound card) but sometimes flash seems to still hijack the sound card, go figure.
You can "force" a program to use the device you want, when you create/paste that into /etc/asound.conf and save the file just restart the program that uses the sound card and check if you have more devices, non_block_duplex should show up (along with all the rest), if it doesn't then something isn't quite right with the config.
In your case I think you should use "hw:0,0"  (card 0, device 0 but if you use just hw:0 it will select device 0 by itself I believe)

Last edited by R00KIE (2009-01-03 18:58:16)


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#5 2009-01-03 20:49:53

cmtptr
Member
Registered: 2008-09-01
Posts: 135

Re: [solved; by fluke, no real solution] ALSA, Flash blocks sound

I removed ~/.asoundrc and pasted that into /etc/asound.conf, but there still seems to be no help, after restarting Firefox, restarting ALSA, and even rebooting.  While watching a youtube I tried the following in a terminal:

[corey@sariss ~]$ aplay /usr/share/sounds/alsa/Front_Center.wav 
ALSA lib pcm_dmix.c:1008:(snd_pcm_dmix_open) unable to open slave
aplay: main:590: audio open error: Device or resource busy
[corey@sariss ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC880 Analog [ALC880 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC880 Digital [ALC880 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 6: Si3054 Modem [Si3054 Modem]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I've also replaced each instance of "hw:0" with "hw:0,0" as you suggested, but I still see no improvement.  Sorry if I'm missing something stupid!  Thanks again.

Offline

#6 2009-01-03 20:52:39

bluewind
Administrator
From: Austria
Registered: 2008-07-13
Posts: 172
Website

Re: [solved; by fluke, no real solution] ALSA, Flash blocks sound

Did you try OSS's ALSA emulation and setting wine to ALSA?

Offline

#7 2009-01-03 21:29:08

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [solved; by fluke, no real solution] ALSA, Flash blocks sound

Oh yes, alsa can be a pain, try that just after the reboot, like I said sometimes firefox/flash can hijack the soundcard when it shouldn't .... do you have any program where you can select the output device like vlc, mplayer .... you can check there, if the "extra" devices show up then the file is correct and it should work .... for most things .... ain't alsa great.
Oh and when firefox grabs the soundcard its for good, so don't start firefox until you can check things are working as intended.
I don't know what else I can say, I left alsa because of these kind of problems and because of poor audio quality, and believe me, I tried to make it work.
I guess you could go dualboot wine+alsa for games and oss for daily use.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#8 2009-01-04 03:17:50

cmtptr
Member
Registered: 2008-09-01
Posts: 135

Re: [solved; by fluke, no real solution] ALSA, Flash blocks sound

bluewind wrote:

Did you try OSS's ALSA emulation and setting wine to ALSA?

No, I was hoping such a thing existed but I was unable to find anything about it with Google.  Instead, searching for "ALSA emulation for OSS" returned a bunch of pages regarding ALSA's OSS emulation, aoss.  If I could get that to work, I may return to OSS forever.  The only other problem I have with it are some uncomfortable screeching sounds that occur when sound is initializing on Flash, but it's tolerable.  So long as sound and mixing works!

Offline

#9 2009-01-04 12:09:51

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [solved; by fluke, no real solution] ALSA, Flash blocks sound

Mind you that alsa's oss emulation also hijacks the sound card as far as I know.
As a side note I have also a few programs that don't seem to work so well after I switched to OSS, one running with wine and another that is Linux native ... but I think with time I will be able to figure it out.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#10 2009-01-08 19:34:17

cmtptr
Member
Registered: 2008-09-01
Posts: 135

Re: [solved; by fluke, no real solution] ALSA, Flash blocks sound

Well, I finally got this working.  I'm so stupid - if you run a search for all of my threads, nearly every one of them is solved similarly to what I'm about to describe. tongue

I finally got fed up with trying to get Adobe Flash to work that I decided to try an open source Flash player.  I uninstalled flashplugin, then installed gnash-gtk... and hated it.  So I uninstalled that, got swfdec, and wasn't really thrilled with it, either.  Then I thought to myself "this is silly, I don't want to circumvent this problem - I want to FIX it!"  So I uninstalled swfdec, and installed flashplugin again... and now it all works fine.  I should have tried uninstalling and reinstalling in the first place.

Oh well, it works fine for me now.  I still have to invoke ZSNES with aoss, but I can live with that since it's always run explicitely by me.  To be honest, I'm kind of glad I've gotten ALSA working.  The anti-"free software movement" side of me wanted to use OSS just out of spite, but I actually prefer ALSA's mixer program, and there's the added bonus of it working with Wine (which I never did get OSS to do for some reason).

Thanks again for all your suggestions.

Last edited by cmtptr (2009-01-08 19:36:32)

Offline

#11 2010-01-05 03:33:37

Acegi
Member
Registered: 2009-12-24
Posts: 6

Re: [solved; by fluke, no real solution] ALSA, Flash blocks sound

R00KIE wrote:

Oh! Sorry, I forgot to tell you where to put it.
I have been using that in /etc/asound.conf
All programs that use the default alsa device should not block the sound card anymore (they shouldn't block the card to start with because they should used dmix by themselves), the default is the "duplex" that uses dmix (that shouldn't block the sound card) but sometimes flash seems to still hijack the sound card, go figure.
You can "force" a program to use the device you want, when you create/paste that into /etc/asound.conf and save the file just restart the program that uses the sound card and check if you have more devices, non_block_duplex should show up (along with all the rest), if it doesn't then something isn't quite right with the config.
In your case I think you should use "hw:0,0"  (card 0, device 0 but if you use just hw:0 it will select device 0 by itself I believe)

This part seems like what I need. How do you set up asound.conf to use a specific sound device? I have a usb sound and there are some programs that refuse to play nice together. eg firefox and a separate java program. Firefox and virtualbox. I can play music and load a youtube video together fine but java programs and virtualbox seem to stop other more popular programs from playing sound and vice versa.

Offline

#12 2010-01-05 05:35:57

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

Re: [solved; by fluke, no real solution] ALSA, Flash blocks sound

See which apps are using /dev/snd (ALSA = good) or /dev/dsp* (OSS = bad):

fuser -v /dev/snd/* /dev/dsp*

Flash uses ALSA for me - if flash uses OSS for you, then check that you're using the latest version of flash, and are *not* using the old nspluginwrapper.

If zsnes' ALSA output is rubbish, then file a bug with the zsnes authors. If they prefer OSS, then hit them with a wet kipper mad

Offline

Board footer

Powered by FluxBB