Howto mix line pulseaudio: Difference between revisions

From Vidalinux Wiki
Jump to navigation Jump to search
m (Protected "Howto mix line pulseaudio" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
 
(2 intermediate revisions by the same user not shown)
Line 14: Line 14:
  pactl list sink-inputs short
  pactl list sink-inputs short
output:
output:
  72 65 - PipeWire float32le 2ch 48000Hz
  72 65 - PipeWire float32le 2ch 48000Hz
  86 65 - PipeWire float32le 2ch 48000Hz
  86 65 - PipeWire float32le 2ch 48000Hz
  100 65 - PipeWire float32le 2ch 48000Hz
  100 65 - PipeWire float32le 2ch 48000Hz
change the output source from 65 to 53:
change the output source from 65 to 53:
Line 47: Line 47:
  systemctl --user enable ezcap-audio.service
  systemctl --user enable ezcap-audio.service
  systemctl --user start ezcap-audio.service
  systemctl --user start ezcap-audio.service
= references =
* https://unix.stackexchange.com/questions/263274/pipe-mix-line-in-to-output-in-pulseaudio
* https://unix.stackexchange.com/questions/681438/how-to-mix-two-input-sources-in-pulseaudio-for-recording-mic-and-speakers-with

Latest revision as of 22:03, 3 October 2024

pulseaudio

list audio sources:

pactl list sources short

output:

53 alsa_output.pci-0000_04_00.0.hdmi-stereo.monitor PipeWire s32le 2ch 48000Hz RUNNING
54 alsa_input.usb-R__DE_Wireless_GO_II_RX_215C1214-01.analog-stereo PipeWire s24le 2ch 48000Hz RUNNING
65 alsa_input.usb-ezcap_ezcap_LIVE_GAMER_RAW_00000001-02.iec958-stereo	PipeWire s16le 2ch 48000Hz RUNNING

we want to sink audio from hdmi-stereo.monitor and ezcap:

pactl load-module module-null-sink sink_name=both sink_properties=device.description=ezcap-and-speakers
pactl load-module module-loopback source=alsa_output.pci-0000_04_00.0.hdmi-stereo.monitor sink=both
pactl load-module module-loopback source=alsa_input.usb-ezcap_ezcap_LIVE_GAMER_RAW_00000001-02.iec958-stereo sink=both
pactl load-module module-loopback sink=both

list sink inputs:

pactl list sink-inputs short

output:

72 65 - PipeWire float32le 2ch 48000Hz
86 65 - PipeWire float32le 2ch 48000Hz
100 65 - PipeWire float32le 2ch 48000Hz

change the output source from 65 to 53:

pactl move-sink-input 100 53

create bash script to automate this process:

cat > ~/bin/ezcap-audio-sink << EOF
#!/bin/bash
sleep 3
pactl load-module module-null-sink sink_name=both sink_properties=device.description=ezcap-and-speakers
pactl load-module module-loopback source=alsa_output.pci-0000_04_00.0.hdmi-stereo.monitor sink=both
pactl load-module module-loopback source=alsa_input.usb-ezcap_ezcap_LIVE_GAMER_RAW_00000001-02.iec958-stereo sink=both
pactl load-module module-loopback sink=both
sink=$(pactl list sink-inputs short|tail -n 1|awk '{print $1}')
output=$(pactl list sources short|grep hdmi-stereo.monitor|awk '{print $1}')
pactl move-sink-input ${sink} ${output}
EOF

create systemd service as user to execute script when system boot:

cat > /home/linux/.config/systemd/user/ezcap-audio.service << EOF
[Unit]
Description=Ezcap audio sink service
After=sound.target

[Service]
Type=forking
ExecStart=/home/linux/bin/ezcap-audio-sink

[Install]
WantedBy=default.target
EOF

enable and start systemd service as user:

systemctl --user enable ezcap-audio.service
systemctl --user start ezcap-audio.service

references