Hacker News new | past | comments | ask | show | jobs | submit login

Works with pipewire too, although the user-facing docs are pretty sparse





Here are my server and client configs needed in case someone comes across this from google. It sets up sinks and sources, so you can just mute it, but it would just play automatic from logon:

Needed on Server and Clients is an override to a) fix my ___domain users having the same cookie if its stored in default ___location and b) make sure the server only starts when the network is REALLY up - the normal network online is a system service only and thus you cannot check for it in a users service. In my case the server runs under a ___domain users profile.

~/.config/systemd/user/pipewire-pulse.service.d/override.conf

  [Unit]
  After=user-network-wait.service avahi-daemon.service

  [Service]
  # this changes the ___location of the cookie because i use roaming homes for ___domain clients and each machine would have the same cookie
  ExecStartPre=/bin/bash -c 'systemctl --user set-environment PULSE_COOKIE=/run/user/$(id -u)/pulse/cookie'
~/.config/systemd/user/user-network-wait.service

  [Unit]
  Description=Wait for Network Connectivity

  [Service]
  Type=oneshot

  # This pings your LAN router and creates a network-online file in /run to pick up
  ExecStart=/bin/bash -c '[ -f /run/user/$(id -u)/network-online ] || (until ping -c1 10.126.0.1 >/dev/null 2>&1; do sleep 1; done; touch /run/user/$(id -u)/network-online)'
 
  [Install]
  WantedBy=default.target
Server Pulseaudio:

Not needed but very useful:

/etc/pipewire/pipewire-pulse.conf.d/50-networkparty.conf

  context.exec = [
      { path = "pactl" args = "load-module module-native-protocol-tcp auth-anonymous=yes listen=10.126.1.1 auth-ip-acl=127.0.0.1;10.126.0.0/16" }
  ]
# needed. Note how to to make sure s16le is used across all devices to keep conversion to a minimum and how to name the sink somewhat sane

/etc/pipewire/pipewire-pulse.conf.d/70-rtp-sender-sink.conf

  context.exec = [
    { path = "pactl"        args = "load-module module-null-sink sink_name=rtp_sender_sink format=s16le channels=2 rate=48000 sink_properties='device.description=\"RTP Sender Sink\"'" }
]

/etc/pipewire/pipewire-pulse.conf.d/71-rtp-sender-23912611.conf

  context.exec = [
    { path = "pactl" args = "load-module module-rtp-send source=rtp_sender_sink.monitor source_ip=10.126.1.1 destination_ip=239.126.1.1 port=5004 inhibit_auto_suspend=always" }
  ]
You can play to the sink f.e. in mpd with:

  audio_output {
    type "pulse"
    name "RTP Sender Sink Pulse"
    sink "rtp_sender_sink"
  }
Client Pulseaudio:

/etc/pipewire/pipewire-pulse.conf.d/71-rtp-receiver.conf

  context.exec = [
      { path = "pactl"        args = "load-module module-rtp-recv sink=combine_sink sap_address=239.126.1.1 latency_msec=64.3750" }
  ]
you can play with the latency_msec, journalctl will tell you the lowest fragment if you just put 0 or 1ms here. It needs to be a multiple of that minimum, just experiment. Im fine with this even though 12ms would also work in my lan, but its more stable across the wifi bridge.

The sap_address on the client may work to select the right multicast address even though its actually for the SAP announcements but don't count on that, i have not tested multiple streams so far and would not use "magic" solutions like SAP on the server (and they didn't work in my case and seem pipewire-only). Right now the client seems to pick the right stream - experiment ;)

The sink in my case is a module-combo, just check with pactl list sinks which sink you want the stream to play on. Note that this is not some application you can dynamically assign to other sinks!!

For LAN, if you run openwrt just enable igmp_snooping and multicast_querier on the softwarebridge (Luci --> Network --> Interfaces --> Tab Devices) and maybe Multi to Uni in your wifi advanced settings. I dont use this though as my wifi is another vlan or WDS-bridged so i stay out of these problems mostly.

There are more advanced settings possible with openwrt, including having working igmp_snooping on the hardware switch, if you are interested frequent my documentation (german) on Krei.se as i will write a guide for this sometime lol (or just ask me by DM). Its possible to run this ms-exact with clean network in any case, there is no need to install extra software or clog unused ports with multicast-traffic. If you are perfect about this the music will flow like water through your LAN only where its needed.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: