You are not logged in.

#1 2024-06-06 18:47:15

quellen
Member
From: Italy
Registered: 2014-05-24
Posts: 316

[SOLVED] snd-aloop for pipewire (pw-loopback)

hello,
for some reasons I had to delete pulseaudio and install pipewire-pulse instead. But I noticed that the snd-aloop module doesn't work on pipewire. is there any alternative?

i have tried to run pw-loopback but when I play an audio there is a deafening sound! o_O

Last edited by quellen (2024-06-07 10:22:08)


sorry for my bad english

Offline

#2 2024-06-06 23:47:15

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,447

Re: [SOLVED] snd-aloop for pipewire (pw-loopback)

pw-loopback is the way to do this, but "deafening sound" isn't a good problem description.

Maybe start more high level, what exactly is your end goal? do you need a loopback for a specific device/all of them/do you want to loopback for output/input? Maybe produce the "deafening sound" situation and then post

pactl list sinks
pactl list sink-inputs
pactl list sources
pactl list source-outputs

Offline

#3 2024-06-07 08:44:23

quellen
Member
From: Italy
Registered: 2014-05-24
Posts: 316

Re: [SOLVED] snd-aloop for pipewire (pw-loopback)

V1del wrote:

pw-loopback is the way to do this, but "deafening sound" isn't a good problem description.

i made a video:
https://www.veed.io/view/f401cad4-767b- … 8bc461cdb5

V1del wrote:

do you need a loopback for a specific device/all of them/do you want to loopback for output/input?

I need a loopback because sometimes I use https://www.speechtexter.com/, which is a site that converts speech to text. But that site only works with the microphone so I have to make sure that the internal audio of the PC is detected as if it were a microphone.
with snd-alopp+pulseaudio it worked perfectly.

$ pactl list sinks
Sink #49
	State: IDLE
	Name: alsa_output.pci-0000_04_00.6.analog-stereo
	Description: Family 17h/19h HD Audio Controller Stereo analogico
	Driver: PipeWire
	Sample Specification: s32le 2ch 48000Hz
	Channel Map: front-left,front-right
	Owner Module: 4294967295
	Mute: no
	Volume: front-left: 26214 /  40% / -23,88 dB,   front-right: 26214 /  40% / -23,88 dB
	        balance 0,00
	Base Volume: 65536 / 100% / 0,00 dB
	Monitor Source: alsa_output.pci-0000_04_00.6.analog-stereo.monitor
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
	Properties:
		alsa.card = "1"
		alsa.card_name = "HD-Audio Generic"
		alsa.class = "generic"
		alsa.components = "HDA:10ec0897,18498898,00100402"
		alsa.device = "0"
		alsa.driver_name = "snd_hda_intel"
		alsa.id = "Generic_1"
		alsa.long_card_name = "HD-Audio Generic at 0xfcd80000 irq 62"
		alsa.mixer_name = "Realtek ALC897"
		alsa.name = "ALC897 Analog"
		alsa.resolution_bits = "16"
		alsa.subclass = "generic-mix"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		api.alsa.card.longname = "HD-Audio Generic at 0xfcd80000 irq 62"
		api.alsa.card.name = "HD-Audio Generic"
		api.alsa.path = "front:1"
		api.alsa.pcm.card = "1"
		api.alsa.pcm.stream = "playback"
		audio.channels = "2"
		audio.position = "FL,FR"
		card.profile.device = "4"
		device.api = "alsa"
		device.class = "sound"
		device.id = "41"
		device.profile.description = "Stereo analogico"
		device.profile.name = "analog-stereo"
		device.routes = "2"
		factory.name = "api.alsa.pcm.sink"
		media.class = "Audio/Sink"
		device.description = "Family 17h/19h HD Audio Controller"
		node.name = "alsa_output.pci-0000_04_00.6.analog-stereo"
		node.nick = "ALC897 Analog"
		node.pause-on-idle = "false"
		object.path = "alsa:pcm:1:front:1:playback"
		priority.driver = "1009"
		priority.session = "1009"
		factory.id = "18"
		clock.quantum-limit = "8192"
		client.id = "39"
		node.driver = "true"
		factory.mode = "merge"
		audio.adapt.follower = ""
		library.name = "audioconvert/libspa-audioconvert"
		object.id = "49"
		object.serial = "49"
		node.max-latency = "16384/48000"
		api.alsa.period-size = "1024"
		api.alsa.period-num = "32"
		api.alsa.headroom = "0"
		api.acp.auto-port = "false"
		api.alsa.card = "1"
		api.alsa.use-acp = "true"
		api.dbus.ReserveDevice1 = "Audio1"
		api.dbus.ReserveDevice1.Priority = "-20"
		device.bus = "pci"
		device.bus_path = "pci-0000:04:00.6"
		device.enum.api = "udev"
		device.icon_name = "audio-card-analog-pci"
		device.name = "alsa_card.pci-0000_04_00.6"
		device.nick = "HD-Audio Generic"
		device.plugged.usec = "6397544"
		device.product.id = "0x15e3"
		device.product.name = "Family 17h/19h HD Audio Controller"
		device.subsystem = "sound"
		sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:04:00.6/sound/card1"
		device.vendor.id = "0x1022"
		device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
		device.string = "1"
	Ports:
		analog-output-lineout: Linea di uscita (type: Line, priority: 9000, availability group: Legacy 4, available)
		analog-output-headphones: Cuffie analogiche (type: Headphones, priority: 9900, availability group: Legacy 5, not available)
	Active Port: analog-output-lineout
	Formats:
		pcm
