Re: [alsa-devel] Help wanted: emachines em350 internal mic
Greetings,
There is only a single mic on this netbook. However, the alsa device shows up as stereo, and the right channel carries an inverted copy of the left channel.
http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=59c774ed5ee00e9623a20...
So when the two channels are summed to make a mono (e.g. for telephony, or playback on mono internal speaker) it appears that there is no signal.
Is there a way to "cure" this problem in the driver? I can think of
- Force internal mic capture to be mono (left only)
- Copy left to right capture
- Invert right capture
but don't know how easy any are to implement.
Thanks Raymond,
On 03/12/10 15:33, Raymond Yau wrote:
Greetings,
There is only a single mic on this netbook. However, the alsa device shows up as stereo, and the right channel carries an inverted copy of the left channel.
http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=59c774ed5ee00e9623a20...
Commitlog was "Add route_policy copy to HDA-Intel.conf for capture Since some digital mics have the phase-inversion problem in one channel, adding both channels for mono stream results in the noise. Use route_policy copy to avoid that situation."
As far as I can guess, the commit helps when an application asks to record mono from the stereo device, by copying L rather than summing L+R
My machine already has this, however it doesn't really fix the root of the problem.
Because the internal mic appears as a stereo device, rather than a mono, applications can open it as stereo.
Only later when the resulting signal L+R is sent to a mono output does the signal "disappear".
So I'm back to wondering how to force an app (primarily PulseAudio) to see the mic as mono?
(I think the external jack is also only mono, at least when used as a mic input?)
So when the two channels are summed to make a mono (e.g. for telephony, or playback on mono internal speaker) it appears that there is no signal.
Is there a way to "cure" this problem in the driver? I can think of
- Force internal mic capture to be mono (left only)
- Copy left to right capture
Even in stereo mode!
- Invert right capture
but don't know how easy any are to implement.
2010/12/7 Eliot Blennerhassett linux@audioscience.com
Thanks Raymond,
On 03/12/10 15:33, Raymond Yau wrote:
Greetings,
There is only a single mic on this netbook. However, the alsa device shows up as stereo, and the right channel carries an inverted copy of the left channel.
http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=59c774ed5ee00e9623a20...
Commitlog was "Add route_policy copy to HDA-Intel.conf for capture Since some digital mics have the phase-inversion problem in one channel, adding both channels for mono stream results in the noise. Use route_policy copy to avoid that situation."
As far as I can guess, the commit helps when an application asks to record mono from the stereo device, by copying L rather than summing L+R
My machine already has this, however it doesn't really fix the root of the problem.
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/639846
The route plugin is only used when the application are alsa 's default pcm/ctl device for hda-intel if you fall back to use dmix/dsnoop
pulseaudio is using front device for capturing (i.e. changing PCM Playback volume affect pulseaudio recording )
Because the internal mic appears as a stereo device, rather than a mono, applications can open it as stereo.
Only later when the resulting signal L+R is sent to a mono output does the signal "disappear".
So I'm back to wondering how to force an app (primarily PulseAudio) to see the mic as mono?
you have to ask PA developer
At Tue, 07 Dec 2010 16:11:59 +1300, Eliot Blennerhassett wrote:
Thanks Raymond,
On 03/12/10 15:33, Raymond Yau wrote:
Greetings,
There is only a single mic on this netbook. However, the alsa device shows up as stereo, and the right channel carries an inverted copy of the left channel.
http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=59c774ed5ee00e9623a20...
Commitlog was "Add route_policy copy to HDA-Intel.conf for capture Since some digital mics have the phase-inversion problem in one channel, adding both channels for mono stream results in the noise. Use route_policy copy to avoid that situation."
As far as I can guess, the commit helps when an application asks to record mono from the stereo device, by copying L rather than summing L+R
My machine already has this, however it doesn't really fix the root of the problem.
Because the internal mic appears as a stereo device, rather than a mono, applications can open it as stereo.
Only later when the resulting signal L+R is sent to a mono output does the signal "disappear".
So I'm back to wondering how to force an app (primarily PulseAudio) to see the mic as mono?
Via pulse configuration?
(I think the external jack is also only mono, at least when used as a mic input?)
I'm not sure about it. Many devices are indeed stereo mics, especially with HD-audio.
The problem is that you seem to have a PDM module for digital mics by FortMedia, which shows this behavior. I guess this was primarily for noise canceling. For Windows, FM provides a special driver, so this was handled there.
In the case of ALSA, it's not quite easy. Since the hardware really gives the stereo signal, and this isn't informed to the software side at all, the upper layer can't know it. And, reverting in the kernel side doesn't sound right, if it's only about PA. (Non-PA stuff has already a 'workaround'.)
So, we need a few steps: - Implement a kernel ABI to inform some h/w feature like this - Implement alsa-lib API to propagate it - Implement the handling in PA alsa module
Takashi
2010/12/8 Takashi Iwai tiwai@suse.de
At Tue, 07 Dec 2010 16:11:59 +1300, Eliot Blennerhassett wrote:
Thanks Raymond,
On 03/12/10 15:33, Raymond Yau wrote:
Greetings,
There is only a single mic on this netbook. However, the alsa device shows up as stereo, and the right channel carries an inverted copy of the left channel.
http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=59c774ed5ee00e9623a20...
Commitlog was "Add route_policy copy to HDA-Intel.conf for capture Since some digital mics have the phase-inversion problem in one channel, adding both channels for mono stream results in the noise. Use route_policy copy to avoid that situation."
As far as I can guess, the commit helps when an application asks to record mono from the stereo device, by copying L rather than summing L+R
My machine already has this, however it doesn't really fix the root of the problem.
Because the internal mic appears as a stereo device, rather than a mono, applications can open it as stereo.
Only later when the resulting signal L+R is sent to a mono output does the signal "disappear".
In theory , this should be (L+R)/2 for those stereo mic without phase inversion to prevent clipping occur when sent to a mono output
So I'm back to wondering how to force an app (primarily PulseAudio) to see the mic as mono?
Via pulse configuration?
PA server use SND_PCM_NO_AUTO_CHANNELS , any plugin which defined in the device string in the profile has no effect if your hardware does not support 1 channel
so you need PA to provide downmixing option for recording mono from stereo mic 1) (Left+Right)/2 2) Left 3) Right
Hi Takashi and Raymond,
just a note off-list to say thanks for your replies. Sadly no perfect solution, so I'll do some more experiments, and look closer at PA options.
regards -- Eliot
2010/12/7 Eliot Blennerhassett linux@audioscience.com
Thanks Raymond,
On 03/12/10 15:33, Raymond Yau wrote:
Greetings,
There is only a single mic on this netbook. However, the alsa device shows up as stereo, and the right channel carries an inverted copy of the left channel.
http://git.alsa-project.org/?p=alsa-lib.git;a=commit;h=59c774ed5ee00e9623a20...
Commitlog was "Add route_policy copy to HDA-Intel.conf for capture Since some digital mics have the phase-inversion problem in one channel, adding both channels for mono stream results in the noise. Use route_policy copy to avoid that situation."
As far as I can guess, the commit helps when an application asks to record mono from the stereo device, by copying L rather than summing L+R
My machine already has this, however it doesn't really fix the root of the problem.
Because the internal mic appears as a stereo device, rather than a mono, applications can open it as stereo.
Only later when the resulting signal L+R is sent to a mono output does the signal "disappear".
So I'm back to wondering how to force an app (primarily PulseAudio) to see the mic as mono?
The easy way is to mute one of the channel using capture switch while you recording and the result signal will be L/2 or R/2
Simple mixer control 'Capture',0 Capabilities: cvolume cswitch penum Capture channels: Front Left - Front Right Limits: Capture 0 - 31 Front Left: Capture 31 [100%] [30.00dB] [on] Front Right: Capture 31 [100%] [30.00dB] [on]
participants (4)
-
Eliot Blennerhassett
-
Eliot Blennerhassett
-
Raymond Yau
-
Takashi Iwai