Debian – Changing PulseAudio Source port: ‘availability=no’ and priority

audiodebianpulseaudiothinkpad

I have a Thinkpad T450s, which comes with three 'real' mic inputs: an internal mic array (physical mics are on the LCD bezel beside the webcam), a 'line in' via a combined headphone/microphone 4-pole jack, and a 'line in' via the docking port. PulseAudio shows all three as ports belonging to a single ALSA source (see 'pacmd list-sources' output below).

  * index: 2
    name: <alsa_input.pci-0000_00_1b.0.analog-stereo>
    driver: <module-alsa-card.c>
    flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
    state: SUSPENDED
    suspend cause: IDLE 
    priority: 9959
    volume: front-left: 23093 /  35% / -27.18 dB,   front-right: 23093 /  35% / -27.18 dB
            balance 0.00
    base volume: 13076 /  20% / -42.00 dB
    volume steps: 65537
    muted: no
    current latency: 0.00 ms
    max rewind: 0 KiB
    sample spec: s16le 2ch 44100Hz
    channel map: front-left,front-right
                 Stereo
    used by: 0
    linked by: 0
    configured latency: 0.00 ms; range is 0.50 .. 371.52 ms
    card: 1 <alsa_card.pci-0000_00_1b.0>
    module: 7
    properties:
        alsa.resolution_bits = "16"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = "ALC3232 Analog"
        alsa.id = "ALC3232 Analog"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "0"
        alsa.card = "1"
        alsa.card_name = "HDA Intel PCH"
        alsa.long_card_name = "HDA Intel PCH at 0xe1234000 irq 47"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:00:1b.0"
        sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card1"
        device.bus = "pci"
        device.vendor.id = "8086"
        device.vendor.name = "Intel Corporation"
        device.product.id = "9ca0"
        device.product.name = "Wildcat Point-LP High Definition Audio Controller"
        device.form_factor = "internal"
        device.string = "front:1"
        device.buffering.buffer_size = "65536"
        device.buffering.fragment_size = "32768"
        device.access_mode = "mmap+timer"
        device.profile.name = "analog-stereo"
        device.profile.description = "Analog Stereo"
        device.description = "Built-in Audio Analog Stereo"
        alsa.mixer_name = "Realtek ALC3232"
        alsa.components = "HDA:10ec0292,17aa5036,00100001"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    ports:
        analog-input-internal-mic: Internal Microphone (priority 8900, latency offset 0 usec, available: unknown)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-input-dock-mic: Dock Microphone (priority 7800, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-input-microphone"
    active port: <analog-input-internal-mic>

The current behaviour is that when neither line-ins are attached (headphone/mic jack is empty, laptop undocked), the internal mic array is active (as seen above in the pacmd output). However, when a line-in is attached via the headphone/mic jack, as in when a smartphone-intended 4-pole set of earbuds is plugged in, the ALSA source switches ports to the line-in port 'analog-input-mic'. Availability of the internal mic array port 'analog-input-internal-mic' now shows as 'no'. See below.

...
    ports:
        analog-input-internal-mic: Internal Microphone (priority 8900, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-input-dock-mic: Dock Microphone (priority 7800, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: yes)
            properties:
                device.icon_name = "audio-input-microphone"
    active port: <analog-input-mic>

I'd like to change the behaviour such that no matter what, the internal mic array takes precedence, as the internal mic array's sound quality is superior to the mics I have. This has two problems:

  1. Availability of the internal mic port changes to 'no', such that if I manually change the port ('pacmd set-source-port 2 analog-input-internal-mic') there is no actual sound input

  2. The priority of the internal mic port is seemingly lower than both other ports, meaning that even if I got around the availability issue, I would have to manually set it via pavucontrol or pacmd every time I plugged in a mic via the jack

I am sure that this is a software/firmware issue, because I have the behaviour set exactly as desired in Windows.

Is there any way around these problems? This is somewhat of a last-ditch effort to find a solution, as it seems that this is a low-level ALSA driver issue (availability) as well as something 99.99% of users would never touch (port priority). Any input is appreciated, there is essentially no documentation concerning PulseAudio ports other than 'pacmd set-sink-port/set-source-port' that I could find.

  • System: Thinkpad T450s
  • Distro: Debian Testing (stretch)

Best Answer

I need set my analog-input-headphone-mic "disable/no", and found this post https://bugs.freedesktop.org/show_bug.cgi?id=101798.

In file /usr/share/pulseaudio/alsa-mixer/paths/nalog-input-headphone-mic.conf, in block [General] priority = 88 change the priority,

and in block

[Jack Headphone Mic] required-any = any state.plugged =unknown

change "unknown" to "no". Now "analog-input-headphone-mic" is "no"

 ports:
            analog-input-internal-mic: Internal Microphone (priority 8900, latency offset 0 usec, available: yes)
                    properties:
                            device.icon_name = "audio-input-microphone"
            analog-input-headphone-mic: Microphone (priority 8700, latency offset 0 usec, available: no)
                    properties:
                            device.icon_name = "audio-input-microphone"
            analog-input-headset-mic: Headset Microphone (priority 8800, latency offset 0 usec, available: yes)
                    properties:
                            device.icon_name = "audio-input-microphone"
    active port: <analog-input-internal-mic>
Related Question