You are not logged in.

#1 2021-12-10 04:08:27

GamingTwist
Member
Registered: 2021-04-29
Posts: 6

[SOLVED] Audio special use case, contant output and toggleable output

I am trying to setup pulseaudio/whatever can do this best.
I need when I listen to song(anything I choose to send) its sent out over the headphone port (built in card) (to a pi that does sound to light) however need to be able to switch between my headphones(keyboard sound card) and my speakers(built in card) and have the same output thought whatever is chosen.

Ideally, a virtual sound card I choose to send the application audio to would make the most sense but I am really struggling with pulseaudio.
Would love some suggestion on how to handle this.

ps might also need a loopback feature in future to do local sound to light processing.

Last edited by GamingTwist (2021-12-15 17:54:38)

Offline

#2 2021-12-10 10:42:42

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,986

Re: [SOLVED] Audio special use case, contant output and toggleable output

Needs information on your setup to give sane advice, what's your

aplay -l
amixer -c0 #Or whatever index that isn't 0 from the previous output corresponds to the card in question
pacmd list-cards
pacmd list-sinks
pacmd list-sink-inputs

(in code tags) and which sink corresponds to which part of your output chain.

Last edited by V1del (2021-12-10 14:26:01)

Offline

#3 2021-12-10 14:06:41

progandy
Member
Registered: 2012-05-17
Posts: 5,212

Re: [SOLVED] Audio special use case, contant output and toggleable output

pulseaudio has module-combine-sink to output to multiple soundcards, but as far as I know you cannot change the target cards dynamically.

With pipewire you should be able to create a null sink and then use e.g. pw-link to dynamically add/remove the links to your soundcards:
https://gitlab.freedesktop.org/pipewire … sinksource

Or you could choose to set up jack(2), I have no experience with that, though.

Edit: Sending to headphone as well as speakers on the same card may be more involved and sometimes impossible, though. (maybe using alsa tools to toggle mute and set volumes?) Please follow V1del's advice.

Last edited by progandy (2021-12-10 14:13:08)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2021-12-13 03:22:22

GamingTwist
Member
Registered: 2021-04-29
Posts: 6

Re: [SOLVED] Audio special use case, contant output and toggleable output

Sorry about the late reply something came up, thank you for the replies. So its currently setup to play through card 0 out the headphones and front. Using pipewire might be the solution if I can dynamically switch the outputs.

