2

I need to use command line to change from analog audio to hdmi audio.

pacmd list-sources
3 source(s) available.
    index: 131
    name: <alsa_output.pci-0000_01_00.1.hdmi-stereo-extra3.monitor>
    driver: <module-alsa-card.c>
    flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
    state: RUNNING
    suspend cause: 
    priority: 1050
    volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
            balance 0.00
    base volume: 65536 / 100% / 0.00 dB
    volume steps: 65537
    muted: no
    current latency: 0.00 ms
    max rewind: 64 KiB
    sample spec: s16le 2ch 44100Hz
    channel map: front-left,front-right
                 Stereo
    used by: 1
    linked by: 1
    configured latency: 40.00 ms; range is 0.50 .. 371.52 ms
    monitor_of: 122
    card: 0 <alsa_card.pci-0000_01_00.1>
    module: 6
    properties:
        device.description = "Monitor of GF108 High Definition Audio Controller Digital Stereo (HDMI 4)"
        device.class = "monitor"
        alsa.card = "1"
        alsa.card_name = "HDA NVidia"
        alsa.long_card_name = "HDA NVidia at 0xf7efc000 irq 17"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:01:00.1"
        sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1"
        device.bus = "pci"
        device.vendor.id = "10de"
        device.vendor.name = "NVIDIA Corporation"
        device.product.id = "0bea"
        device.product.name = "GF108 High Definition Audio Controller"
        device.string = "1"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
  * index: 132
    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: RUNNING
    suspend cause: 
    priority: 9959
    volume: front-left: 65540 / 100% / 0.00 dB,   front-right: 65540 / 100% / 0.00 dB
            balance 0.00
    base volume: 6554 /  10% / -60.00 dB
    volume steps: 65537
    muted: yes
    current latency: 0.06 ms
    max rewind: 0 KiB
    sample spec: s16le 2ch 44100Hz
    channel map: front-left,front-right
                 Stereo
    used by: 1
    linked by: 1
    configured latency: 40.00 ms; range is 8.00 .. 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 = "ALC892 Analog"
        alsa.id = "ALC892 Analog"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "0"
        alsa.card = "0"
        alsa.card_name = "HDA Intel MID"
        alsa.long_card_name = "HDA Intel MID at 0xf5ff8000 irq 29"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:00:1b.0"
        sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
        device.bus = "pci"
        device.vendor.id = "8086"
        device.vendor.name = "Intel Corporation"
        device.product.id = "3b56"
        device.product.name = "5 Series/3400 Series Chipset High Definition Audio"
        device.form_factor = "internal"
        device.string = "front:0"
        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 ALC892"
        alsa.components = "HDA:10ec0892,10438436,00100302"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    ports:
        analog-input-front-mic: Front Microphone (priority 8500, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-input-rear-mic: Rear Microphone (priority 8200, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-input-linein: Line In (priority 8100, latency offset 0 usec, available: no)
            properties:

    active port: <analog-input-rear-mic>
    index: 242
    name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>
    driver: <module-alsa-card.c>
    flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
    state: RUNNING
    suspend cause: 
    priority: 1950
    volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
            balance 0.00
    base volume: 65536 / 100% / 0.00 dB
    volume steps: 65537
    muted: no
    current latency: 0.00 ms
    max rewind: 64 KiB
    sample spec: s16le 2ch 44100Hz
    channel map: front-left,front-right
                 Stereo
    used by: 2
    linked by: 2
    configured latency: 40.00 ms; range is 0.50 .. 371.52 ms
    monitor_of: 232
    card: 1 <alsa_card.pci-0000_00_1b.0>
    module: 7
    properties:
        device.description = "Monitor of Built-in Audio Analog Stereo"
        device.class = "monitor"
        alsa.card = "0"
        alsa.card_name = "HDA Intel MID"
        alsa.long_card_name = "HDA Intel MID at 0xf5ff8000 irq 29"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:00:1b.0"
        sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
        device.bus = "pci"
        device.vendor.id = "8086"
        device.vendor.name = "Intel Corporation"
        device.product.id = "3b56"
        device.product.name = "5 Series/3400 Series Chipset High Definition Audio"
        device.form_factor = "internal"
        device.string = "0"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"

In the past I could change from MOBO analog audio out to ZOTAC HDMI audio out by using:

pactl set-card-profile 0 output:hdmi-stereo

and

pacmd set-card-profile 0 output:analog-stereo

But that was when I had a GPU that got the audio via SPDIF from MOBO to GPU. Now I have a GPU that gets it directly from PCIe slot.

What command do I need to use? I know it works fine in the GUI control. I just need it to work by command line. The part that toggles the displays already works.

Pablo Bianchi
  • 15,657

1 Answers1

2

It depends on your case. I change from HDMI to Analog with

pacmd set-card-profile 0 "output:hdmi-stereo-extra1+input:analog-stereo" # To HDMI

and

pacmd set-card-profile 0 "output:analog-stereo+input:analog-stereo" # To analog

You might want to put these on an alias.

Check my related answer here.

Pablo Bianchi
  • 15,657
  • I ended up going with a different solution by creating a mixed channel so now the audio goes to analog and digital simultaneously. – primuspaul May 23 '20 at 03:17