Howto mix line pulseaudio: Difference between revisions

From Vidalinux Wiki
Jump to navigation Jump to search
Line 17: Line 17:
  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
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

Revision as of 23:40, 29 May 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