$ aplay -l
card 0: PCH [HDA Intel PCH], device 0: ALC1220 Analog [ALC1220 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC1220 Digital [ALC1220 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 11: HDMI 5 [HDMI 5]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Keyboard [G510s Gaming Keyboard], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
$ amixer -c0
Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 87
  Mono: Playback 52 [60%] [-26.25dB] [on]
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 70 [80%] [-12.75dB] [on]
  Front Right: Playback 70 [80%] [-12.75dB] [on]
Simple mixer control 'PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 255 [100%] [0.00dB]
  Front Right: Playback 255 [100%] [0.00dB]
Simple mixer control 'Front',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 86 [99%] [-0.75dB] [on]
  Front Right: Playback 86 [99%] [-0.75dB] [on]
Simple mixer control 'Front Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Front Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'Surround',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 86 [99%] [-0.75dB] [on]
  Front Right: Playback 86 [99%] [-0.75dB] [on]
Simple mixer control 'Center',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 87
  Mono: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'LFE',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 87
  Mono: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Line',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Line Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'IEC958 Default PCM',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 63
  Front Left: Capture 63 [100%] [30.00dB] [on]
  Front Right: Capture 63 [100%] [30.00dB] [on]
Simple mixer control 'Capture',1
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 63
  Front Left: Capture 0 [0%] [-17.25dB] [off]
  Front Right: Capture 0 [0%] [-17.25dB] [off]
Simple mixer control 'Auto-Mute Mode',0
  Capabilities: enum
  Items: 'Disabled' 'Enabled'
  Item0: 'Disabled'
Simple mixer control 'Digital',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 120
  Front Left: Capture 60 [50%] [0.00dB]
  Front Right: Capture 60 [50%] [0.00dB]
Simple mixer control 'Input Source',0
  Capabilities: cenum
  Items: 'Front Mic' 'Rear Mic' 'Line'
  Item0: 'Rear Mic'
Simple mixer control 'Input Source',1
  Capabilities: cenum
  Items: 'Front Mic' 'Rear Mic' 'Line'
  Item0: 'Front Mic'
Simple mixer control 'Loopback Mixing',0
  Capabilities: enum
  Items: 'Disabled' 'Enabled'
  Item0: 'Disabled'
Simple mixer control 'Rear Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Rear 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]
 $ amixer -c2
Simple mixer control 'PCM',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 60
  Mono: Playback 60 [100%] [3.00dB] [on]
Simple mixer control 'Mic',0
  Capabilities: cvolume cvolume-joined cswitch cswitch-joined
  Capture channels: Mono
  Limits: Capture 0 - 63
  Mono: Capture 48 [76%] [24.00dB] [on]
$ pacmd list-cards
4 card(s) available.
    index: 0
	name: <alsa_card.pci-0000_03_00.1>
	driver: <module-alsa-card.c>
	owner module: 6
	properties:
		alsa.card = "1"
		alsa.card_name = "HDA ATI HDMI"
		alsa.long_card_name = "HDA ATI HDMI at 0xefaa0000 irq 174"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:03:00.1"
		sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:00.0/0000:03:00.1/sound/card1"
		device.bus = "pci"
		device.vendor.id = "1002"
		device.vendor.name = "Advanced Micro Devices, Inc. [AMD/ATI]"
		device.product.id = "aaf8"
		device.product.name = "Vega 10 HDMI Audio [Radeon Vega 56/64]"
		device.string = "1"
		device.description = "Vega 10 HDMI Audio [Radeon Vega 56/64]"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	profiles:
		output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5900, available: no)
		output:hdmi-surround: Digital Surround 5.1 (HDMI) Output (priority 800, available: no)
		output:hdmi-surround71: Digital Surround 7.1 (HDMI) Output (priority 800, available: no)
		output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (priority 5700, available: no)
		output:hdmi-surround-extra1: Digital Surround 5.1 (HDMI 2) Output (priority 600, available: no)
		output:hdmi-surround71-extra1: Digital Surround 7.1 (HDMI 2) Output (priority 600, available: no)
		output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (priority 5700, available: no)
		output:hdmi-surround-extra2: Digital Surround 5.1 (HDMI 3) Output (priority 600, available: no)
		output:hdmi-surround71-extra2: Digital Surround 7.1 (HDMI 3) Output (priority 600, available: no)
		output:hdmi-stereo-extra3: Digital Stereo (HDMI 4) Output (priority 5700, available: no)
		output:hdmi-surround-extra3: Digital Surround 5.1 (HDMI 4) Output (priority 600, available: no)
		output:hdmi-surround71-extra3: Digital Surround 7.1 (HDMI 4) Output (priority 600, available: no)
		output:hdmi-stereo-extra4: Digital Stereo (HDMI 5) Output (priority 5700, available: no)
		output:hdmi-surround-extra4: Digital Surround 5.1 (HDMI 5) Output (priority 600, available: no)
		output:hdmi-surround71-extra4: Digital Surround 7.1 (HDMI 5) Output (priority 600, available: no)
		output:hdmi-stereo-extra5: Digital Stereo (HDMI 6) Output (priority 5700, available: no)
		output:hdmi-surround-extra5: Digital Surround 5.1 (HDMI 6) Output (priority 600, available: no)
		output:hdmi-surround71-extra5: Digital Surround 7.1 (HDMI 6) Output (priority 600, available: no)
		off: Off (priority 0, available: unknown)
	active profile: <off>
	ports:
		hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: no)
			properties:
				device.icon_name = "video-display"
		hdmi-output-1: HDMI / DisplayPort 2 (priority 5800, latency offset 0 usec, available: no)
			properties:
				device.icon_name = "video-display"
		hdmi-output-2: HDMI / DisplayPort 3 (priority 5700, latency offset 0 usec, available: no)
			properties:
				device.icon_name = "video-display"
		hdmi-output-3: HDMI / DisplayPort 4 (priority 5600, latency offset 0 usec, available: no)
			properties:
				device.icon_name = "video-display"
		hdmi-output-4: HDMI / DisplayPort 5 (priority 5500, latency offset 0 usec, available: no)
			properties:
				device.icon_name = "video-display"
		hdmi-output-5: HDMI / DisplayPort 6 (priority 5400, latency offset 0 usec, available: no)
			properties:
				device.icon_name = "video-display"
    index: 1
	name: <alsa_card.usb-HD_Web_Camera_HD_Web_Camera_Ucamera001-02>
	driver: <module-alsa-card.c>
	owner module: 7
	properties:
		alsa.card = "3"
		alsa.card_name = "HD Web Camera"
		alsa.long_card_name = "HD Web Camera HD Web Camera at usb-0000:00:14.0-10, high speed"
		alsa.driver_name = "snd_usb_audio"
		device.bus_path = "pci-0000:00:14.0-usb-0:10:1.2"
		sysfs.path = "/devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.2/sound/card3"
		udev.id = "usb-HD_Web_Camera_HD_Web_Camera_Ucamera001-02"
		device.bus = "usb"
		device.vendor.id = "05a3"
		device.vendor.name = "ARC International"
		device.product.id = "9331"
		device.product.name = "Camera"
		device.serial = "HD_Web_Camera_HD_Web_Camera_Ucamera001"
		device.form_factor = "webcam"
		device.string = "3"
		device.description = "Camera"
		module-udev-detect.discovered = "1"
		device.icon_name = "camera-web-usb"
	profiles:
		input:mono-fallback: Mono Input (priority 1, available: unknown)
		off: Off (priority 0, available: unknown)
	active profile: <input:mono-fallback>
	sources:
		alsa_input.usb-HD_Web_Camera_HD_Web_Camera_Ucamera001-02.mono-fallback/#0: Camera Mono
	ports:
		analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: unknown)
			properties:
				device.icon_name = "audio-input-microphone"
    index: 2
	name: <alsa_card.usb-Logitech_G510s_Gaming_Keyboard-02>
	driver: <module-alsa-card.c>
	owner module: 8
	properties:
		alsa.card = "2"
		alsa.card_name = "G510s Gaming Keyboard"
		alsa.long_card_name = "Logitech G510s Gaming Keyboard at usb-0000:00:14.0-7, full speed"
		alsa.driver_name = "snd_usb_audio"
		device.bus_path = "pci-0000:00:14.0-usb-0:7:1.2"
		sysfs.path = "/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.2/sound/card2"
		udev.id = "usb-Logitech_G510s_Gaming_Keyboard-02"
		device.bus = "usb"
		device.vendor.id = "046d"
		device.vendor.name = "Logitech, Inc."
		device.product.id = "c22e"
		device.product.name = "G510 Gaming Keyboard onboard audio"
		device.serial = "Logitech_G510s_Gaming_Keyboard"
		device.string = "2"
		device.description = "G510 Gaming Keyboard onboard audio"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-usb"
	profiles:
		input:mono-fallback: Mono Input (priority 1, available: unknown)
		output:analog-stereo: Analog Stereo Output (priority 6500, available: unknown)
		output:analog-stereo+input:mono-fallback: Analog Stereo Output + Mono Input (priority 6501, available: unknown)
		output:iec958-stereo: Digital Stereo (IEC958) Output (priority 5500, available: unknown)
		output:iec958-stereo+input:mono-fallback: Digital Stereo (IEC958) Output + Mono Input (priority 5501, available: unknown)
		off: Off (priority 0, available: unknown)
	active profile: <output:analog-stereo>
	sinks:
		alsa_output.usb-Logitech_G510s_Gaming_Keyboard-02.analog-stereo/#0: G510 Gaming Keyboard onboard audio Analog Stereo
	sources:
		alsa_output.usb-Logitech_G510s_Gaming_Keyboard-02.analog-stereo.monitor/#1: Monitor of G510 Gaming Keyboard onboard audio Analog Stereo
	ports:
		analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: unknown)
			properties:
				device.icon_name = "audio-input-microphone"
		analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
			properties:
				
		iec958-stereo-output: Digital Output (S/PDIF) (priority 0, latency offset 0 usec, available: unknown)
			properties:
				
    index: 3
	name: <alsa_card.pci-0000_00_1f.3>
	driver: <module-alsa-card.c>
	owner module: 9
	properties:
		alsa.card = "0"
		alsa.card_name = "HDA Intel PCH"
		alsa.long_card_name = "HDA Intel PCH at 0xeff40000 irq 173"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:00:1f.3"
		sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
		device.bus = "pci"
		device.vendor.id = "8086"
		device.vendor.name = "Intel Corporation"
		device.product.id = "a2f0"
		device.product.name = "200 Series PCH HD Audio"
		device.form_factor = "internal"
		device.string = "0"
		device.description = "Built-in Audio"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	profiles:
		input:analog-stereo: Analog Stereo Input (priority 32833, available: unknown)
		output:analog-stereo: Analog Stereo Output (priority 39268, available: unknown)
		output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 39333, available: unknown)
		output:analog-surround-21: Analog Surround 2.1 Output (priority 34068, available: unknown)
		output:analog-surround-21+input:analog-stereo: Analog Surround 2.1 Output + Analog Stereo Input (priority 34133, available: unknown)
		output:analog-surround-40: Analog Surround 4.0 Output (priority 33968, available: unknown)
		output:analog-surround-40+input:analog-stereo: Analog Surround 4.0 Output + Analog Stereo Input (priority 34033, available: unknown)
		output:analog-surround-41: Analog Surround 4.1 Output (priority 34068, available: unknown)
		output:analog-surround-41+input:analog-stereo: Analog Surround 4.1 Output + Analog Stereo Input (priority 34133, available: unknown)
		output:analog-surround-50: Analog Surround 5.0 Output (priority 33968, available: unknown)
		output:analog-surround-50+input:analog-stereo: Analog Surround 5.0 Output + Analog Stereo Input (priority 34033, available: unknown)
		output:analog-surround-51: Analog Surround 5.1 Output (priority 34068, available: unknown)
		output:analog-surround-51+input:analog-stereo: Analog Surround 5.1 Output + Analog Stereo Input (priority 34133, available: unknown)
		output:iec958-stereo: Digital Stereo (IEC958) Output (priority 38268, available: unknown)
		output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (priority 38333, available: unknown)
		off: Off (priority 0, available: unknown)
	active profile: <output:analog-surround-51+input:analog-stereo>
	sinks:
		alsa_output.pci-0000_00_1f.3.analog-surround-51/#1: Built-in Audio Analog Surround 5.1
	sources:
		alsa_output.pci-0000_00_1f.3.analog-surround-51.monitor/#2: Monitor of Built-in Audio Analog Surround 5.1
		alsa_input.pci-0000_00_1f.3.analog-stereo/#3: Built-in Audio Analog Stereo
	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: yes)
			properties:
				device.icon_name = "audio-input-microphone"
		analog-input-linein: Line In (priority 8100, latency offset 0 usec, available: no)
			properties:
				
		analog-output-lineout: Line Out (priority 9000, latency offset 0 usec, available: yes)
			properties:
				
		analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: yes)
			properties:
				device.icon_name = "audio-headphones"
		iec958-stereo-output: Digital Output (S/PDIF) (priority 0, latency offset 0 usec, available: unknown)
			properties:
				