$ pactl list sink-inputs
$ pactl list sources
Source #49
	State: IDLE
	Name: alsa_output.pci-0000_04_00.6.analog-stereo.monitor
	Description: Monitor of Family 17h/19h HD Audio Controller Stereo analogico
	Driver: PipeWire
	Sample Specification: s32le 2ch 48000Hz
	Channel Map: front-left,front-right
	Owner Module: 4294967295
	Mute: no
	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
	Monitor of Sink: alsa_output.pci-0000_04_00.6.analog-stereo
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE DECIBEL_VOLUME LATENCY 
	Properties:
		alsa.card = "1"
		alsa.card_name = "HD-Audio Generic"
		alsa.class = "generic"
		alsa.components = "HDA:10ec0897,18498898,00100402"
		alsa.device = "0"
		alsa.driver_name = "snd_hda_intel"
		alsa.id = "Generic_1"
		alsa.long_card_name = "HD-Audio Generic at 0xfcd80000 irq 62"
		alsa.mixer_name = "Realtek ALC897"
		alsa.name = "ALC897 Analog"
		alsa.resolution_bits = "16"
		alsa.subclass = "generic-mix"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		api.alsa.card.longname = "HD-Audio Generic at 0xfcd80000 irq 62"
		api.alsa.card.name = "HD-Audio Generic"
		api.alsa.path = "front:1"
		api.alsa.pcm.card = "1"
		api.alsa.pcm.stream = "playback"
		audio.channels = "2"
		audio.position = "FL,FR"
		card.profile.device = "4"
		device.api = "alsa"
		device.class = "monitor"
		device.id = "41"
		device.profile.description = "Stereo analogico"
		device.profile.name = "analog-stereo"
		device.routes = "2"
		factory.name = "api.alsa.pcm.sink"
		media.class = "Audio/Sink"
		device.description = "Family 17h/19h HD Audio Controller"
		node.name = "alsa_output.pci-0000_04_00.6.analog-stereo"
		node.nick = "ALC897 Analog"
		node.pause-on-idle = "false"
		object.path = "alsa:pcm:1:front:1:playback"
		priority.driver = "1009"
		priority.session = "1009"
		factory.id = "18"
		clock.quantum-limit = "8192"
		client.id = "39"
		node.driver = "true"
		factory.mode = "merge"
		audio.adapt.follower = ""
		library.name = "audioconvert/libspa-audioconvert"
		object.id = "49"
		object.serial = "49"
		node.max-latency = "16384/48000"
		api.alsa.period-size = "1024"
		api.alsa.period-num = "32"
		api.alsa.headroom = "0"
		api.acp.auto-port = "false"
		api.alsa.card = "1"
		api.alsa.use-acp = "true"
		api.dbus.ReserveDevice1 = "Audio1"
		api.dbus.ReserveDevice1.Priority = "-20"
		device.bus = "pci"
		device.bus_path = "pci-0000:04:00.6"
		device.enum.api = "udev"
		device.icon_name = "audio-card-analog-pci"
		device.name = "alsa_card.pci-0000_04_00.6"
		device.nick = "HD-Audio Generic"
		device.plugged.usec = "6397544"
		device.product.id = "0x15e3"
		device.product.name = "Family 17h/19h HD Audio Controller"
		device.subsystem = "sound"
		sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:04:00.6/sound/card1"
		device.vendor.id = "0x1022"
		device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
		device.string = "1"
	Ports:
		analog-output-lineout: Linea di uscita (type: Line, priority: 9000, availability group: Legacy 4, available)
		analog-output-headphones: Cuffie analogiche (type: Headphones, priority: 9900, availability group: Legacy 5, not available)
	Active Port: analog-output-lineout
	Formats:
		pcm

Source #50
	State: SUSPENDED
	Name: alsa_input.pci-0000_04_00.6.analog-stereo
	Description: Family 17h/19h HD Audio Controller Stereo analogico
	Driver: PipeWire
	Sample Specification: s32le 2ch 48000Hz
	Channel Map: front-left,front-right
	Owner Module: 4294967295
	Mute: no
	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
	Monitor of Sink: n/a
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE DECIBEL_VOLUME LATENCY 
	Properties:
		alsa.card = "1"
		alsa.card_name = "HD-Audio Generic"
		alsa.class = "generic"
		alsa.components = "HDA:10ec0897,18498898,00100402"
		alsa.device = "0"
		alsa.driver_name = "snd_hda_intel"
		alsa.id = "Generic_1"
		alsa.long_card_name = "HD-Audio Generic at 0xfcd80000 irq 62"
		alsa.mixer_name = "Realtek ALC897"
		alsa.name = "ALC897 Analog"
		alsa.resolution_bits = "16"
		alsa.subclass = "generic-mix"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		api.alsa.card.longname = "HD-Audio Generic at 0xfcd80000 irq 62"
		api.alsa.card.name = "HD-Audio Generic"
		api.alsa.path = "front:1"
		api.alsa.pcm.card = "1"
		api.alsa.pcm.stream = "capture"
		audio.channels = "2"
		audio.position = "FL,FR"
		card.profile.device = "0"
		device.api = "alsa"
		device.class = "sound"
		device.id = "41"
		device.profile.description = "Stereo analogico"
		device.profile.name = "analog-stereo"
		device.routes = "3"
		factory.name = "api.alsa.pcm.source"
		media.class = "Audio/Source"
		device.description = "Family 17h/19h HD Audio Controller"
		node.name = "alsa_input.pci-0000_04_00.6.analog-stereo"
		node.nick = "ALC897 Analog"
		node.pause-on-idle = "false"
		object.path = "alsa:pcm:1:front:1:capture"
		priority.driver = "2009"
		priority.session = "2009"
		factory.id = "18"
		clock.quantum-limit = "8192"
		client.id = "39"
		node.driver = "true"
		factory.mode = "split"
		audio.adapt.follower = ""
		library.name = "audioconvert/libspa-audioconvert"
		object.id = "50"
		object.serial = "50"
		api.acp.auto-port = "false"
		api.alsa.card = "1"
		api.alsa.use-acp = "true"
		api.dbus.ReserveDevice1 = "Audio1"
		api.dbus.ReserveDevice1.Priority = "-20"
		device.bus = "pci"
		device.bus_path = "pci-0000:04:00.6"
		device.enum.api = "udev"
		device.icon_name = "audio-card-analog-pci"
		device.name = "alsa_card.pci-0000_04_00.6"
		device.nick = "HD-Audio Generic"
		device.plugged.usec = "6397544"
		device.product.id = "0x15e3"
		device.product.name = "Family 17h/19h HD Audio Controller"
		device.subsystem = "sound"
		sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:04:00.6/sound/card1"
		device.vendor.id = "0x1022"
		device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
		device.string = "1"
	Ports:
		analog-input-front-mic: Microfono anteriore (type: Mic, priority: 8500, availability group: Legacy 1, not available)
		analog-input-rear-mic: Microfono posteriore (type: Mic, priority: 8200, availability group: Legacy 2, not available)
		analog-input-linein: Linea di ingresso (type: Line, priority: 8100, availability group: Legacy 3, not available)
	Active Port: analog-input-front-mic
	Formats:
		pcm
$ pactl list source-outputs
Source Output #73
	Driver: PipeWire
	Owner Module: n/a
	Client: 72
	Source: 49
	Sample Specification: s16le 2ch 48000Hz
	Channel Map: front-left,front-right
	Format: pcm, format.sample_format = "\"s16le\""  format.rate = "48000"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
	Corked: no
	Mute: no
	Volume: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB
	        balance 0,00
	Buffer Latency: 0 usec
	Source Latency: 0 usec
	Resample method: PipeWire
	Properties:
		client.api = "pipewire-pulse"
		pulse.server.type = "unix"
		application.name = "SimpleScreenRecorder"
		application.process.id = "716"
		application.process.user = "topo"
		application.process.host = "linux"
		application.process.binary = "simplescreenrecorder"
		application.language = "it_IT.UTF-8"
		window.x11.display = ":0"
		application.process.machine_id = "e24708286a38441f96bca3ba4efeb60b"
		application.process.session_id = "1"
		media.name = "SimpleScreenRecorder input"
		node.rate = "1/48000"
		node.latency = "1024/48000"
		target.object = "alsa_output.pci-0000_04_00.6.analog-stereo"
		stream.capture.sink = "true"
		stream.is-live = "true"
		node.name = "SimpleScreenRecorder"
		node.want-driver = "true"
		node.autoconnect = "true"
		media.class = "Stream/Input/Audio"
		adapt.follower.spa-node = ""
		object.register = "false"
		factory.id = "6"
		clock.quantum-limit = "8192"
		factory.mode = "merge"
		audio.adapt.follower = ""
		library.name = "audioconvert/libspa-audioconvert"
		client.id = "59"
		object.id = "60"
		object.serial = "73"
		pulse.attr.maxlength = "4194304"
		pulse.attr.fragsize = "4096"
		module-stream-restore.id = "source-output-by-application-name:SimpleScreenRecorder"

