Pulseaudio RTP receiver server

Based on Debian Stretch 9.2 20171016

Server starts all functions at boot, no X needed

Install pulseaudio-module-zeroconf on both client and server:

1
$sudo apt-get install pulseaudio-module-zeroconf

Server side:

Utilize systemd user services. Needed for pulseaudio to start after network is actually up, rtp module will fail without it.

Groups useful or needed for the user starting pulseaudio:

1
2
3
4
5
6
7
8
9
10
$cat /etc/group | grep radiouser
  
audio:x:29:radiouser,pulse
systemd-journal:x:102:radiouser
systemd-timesync:x:103:radiouser
systemd-network:x:104:radiouser
radiouser:x:1000:
pulse:x:113:radiouser
pulse-access:x:114:radiouser

  1. Pulseaudio user configuration, creating the listener:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    # ~/.config/pulse/default.pa
      
    .include /etc/pulse/default.pa
    # The following settings override those in above/systemwide file.
      
    # This startup script is used only if PulseAudio is started per-user
    # (i.e. not in system mode)
      
    ### Network access (may be configured with paprefs
    # default lines modified to restrict by IP address, not using cookies to authenticate
    #load-module module-esound-protocol-tcp
    #load-module module-native-protocol-tcp
    load-module module-zeroconf-publish
    load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;172.30.0.1;172.30.0.250 auth-anonymous=1
      
    ### Load the RTP receiver module (also configured via paprefs, see above)
    load-module module-rtp-recv
      
    
  2. Link network target (no systemctl enable needed):

    1
    
    $systemctl --user link /lib/systemd/system/network-online.target
    
  3. Enable lingering services to make them not exit with user logout:

    1
    
    $sudo loginctl enable-linger radiouser
    
  4. Create

    1
    
    ~/.config/systemd/user/pulseaudio.service
    

    based on

    1
    
    /usr/lib/systemd/user/pulseaudio.service
    

    from debian stretch.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    
    [Unit]
    Description=Sound Service
      
    # We require pulseaudio.socket to be active before starting the daemon, because
    # while it is possible to use the service without the socket, it is not clear
    # why it would be desirable.
    #
    # A user installing pulseaudio and doing `systemctl --user start pulseaudio`
    # will not get the socket started, which might be confusing and problematic if
    # the server is to be restarted later on, as the client autospawn feature
    # might kick in. Also, a start of the socket unit will fail, adding to the
    # confusion.
    #
    # After=pulseaudio.socket is not needed, as it is already implicit in the
    # socket-service relationship, see systemd.socket(5).
    Requires=network-online.target sound.target pulseaudio.socket
    After=network-online.target sound.target
      
    [Service]
    # Note that notify will only work if --daemonize=no
    Type=notify
    ExecStart=/usr/bin/pulseaudio --daemonize=no --realtime --disallow-exit --no-cpu-limit
    Restart=on-failure
      
    [Install]
    Also=pulseaudio.socket
    WantedBy=default.target
        
    
  5. Check to see if files exist:

    1
    2
    3
    4
    5
    6
    7
    
    $ls ~./config/systemd/user/{.,default.target.wants}
      
    /home/radiouser/.config/systemd/user/.:
    default.target.wants  network-online.target  pulseaudio.service  sockets.target.wants
      
    /home/radiouser/.config/systemd/user/default.target.wants:
    pulseaudio.service
    
  6. Start pulseaudio:

    1
    
    $systemctl --user start pulseaudio.service
    
  7. Check sink and source levels and mute with

    1
    2
    
    $pacmd
    $pactl
    

If all is well, enable the user service:

1
  $systemctl --user enable pulseaudio.service

Client side:

Configure a source to broadcast with Paprefs. Make sure you have the correct IP for your machine if you used that or configure cookie authentication.

Other programs that broadcast RTP can be used, YMMV.