$ pacmd list-sinks
3 sink(s) available.
  * index: 0
	name: <alsa_output.usb-Logitech_G510s_Gaming_Keyboard-02.analog-stereo>
	driver: <module-alsa-card.c>
	flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: RUNNING
	suspend cause: (none)
	priority: 9049
	volume: front-left: 64926 /  99% / -0.24 dB,   front-right: 64926 /  99% / -0.24 dB
	        balance 0.00
	base volume: 58409 /  89% / -3.00 dB
	volume steps: 65537
	muted: no
	current latency: 89.29 ms
	max request: 14 KiB
	max rewind: 14 KiB
	monitor source: 1
	sample spec: s16le 2ch 48000Hz
	channel map: front-left,front-right
	             Stereo
	used by: 1
	linked by: 11
	configured latency: 75.00 ms; range is 0.50 .. 2000.00 ms
	card: 2 <alsa_card.usb-Logitech_G510s_Gaming_Keyboard-02>
	module: 8
	properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "USB Audio"
		alsa.id = "USB Audio"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "0"
		alsa.card = "2"
		alsa.card_name = "G510s Gaming Keyboard"
		alsa.long_card_name = "Logitech G510s Gaming Keyboard at usb-0000:00:14.0-7, full speed"
		alsa.driver_name = "snd_usb_audio"
		device.bus_path = "pci-0000:00:14.0-usb-0:7:1.2"
		sysfs.path = "/devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.2/sound/card2"
		udev.id = "usb-Logitech_G510s_Gaming_Keyboard-02"
		device.bus = "usb"
		device.vendor.id = "046d"
		device.vendor.name = "Logitech, Inc."
		device.product.id = "c22e"
		device.product.name = "G510 Gaming Keyboard onboard audio"
		device.serial = "Logitech_G510s_Gaming_Keyboard"
		device.string = "front:2"
		device.buffering.buffer_size = "384000"
		device.buffering.fragment_size = "192000"
		device.access_mode = "mmap+timer"
		device.profile.name = "analog-stereo"
		device.profile.description = "Analog Stereo"
		device.description = "G510 Gaming Keyboard onboard audio Analog Stereo"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-usb"
	ports:
		analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
			properties:
				
	active port: <analog-output>
    index: 1
	name: <alsa_output.pci-0000_00_1f.3.analog-surround-51>
	driver: <module-alsa-card.c>
	flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE
	priority: 9039
	volume: front-left: 23253 /  35% / -27.00 dB,   front-right: 23253 /  35% / -27.00 dB,   rear-left: 23253 /  35% / -27.00 dB,   rear-right: 23253 /  35% / -27.00 dB,   front-center: 23932 /  37% / -26.25 dB,   lfe: 23932 /  37% / -26.25 dB
	        balance 0.00
	base volume: 65536 / 100% / 0.00 dB
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max request: 0 KiB
	max rewind: 0 KiB
	monitor source: 2
	sample spec: s16le 6ch 44100Hz
	channel map: front-left,front-right,rear-left,rear-right,front-center,lfe
	             Surround 5.1
	used by: 0
	linked by: 0
	configured latency: 0.00 ms; range is 0.50 .. 2000.00 ms
	card: 3 <alsa_card.pci-0000_00_1f.3>
	module: 9
	properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "ALC1220 Analog"
		alsa.id = "ALC1220 Analog"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "0"
		alsa.card = "0"
		alsa.card_name = "HDA Intel PCH"
		alsa.long_card_name = "HDA Intel PCH at 0xeff40000 irq 173"
		alsa.driver_name = "snd_hda_intel"
		device.bus_path = "pci-0000:00:1f.3"
		sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
		device.bus = "pci"
		device.vendor.id = "8086"
		device.vendor.name = "Intel Corporation"
		device.product.id = "a2f0"
		device.product.name = "200 Series PCH HD Audio"
		device.form_factor = "internal"
		device.string = "surround51:0"
		device.buffering.buffer_size = "1058400"
		device.buffering.fragment_size = "529200"
		device.access_mode = "mmap+timer"
		device.profile.name = "analog-surround-51"
		device.profile.description = "Analog Surround 5.1"
		device.description = "Built-in Audio Analog Surround 5.1"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	ports:
		analog-output-lineout: Line Out (priority 9000, latency offset 0 usec, available: yes)
			properties:
				
	active port: <analog-output-lineout>
    index: 2
	name: <combined>
	driver: <module-combine-sink.c>
	flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
	state: SUSPENDED
	suspend cause: IDLE
	priority: 1000
	volume: front-left: 58968 /  90% / -2.75 dB,   front-right: 58968 /  90% / -2.75 dB
	        balance 0.00
	base volume: 65536 / 100% / 0.00 dB
	volume steps: 65537
	muted: no
	current latency: 0.00 ms
	max request: 34 KiB
	max rewind: 0 KiB
	monitor source: 4
	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 .. 200.00 ms
	module: 13
	properties:
		device.class = "filter"
		device.description = "Simultaneous output to G510 Gaming Keyboard onboard audio Analog Stereo, Built-in Audio Analog Surround 5.1"
		device.icon_name = "audio-card"