EDIT:
if after starting pw-loopback I open pavucontrol and disable the audio of pw-loopback the deafening sound is no longer there, but I can't get it to detect it as a microphone from the speechtexter.com site
Schermata-del-2024-06-07-10-52-49.jpg

Last edited by quellen (2024-06-07 08:54:53)


sorry for my bad english

Offline

#4 2024-06-07 10:01:38

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,447

Re: [SOLVED] snd-aloop for pipewire (pw-loopback)

snd-aloop is a kernel module and "generally" agnostic to whether you're running pipewire or pulseaudio, but shouldn't be necessary either because doing this natively in pw/pulse might be easier/more performant.

These outputs would be more interesting after creating the loopback, I'm assuming they are from before?

In any case try

pactl load-module module-virtual-source source_name='Loopback' master=alsa_input.pci-0000_04_00.6.analog-stereo.monitor

you should be able to generally do the same with pw-loopback, I'm suspecting you'd need to pass the -C or -P arguments to properly direct it to a correct node, but I'm more familiar with the pulse syntax so that's what I'm using.

Last edited by V1del (2024-06-07 10:16:33)

Offline

#5 2024-06-07 10:21:47

quellen
Member
From: Italy
Registered: 2014-05-24
Posts: 316

Re: [SOLVED] snd-aloop for pipewire (pw-loopback)

V1del wrote:

In any case try

pactl load-module module-virtual-source source_name='Loopback' master=alsa_input.pci-0000_04_00.6.analog-stereo.monitor

it works! THANK YOU!!!
to load it at startup I put it on my openbox autostart, is this ok or is there a better method?

EDIT:
I noticed that now that after loading that module the main system volume has dropped to 36% and every time I start the PC I have to restore it manually with alsamixer. Why?
Schermata-del-2024-06-07-12-27-52.png

Last edited by quellen (2024-06-07 10:29:53)


sorry for my bad english

Offline

#6 2024-06-07 13:11:23

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,447

Re: [SOLVED] snd-aloop for pipewire (pw-loopback)

Try using

pactl load-module module-virtual-source source_name='Loopback' master=alsa_input.pci-0000_04_00.6.analog-stereo.monitor use_volume_sharing=no

instead, so the loopbacks volume isn't tied to the actual master vol.

As for better place, you can do it there, better would be in a pipewire sourced config file whenever pipewire starts, create a file in /etc/pipewire/pipewire-pulse.conf.d/loadLoopback.conf with

pulse.cmd = [
    { cmd = "load-module" args = "module-always-sink" flags = [ ] }
    { cmd = "load-module" args = "module-virtual-source source_name=Loopback master=alsa_input.pci-0000_04_00.6.analog-stereo.monitor use_volume_sharing=no" flags = [ nofail ]}
]

Offline

#7 2024-12-05 12:12:07

quellen
Member
From: Italy
Registered: 2014-05-24
Posts: 316

Re: [SOLVED] snd-aloop for pipewire (pw-loopback)

V1del wrote:

As for better place, you can do it there, better would be in a pipewire sourced config file whenever pipewire starts, create a file in /etc/pipewire/pipewire-pulse.conf.d/loadLoopback.conf with

pulse.cmd = [
    { cmd = "load-module" args = "module-always-sink" flags = [ ] }
    { cmd = "load-module" args = "module-virtual-source source_name=Loopback master=alsa_input.pci-0000_04_00.6.analog-stereo.monitor use_volume_sharing=no" flags = [ nofail ]}
]

sorry for the delay in replying, the solution you proposed doesn't work. I added those lines but when the PC starts the loopback section is not created

$ cat /etc/pipewire/pipewire-pulse.conf.d/loadLoopback.conf
pulse.cmd = [
    { cmd = "load-module" args = "module-always-sink" flags = [ ] }
    { cmd = "load-module" args = "module-virtual-source source_name=Loopback master=alsa_input.pci-0000_04_00.6.analog-stereo.monitor use_volume_sharing=no" flags = [ nofail ]}
]

if i start it manually it works:

pactl load-module module-virtual-source source_name='Loopback' master=alsa_input.pci-0000_04_00.6.analog-stereo.monitor

Last edited by quellen (2024-12-05 12:13:04)


sorry for my bad english

Offline

Board footer

Powered by FluxBB