You are not logged in.

#1 2013-03-11 16:57:17

kellerman
Member
From: Latvia
Registered: 2011-07-20
Posts: 110

ALSA microphone recording from more than application simotaneously

Hi. I'm using alsa and alsaequal with dmix turned on, sound output works flawlessly. But there is one problem. I have noticed that 2 applications can't use microphone for the same time. For example if I call using Skype, the mic works there, but if I try to start a Steam voice call, it fails. Or If I use mic with Steam, I can't get Skype to use it too!
I'm using aroundrc.conf under /etc/

cat asound.conf 
ctl.equal {
 type equal;
}
pcm.plugequal {
  type equal
  slave.pcm "plug:dmix"

}
pcm.!default {
  type plug
  slave.pcm plugequal
}

I've made alsa equalizer my default output. This is the only config for alsa I've made. My mic automatically switches from built in mic to external. Sometimes Steam mic testing doesn't catch the mic input with the first try.
This is how I start Steam if this helps, but I think that this issue is not caused because of Steam.

 cat /usr/bin/steam_nvidia
#!/bin/bash
#
export SDL_AUDIODRIVER=alsa 
export STEAM_FRAME_FORCE_CLOSE=1
vblank_mode=0 primusrun steam

When mic in Steam fails... It usually starts working with the 3-4 time.

AL lib: alsa.c:888: start failed: File descriptor in bad state

And lspci:

lspci | grep Audio
00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)

Any help would be highly appreciated. I didn't find similar threads like this. My Arch is x86_64

Last edited by kellerman (2013-03-11 17:13:02)

Offline

#2 2013-03-11 17:20:19

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

Re: ALSA microphone recording from more than application simotaneously

Offline

#3 2013-03-11 17:26:25

kellerman
Member
From: Latvia
Registered: 2011-07-20
Posts: 110

Re: ALSA microphone recording from more than application simotaneously

Oh quick, Thanks, gonna try it out! By the way

AL lib: alsa.c:888: start failed: File descriptor in bad state

happens even when mic seems to be available (not used by any other programs).
EDIT:
Okay, I started messing with dsnoop. If I'm guessing right, dsnoop should be available in ALSA by default? In have installed alsa-plugins just in case.
Currently:

ctl.equal {
 type equal;
}
pcm.plugequal {
  type equal
  slave.pcm "plug:dmix"

}
pcm.!default {
  type plug
  slave.pcm plugequal
}
pcm.plugsnoop {
    type dsnoop
    ipc_key 1027
    slave {
        pcm "hw:0,0" 
    }
}

So plugsnoop seems to work with skype (if I select it in sound settings), but still it's not the system default capture device. Still figuring out how to do it, and I'm not sure if it works....

Last edited by kellerman (2013-03-11 18:37:55)

Offline

#4 2013-03-11 19:06:08

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

Re: ALSA microphone recording from more than application simotaneously

You'll want "asym" in there - see the example in my sig, and the redhat bug I already brought to your attention.

Offline

#5 2013-03-11 20:02:13

kellerman
Member
From: Latvia
Registered: 2011-07-20
Posts: 110

Re: ALSA microphone recording from more than application simotaneously

Okay. I made up a config like this:

pcm.snoop {
	type dsnoop
	ipc_key 5978292
	slave {
		pcm "hw:0,0"
		channels 2
	}
}
ctl.equal {
 type equal;
}
pcm.plugequal {
  type equal
  slave.pcm "plug:dmix"
}
pcm.asymed{
       type asym	
       playback.pcm plugequal
       capture.pcm snoop
}
pcm.!default {
  type plug
  slave.pcm asymed
}

With this config I can capture sound simotaneously, yay. Steam still sometimes doesn't start recording with the first or second time (is that really Steam issue?? But I can now record sound ingame, which I was rarely able before). Skype works well, except that it doesn't like to use alsaequal preset for some reason (I have both .alsaequal.bin and .alsaequal.bin32 in my home... 32bit bin file should contain same preset 64bit does right?). I did set all default audio settings (Default ALSA device...) on both apps.
Anyway... Thanks for the information, without this I wouldn't made it so far!

Last edited by kellerman (2013-03-11 20:15:39)

Offline

#6 2013-03-11 20:30:11

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

Re: ALSA microphone recording from more than application simotaneously

kellerman wrote:

sometimes doesn't start recording

Try putting the ipc_key line within the asym PCM rather than snoop.

Offline

#7 2013-03-11 20:39:05

kellerman
Member
From: Latvia
Registered: 2011-07-20
Posts: 110

Re: ALSA microphone recording from more than application simotaneously

hmm, this results

ALSA lib pcm_asym.c:101:(_snd_pcm_asym_open) Unknown field ipc_key

No sound at all.

Last edited by kellerman (2013-03-11 20:39:16)

Offline

Board footer

Powered by FluxBB