$ pacmd list-sink-inputs
0 sink input(s) available.

Offline

#5 2021-12-13 04:41:58

Maniaxx
Member
Registered: 2014-05-14
Posts: 744

Re: [SOLVED] Audio special use case, contant output and toggleable output

You can use Pipewire/Jack/Carla/Crossfade  (or one of many other nodes) to route/gate your audio paths. There are GUI components (knobs, etc) to control the nodes.
There's a picture of the patchbay (backend) here: https://bbs.archlinux.org/viewtopic.php … 8#p2008188

Last edited by Maniaxx (2021-12-13 04:59:51)


sys2064

Offline

#6 2021-12-13 23:23:46

GamingTwist
Member
Registered: 2021-04-29
Posts: 6

Re: [SOLVED] Audio special use case, contant output and toggleable output

Thank for showing me Pipewire, I have switched my pc over to it much better then pulseaudio, Is there a way to split the in-built sink into 2 eg(front and headphones) or to make the headphone channel visible to Pipewire currently I only have FL and FR. If not i'll just have to deal with sending all the speaker output over headphones as well.

Worse case i'll just get a cheap USB soundcard and use that, however back in the dark days of windows this was doable so i'm not giving in yet but understand linux handles sound very differently.

Offline

#7 2021-12-14 04:53:52

