sömike
Nnna.
Azt másolom ide, ami nálam működik, majd adaptálod.
root@butyok:/home/pi# cat /etc/systemd/system/pulseaudio.service
[Unit]
Description=PulseAudio Daemon
Requires=sound.target dbus.service
After=sound.target dbus.service
#[Unit]
#Description=Pulseaudio sound server
#After=avahi-daemon.service network.target
[Service]
Type=forking
PIDFile=/var/run/pulse/pid
#User=pi
#PermissionsStartOnly=true
#ExecStartPre=-/bin/mkdir -p /var/run/pi/.config/pulse
#ExecStartPre=-/bin/chown pi:pi -R /var/run/pi/
ExecStart=/usr/bin/pulseaudio --daemonize --system --realtime=yes --disallow-exit --disallow-module-loading=0 --log-target=syslog
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=7
[Install]
WantedBy=multi-user.target kodi.service
Van tehát egy ilyen fájlom /etc/systemd/system/pulseaudio.service néven.
Ha ezt létrehozod, akkor kell
systemctl daemon-reload
systemctl enable pulseaudio
A wante-by rész nálad valószínűleg nem így kell, nálam a kodi szintén szervízként megy, aminek kell a pulse.
Nálad szerintem az a myaudio kerülhet majd oda. Logikusan legalábbis... 😉
Van egy pulse felhasználóm, az ő nevében fut a pulseaudio:
root@butyok:/home/pi# ps -aux|grep pulse
pulse 474 0.3 2.8 210224 22036 ? S<l ápr22 50:12 /usr/bin/pulseaudio --daemonize --system --realtime=yes --disallow-exit --disallow-module-loading=0 --log-target=syslog
root@butyok:/home/pi# cat /etc/passwd | grep pulse
pulse:x:112:120:PulseAudio daemon,,,:/var/run/pulse:/usr/sbin/nologin
root@butyok:/home/pi#
Fontos, hogy a PA konfigurációja, ha rendszerszolgáltatásként megy, akkor nem a default.pa, hanem a system.pa alapján alakul. Ez nálam:
root@butyok:/home/pi# cat /etc/pulse/system.pa
#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
# This startup script is used only if PulseAudio is started in system
# mode.
### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
load-module module-cli-protocol-unix
### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect tsched=0
.else
### Use the static hardware detection module (for systems that lack udev/hal support)
load-module module-detect
.endif
### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix
### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore
### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams
### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink
### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle
###bluetooth
#.ifexists module-bluetooth-policy.so
#load-module module-bluetooth-policy
#.endif
#.ifexists module-bluetooth-discover.so
#load-module module-bluetooth-discover
#.endif
#.ifexists module-bluez5-device.so
#load-module module-bluez5-device
#.endif
#.ifexists module-bluez5-discover.so
#load-module module-bluez5-discover
#.endif
### Enable positioned event sounds
load-module module-position-event-sounds
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif
#load-module module-alsa-sink device=alsa_card.usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00 sink_name=Butyokhang
#set-default-sink alsa_output.usb-C-Media_Electronics_Inc._USB_Advanced_Audio_Device-00.analog-stereo
######set-default-sink alsa_card.usb-VIA_Technologies_Inc._XZD_D2-MINI-00.analog-stereo
set-default-sink alsa_output.platform-soc_sound.stereo-fallback
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.1.0/24
#load-module module-zeroconf-publish
#load-module module-esound-protocol-tcp auth-anonymous=1
#load-module module-combine-sink sink_name=combined
### Automatically load driver modules for Bluetooth hardware
#.ifexists module-bluetooth-policy.so
#load-module module-bluetooth-policy
#.endif
#.ifexists module-bluetooth-discover.so
#load-module module-bluetooth-discover
#.endif
root@butyok:/home/pi#
A daemon.conf már csak a teljesség kedvéért:
root@butyok:/home/pi# cat /etc/pulse/daemon.conf
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
## Configuration file for the PulseAudio daemon. See pulse-daemon.conf(5) for
## more information. Default values are commented out. Use either ; or # for
## commenting.
; daemonize = no
; fail = yes
allow-module-loading = yes
; allow-exit = yes
; use-pid-file = yes
; system-instance = no
; local-server-type = user
; enable-shm = yes
; enable-memfd = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
; lock-memory = no
; cpu-limit = no
; high-priority = yes
; nice-level = -11
; realtime-scheduling = yes
; realtime-priority = 5
; exit-idle-time = 20
; scache-idle-time = 20
; dl-search-path = (depends on architecture)
; load-default-script-file = yes
; default-script-file = /etc/pulse/default.pa
; log-target = auto
; log-level = notice
; log-meta = no
; log-time = no
; log-backtrace = 0
resample-method = speex-float-5
avoid-resampling = true
; enable-remixing = yes
; remixing-use-all-sink-channels = yes
; enable-lfe-remixing = no
; lfe-crossover-freq = 0
flat-volumes = no
; rlimit-fsize = -1
; rlimit-data = -1
; rlimit-stack = -1
; rlimit-core = -1
; rlimit-as = -1
; rlimit-rss = -1
; rlimit-nproc = -1
; rlimit-nofile = 256
; rlimit-memlock = -1
; rlimit-locks = -1
; rlimit-sigpending = -1
; rlimit-msgqueue = -1
; rlimit-nice = 31
; rlimit-rtprio = 9
; rlimit-rttime = 200000
default-sample-format = s16le
default-sample-rate = 48000
alternate-sample-rate = 44100
default-sample-channels = 2
default-channel-map = front-left,front-right
default-fragments = 8
default-fragment-size-msec = 60
enable-deferred-volume = no
; deferred-volume-safety-margin-usec = 8000
; deferred-volume-extra-delay-usec = 0
root@butyok:/home/pi#
Fontos, hogy nálam a hálózatról, sokszor wifin át megy a hang, emiatt a default-fragments = 8 és default-fragment-size-msec = 60 majdnem fél másodperc késleltetést tesz bele, ami zenehallgatáskor nem gond, viszont a wifi terhelésekor az esetleges szakadozások, dadogások esélye konvergál a zéróhoz.
Nagyon valószínű, hogy a set-default-sink nálad nem úgy kell legyen. Vagy hagyd ki, vagy írd át a megfelelő nyelőre! Illetve nem tudom, hogy a native-protocol.tcp modulra van-e szükséged, valószínűleg nem, ha csak helyi hangokat akarsz....
Nem biztos, hogy ez nálad is jó konfig lesz, szóval ésszel adaptáld!
😁