[pulseaudio-discuss] Setting gain when plugging headphone on (non-simple) ALSA controls

Tanu Kaskinen tanuk at iki.fi
Thu Jan 21 04:54:38 PST 2016


On Wed, 2016-01-20 at 12:07 +0000, Sylvain Bougerel wrote:
> Hi all,
> 
> I have a problem of hearing white-noise on my headphones when I plug them
> in my laptop. I know the work around:
> 
> $ amixer -c 0 cset 'numid=10' 1
> numid=10,iface=MIXER,name='Headphone Mic Boost Volume'
>   ; type=INTEGER,access=rw---R--,values=2,min=0,max=3,step=0
>   : values=1,1
>   | dBscale-min=0.00dB,step=10.00dB,mute=0
> 
> OR
> 
> $ amixer -c0 sset 'Headphone Mic Boost' 1
> Simple mixer control 'Headphone Mic Boost',0
>   Capabilities: volume
>   Playback channels: Front Left - Front Right
>   Capture channels: Front Left - Front Right
>   Limits: 0 - 3
>   Front Left: 1 [33%] [10.00dB]
>   Front Right: 1 [33%] [10.00dB]
> 
> Done, no more white noise. It's all well, but the settings are not
> remembered; every time pulseaudio restarts (when I login to my Desktop,
> basically):
> 
> $ amixer -c 0 cget 'numid=10'
> numid=10,iface=MIXER,name='Headphone Mic Boost Volume'
>   ; type=INTEGER,access=rw---R--,values=2,min=0,max=3,step=0
>   : values=0,0
>   | dBscale-min=0.00dB,step=10.00dB,mute=0
> 
> Notice the 0,0? And the white noise is back.
> 
> So my end goal is to find my way into hacking pulseaudio so that this is
> taken care of without having to do it myself via command line everytime I
> use my headphones.
> 
> That's where my understanding of things starts to break down. Basically, I
> think it's not possible to control this property in pulseaudio at the
> moment, so I may need to write/update a module (frankly I'm not actually
> sure of that - but I'm not afraid of coding C). I started reading the
> coding page on the pulseaudio modules of freedesktop.org, but that did not
> really inspire me to find a solution to my issue. So I would like to know
> if one of you could guide me a bit.
> 
> To help you guide me, I dump the output of a few commands, which I hope
> you'll find useful.
> 
> Looking forward to hearing from you soon,
> Sylvain

It's weird that a mic boost would affect headphone output. One
explanation would be that the mic signal is fed directly to the
headphones, but in that case increasing the boost should increase the
noise, not decrease it. I guess it's a hardware or driver bug.

To work around this, you can remove the [Element Headphone Mic Boost]
sections from these two files:

/usr/share/pulseaudio/alsa-mixer/paths/analog-input-internal-mic.conf
/usr/share/pulseuadio/alsa-mixer/paths/analog-input-headphone-mic.conf

After that PulseAudio won't touch the boost volume any more.

Whenever pulseaudio is updated, the package manager will remove your
modifications, so you have to redo the modifications. That's still
better than having to reset the mixer after every reboot...

-- 
Tanu


More information about the pulseaudio-discuss mailing list