progandy
Member
Registered: 2012-05-17
Posts: 5,212

Re: [SOLVED] Audio special use case, contant output and toggleable output

You can try to choose the "Pro Audio" profile (e.g. with pavucontrol) for the soundcard, but I am not sure if that splits the headphone output as well.

Last edited by progandy (2021-12-14 04:54:18)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#8 2021-12-14 07:07:22

Maniaxx
Member
Registered: 2014-05-14
Posts: 744

Re: [SOLVED] Audio special use case, contant output and toggleable output

The 'ProAudio' profile might sound different/unexpected though (bypassing internal DSPs). It shouldn't be necessary at all though. You already have two soundcards activated.

Set Carla to 'Multi-Client' engine (in Options). You should get at least one output node each for every soundcard (depending on active 'profile'). You have 2 soundcards "active" and should see two output nodes (5+1 and Stereo).

If you need more input nodes/soundcards you can use loopback devices. I personally use ALSA ones (modprobe snd_aloop). There are Pipewire/PulseAudio ones as well if i reckon correctly.

Currently, Carla might suffer from a Python3.10/PyQT issue. Using Python3.9 instead should help.
https://github.com/falkTX/Carla/issues/ … -992695321

Last edited by Maniaxx (2021-12-14 07:33:15)


sys2064

