# PipeWire

## Tools

- `pw-record` &amp; `pw-play` - capture and play sound
- `qpwgraph` - visual tool for making links between ports
- `pw-dot` - dump graph as dot file: `pw-dot && dot -T svg -O pw.dot && firefox pw.dot.svg`
- `pavucontrol` - PulseAudio mixer GUI
- `pw-dump` - writes JSON representation of nodes, links and ports
- `pw-top` - stats

## Playback over SSH

```
pw-record --target 56 - | ssh ann XDG_RUNTIME_DIR=/run/user/hxd pw-play -
```

Where `56` is ID of output monitor named `alsa_output.pci-0000_00_1f.3.analog-stereo` in my case.

```
pw-dump | jq '.[] | select(.info.props."node.name" == "alsa_output.pci-0000_00_1f.3.analog-stereo").id'
pw-dump | jq '.[] | select(.info.props."node.description" == "Built-in Audio Analog Stereo" and .info.props."api.alsa.pcm.stream" == "playback").id'
pw-dump | jq '.[] | select(.info.props."device.profile.name" == "analog-stereo" and .info.props."api.alsa.pcm.stream" == "playback").id'
```

Full script can look like this:

```shell
#!/bin/fish
pw-record --target (pw-dump | jq '.[] | select(.info.props."device.profile.name" == "analog-stereo" and .info.props."api.alsa.pcm.stream" == "playback").id') - | ssh ann XDG_RUNTIME_DIR=/run/user/hxd pw-play -
```