From d065942bb9c471c59fa3744ddc0acffdaf7d7ece Mon Sep 17 00:00:00 2001 From: Craig McDaniel Date: Sat, 28 Feb 2026 13:36:21 -0600 Subject: [PATCH] Pulseaudio updates for argus that seems to work well --- ansible/roles/argus_pulseaudio/tasks/main.yml | 20 +++------- .../argus_pulseaudio/templates/default.pa.j2 | 37 +++++++++++++++++++ .../templates/network-audio.pa.j2 | 21 ----------- .../templates/pulseaudio.service.j2 | 4 +- 4 files changed, 45 insertions(+), 37 deletions(-) create mode 100644 ansible/roles/argus_pulseaudio/templates/default.pa.j2 delete mode 100644 ansible/roles/argus_pulseaudio/templates/network-audio.pa.j2 diff --git a/ansible/roles/argus_pulseaudio/tasks/main.yml b/ansible/roles/argus_pulseaudio/tasks/main.yml index 4bc3482..a8d6dc4 100644 --- a/ansible/roles/argus_pulseaudio/tasks/main.yml +++ b/ansible/roles/argus_pulseaudio/tasks/main.yml @@ -1,10 +1,10 @@ -# Role: scanner_pulseaudio +# Role: argus_pulseaudio # Install and configure PulseAudio for network audio streaming # # This role: # - Installs PulseAudio and required packages # - Configures network audio (TCP + zeroconf/Avahi) -# - Creates systemd service to run PulseAudio as busnet user +# - Creates systemd service to run PulseAudio as argus user # - name: Install PulseAudio and network audio packages @@ -19,27 +19,19 @@ state: present update_cache: yes -- name: Ensure busnet user is in audio groups +- name: Ensure argus user is in audio groups ansible.builtin.user: - name: busnet + name: argus groups: "{{ item }}" append: yes with_items: - pulse-access - audio -- name: Create PulseAudio configuration directory - ansible.builtin.file: - path: /etc/pulse/default.pa.d - state: directory - owner: root - group: root - mode: '0755' - - name: Deploy PulseAudio network audio configuration ansible.builtin.template: - src: templates/network-audio.pa.j2 - dest: /etc/pulse/default.pa.d/network-audio.pa + src: templates/default.pa.j2 + dest: /etc/pulse/default.pa owner: root group: root mode: '0644' diff --git a/ansible/roles/argus_pulseaudio/templates/default.pa.j2 b/ansible/roles/argus_pulseaudio/templates/default.pa.j2 new file mode 100644 index 0000000..a844882 --- /dev/null +++ b/ansible/roles/argus_pulseaudio/templates/default.pa.j2 @@ -0,0 +1,37 @@ +# This file is managed by Ansible. +# +# PulseAudio network audio configuration +# +# This is so we can plug radios into this computer and then offer the radio sound card on the network +# so other computers can run software and use the sound card on the radio as long as they are plugged +# into the network. +# + +# This will automatically handle devices being plugged in, or unplugged from, the USB bus. +load-module module-udev-detect + +# NOT USED +# This is how you reference a specific sound card +#load-module module-alsa-sink device=hw:CARD=ft991a sink_name=ft991a_tx +#load-module module-alsa-source device=hw:CARD=ft991a source_name=ft991a_rx + +# NOT USED +# Set up custom sink and source values. To get the values for master, you must first load pulseaudio +# with only the module-udev-detect and let it detect the sound cards. Then you run: +# pactl list sinks short +# pactl list sources short +# Custom sink and source names for the Digirig C-Media sound card +#load-module module-remap-sink sink_name=digirig_tx master=alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo remix=no +#load-module module-remap-source source_name=digirig_rx master=alsa_input.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.mono-fallback remix=no +# Custom sink and source names for the FT-991a sound card +#load-module module-remap-sink sink_name=ft991a_tx master=alsa_output.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo remix=no +#load-module module-remap-source source_name=ft991a_rx master=alsa_input.usb-Burr-Brown_from_TI_USB_Audio_CODEC-00.analog-stereo remix=no + +# Load native protocol for UNIX socket for pactl +load-module module-native-protocol-unix + +# Enable TCP network protocol so any TCP client can use the sound devices +load-module module-native-protocol-tcp auth-anonymous=1 auth-ip-acl=0.0.0.0/0 + +# Enable zeroconf/Avahi discovery +load-module module-zeroconf-publish diff --git a/ansible/roles/argus_pulseaudio/templates/network-audio.pa.j2 b/ansible/roles/argus_pulseaudio/templates/network-audio.pa.j2 deleted file mode 100644 index 147607d..0000000 --- a/ansible/roles/argus_pulseaudio/templates/network-audio.pa.j2 +++ /dev/null @@ -1,21 +0,0 @@ -# This file is managed by BusNet Ansible. -# -# PulseAudio network audio configuration -# -# This is so we can plug radios into this computer and then offer the radio sound card on the network -# so other computers can run software and use the sound card on the radio as long as they are plugged -# into the network. -# - -# Enable TCP network protocol for remote clients -# auth-anonymous=1 allows connections without authentication -# auth-ip-acl=0.0.0.0/0 allows connections from any IP address -load-module module-native-protocol-tcp auth-anonymous=1 auth-ip-acl=0.0.0.0/0 - -# Enable zeroconf/Avahi discovery so clients can auto-find the server on the network. In reality I find -# this doesn't work so well, but it's here.... -load-module module-zeroconf-publish - -# Disable suspend on idle to keep audio devices active -# This ensures the audio devices don't go to sleep when not in use -unload-module module-suspend-on-idle diff --git a/ansible/roles/argus_pulseaudio/templates/pulseaudio.service.j2 b/ansible/roles/argus_pulseaudio/templates/pulseaudio.service.j2 index 4cf7589..f673ab3 100644 --- a/ansible/roles/argus_pulseaudio/templates/pulseaudio.service.j2 +++ b/ansible/roles/argus_pulseaudio/templates/pulseaudio.service.j2 @@ -15,8 +15,8 @@ Restart=on-failure RestartSec=5 # Run as busnet user -User=busnet -Group=busnet +User=argus +Group=argus # Allow real-time priority for better audio performance LimitRTPRIO=9