Offline

#9 2021-12-14 08:16:12

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,986

Re: [SOLVED] Audio special use case, contant output and toggleable output

For headphone split to a distinct ALSA/playback node you normally need to set some HDA hints, you probably want indep-hp: https://www.kernel.org/doc/html/latest/ … nt-strings

Offline

#10 2021-12-14 19:35:47

GamingTwist
Member
Registered: 2021-04-29
Posts: 6

Re: [SOLVED] Audio special use case, contant output and toggleable output

How do I implement this? I think the wiki was telling me to edit the /sys/class/sound/hwC0D0/reconfig file, however cant open it.

# cat /sys/class/sound/hwC0D0/reconfig
cat: /sys/class/sound/hwC0D0/reconfig: Permission denied

I tired killing all the audio stuff, even logging out and doing it over tty to make sure no sound service is running.

Offline

#11 2021-12-14 20:11:11

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,986

Re: [SOLVED] Audio special use case, contant output and toggleable output

Reconfig is write only, you need to set the hints node and then reload the configuration once that is set i.e.

# echo indep_hp = true > /sys/class/sound/hwC0D0/hints
# echo 1 > /sys/class/sound/hwC0D0/reconfig

Offline

#12 2021-12-15 00:05:31

GamingTwist
Member
Registered: 2021-04-29
Posts: 6

