Streaming audio over network using pulseaudio module-rtp-send/module-rtp-recv.
Set of small scripts for effortless loading/unloading modules from both sides simultaneously. It provides easier control of the stream using tcp port for communication between server and receiver.
Following packages are needed on both server and receiver sides:
- pulseaudio
- pulseaudio-rtp
- nmap
- netcat
pacman -S pulseaudio pulseaudio-rtp nmap netcat
Server argument will add rtp sink to default.pa and install audiocast server script
./install server
Receiver argument will only install audiocast receiver script
./install receiver
- 'start' will load rtp-module if it's not already loaded
audiocast start
- 'stop' will unload rtp-module
audiocast stop
- 'restart' will unload and then load rtp-module
audiocast stop
If no argument is provided, audiocast will determine the action based on current sink. If the current sink is rtp it will use 'start' command, otherwise it will exit.
audiocast
In my i3 config I have this option which is useful for starting and stopping the stream with one same key:
bindsym $mod+Shift+m exec --no-startup-id changesink && audiocast
bindsym $mod+Ctrl+m exec --no-startup-id audiocast restart
- changesink script
Audiocast on receiver side should continuously wait on port for server's command. Received commands will mirror the actions of the server, i.e. 'start' will load rtp-module if it's not already loaded, 'stop' will unload the module, and 'restart' will unload and then load the module.
audiocast
Start with systemd instead:
systemctl --user start audiocast
Start automatically on login:
systemctl --user enable audiocast
Note: Use --user, because running pulseaudio in system wide mode is not advisable. Make sure that pulseaudio is running on both server and receiver sides.