All of lore.kernel.org
 help / color / mirror / Atom feed
* Help wanted: emachines em350 internal mic
@ 2010-11-30  6:56 Eliot Blennerhassett
  0 siblings, 0 replies; 8+ messages in thread
From: Eliot Blennerhassett @ 2010-11-30  6:56 UTC (permalink / raw)
  To: alsa-devel

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.

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.

Note more info about this 'card' can be found attached to
https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/639846

thanks and regards

Eliot

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Help wanted: emachines em350 internal mic
@ 2010-12-03  2:33 Raymond Yau
  2010-12-07  3:11 ` Eliot Blennerhassett
  0 siblings, 1 reply; 8+ messages in thread
From: Raymond Yau @ 2010-12-03  2:33 UTC (permalink / raw)
  To: ALSA Development Mailing List

>> 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=59c774ed5ee00e9623a204c3234191d6a6d8cf7a


>> 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Help wanted: emachines em350 internal mic
  2010-12-03  2:33 Help wanted: emachines em350 internal mic Raymond Yau
@ 2010-12-07  3:11 ` Eliot Blennerhassett
  2010-12-07  3:43   ` Raymond Yau
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Eliot Blennerhassett @ 2010-12-07  3:11 UTC (permalink / raw)
  To: Raymond Yau; +Cc: Takashi Iwai, ALSA Development Mailing List

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=59c774ed5ee00e9623a204c3234191d6a6d8cf7a

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.


-- 
Eliot Blennerhassett
AudioScience Inc.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Help wanted: emachines em350 internal mic
  2010-12-07  3:11 ` Eliot Blennerhassett
@ 2010-12-07  3:43   ` Raymond Yau
  2010-12-07 16:12   ` Takashi Iwai
  2010-12-08  7:12   ` Raymond Yau
  2 siblings, 0 replies; 8+ messages in thread
From: Raymond Yau @ 2010-12-07  3:43 UTC (permalink / raw)
  To: ALSA Development Mailing List

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=59c774ed5ee00e9623a204c3234191d6a6d8cf7a
>
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Help wanted: emachines em350 internal mic
  2010-12-07  3:11 ` Eliot Blennerhassett
  2010-12-07  3:43   ` Raymond Yau
@ 2010-12-07 16:12   ` Takashi Iwai
  2010-12-08  4:13     ` Raymond Yau
  2010-12-09 20:27     ` Eliot Blennerhassett
  2010-12-08  7:12   ` Raymond Yau
  2 siblings, 2 replies; 8+ messages in thread
From: Takashi Iwai @ 2010-12-07 16:12 UTC (permalink / raw)
  To: Eliot Blennerhassett; +Cc: Raymond Yau, ALSA Development Mailing List

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=59c774ed5ee00e9623a204c3234191d6a6d8cf7a
> 
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Help wanted: emachines em350 internal mic
  2010-12-07 16:12   ` Takashi Iwai
@ 2010-12-08  4:13     ` Raymond Yau
  2010-12-09 20:27     ` Eliot Blennerhassett
  1 sibling, 0 replies; 8+ messages in thread
From: Raymond Yau @ 2010-12-08  4:13 UTC (permalink / raw)
  To: ALSA Development Mailing List

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=59c774ed5ee00e9623a204c3234191d6a6d8cf7a
> >
> > 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Help wanted: emachines em350 internal mic
  2010-12-07  3:11 ` Eliot Blennerhassett
  2010-12-07  3:43   ` Raymond Yau
  2010-12-07 16:12   ` Takashi Iwai
@ 2010-12-08  7:12   ` Raymond Yau
  2 siblings, 0 replies; 8+ messages in thread
From: Raymond Yau @ 2010-12-08  7:12 UTC (permalink / raw)
  To: ALSA Development Mailing List

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=59c774ed5ee00e9623a204c3234191d6a6d8cf7a
>
> 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]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Help wanted: emachines em350 internal mic
  2010-12-07 16:12   ` Takashi Iwai
  2010-12-08  4:13     ` Raymond Yau
@ 2010-12-09 20:27     ` Eliot Blennerhassett
  1 sibling, 0 replies; 8+ messages in thread
From: Eliot Blennerhassett @ 2010-12-09 20:27 UTC (permalink / raw)
  To: alsa-devel; +Cc: Raymond Yau

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-12-09 20:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-03  2:33 Help wanted: emachines em350 internal mic Raymond Yau
2010-12-07  3:11 ` Eliot Blennerhassett
2010-12-07  3:43   ` Raymond Yau
2010-12-07 16:12   ` Takashi Iwai
2010-12-08  4:13     ` Raymond Yau
2010-12-09 20:27     ` Eliot Blennerhassett
2010-12-08  7:12   ` Raymond Yau
  -- strict thread matches above, loose matches on Subject: below --
2010-11-30  6:56 Eliot Blennerhassett

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.