Re: [SOLVED] Audio special use case, contant output and toggleable output

Thank you everyone who helped me get this working. I'm going to document how this was done so this can be wrapped up and closed.

ALSA managed to split the soundcard using the hints, Had to use the ProAudio mode profile to get me the separate sinks.
Then was just a case of using PipeWire to create a virtual sink and connect to the headphone sink and whatever output I want.

Quick bash script to switch:

#!/bin/bash

output0="alsa_output.pci-0000_00_1f.3.pro-output-0"
output1="alsa_output.usb-Logitech_G510s_Gaming_Keyboard-02.analog-stereo"

current=$(pactl get-default-sink)
if [ "$current" == "$output0" ]
then
#Speakers
    pw-jack jack_connect "sound2light Audio/Sink sink Monitor:monitor_FL" "G510 Gaming Keyboard onboard audio Analog Stereo:playback_FL"
    pw-jack jack_connect "sound2light Audio/Sink sink Monitor:monitor_FR" "G510 Gaming Keyboard onboard audio Analog Stereo:playback_FR"
    pw-jack jack_disconnect "sound2light Audio/Sink sink Monitor:monitor_FL" "Built-in Audio Pro:playback_AUX0"
    pw-jack jack_disconnect "sound2light Audio/Sink sink Monitor:monitor_FR" "Built-in Audio Pro:playback_AUX1"
    value=$output1
else
#Headphones
    pw-jack jack_disconnect "sound2light Audio/Sink sink Monitor:monitor_FL" "G510 Gaming Keyboard onboard audio Analog Stereo:playback_FL"
    pw-jack jack_disconnect "sound2light Audio/Sink sink Monitor:monitor_FR" "G510 Gaming Keyboard onboard audio Analog Stereo:playback_FR"
    pw-jack jack_connect "sound2light Audio/Sink sink Monitor:monitor_FL" "Built-in Audio Pro:playback_AUX0"
    pw-jack jack_connect "sound2light Audio/Sink sink Monitor:monitor_FR" "Built-in Audio Pro:playback_AUX1"
    value=$output0
fi

pactl set-default-sink $value

Again many thanks smile

Offline

#13 2021-12-15 09:32:28

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,986

Re: [SOLVED] Audio special use case, contant output and toggleable output

Note that the hints will likely reset on reboot, so you either can make some startup script that runs these commands after the module is loaded or create a patch file as described in https://www.kernel.org/doc/html/latest/ … y-patching you'll find the codec vendor and product id and the address you need to define as part of the [codec] header in /proc/asound/card0/codec#0

Please mark as [SOLVED] by editing the title in your first post.

Offline

Board footer

Powered by FluxBB