Hardware out not working properly

Recently installed Libretime on a VirtualBox VM(Windows host) for testing and I’m having issues getting a hardware out. I use it to feed a low power FM transmitter. Previously, setting audio out to ALSA seemed to work but after a couple of restarts it stopped working. I noticed pulseaudio was installed but switching to it broke all audio out(streams stopped working). I also noticed the same issue while using a Raspberry Pi 4.

Here’s var/log/libretime/liquidsoap.log for reference

2022/07/29 21:51:18 [main:3] Liquidsoap 1.4.2
2022/07/29 21:51:18 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=[unspecified] sedlex=2.1 menhirLib=20200123 dtools=0.4.1 duppy=0.8.0 cry=0.6.4 mm=0.5.0 xmlplaylist=0.1.3 lastfm=0.3.2 ogg=0.5.2 vorbis=0.7.1 opus=0.1.3 speex=0.2.1 mad=0.4.4 flac=0.1.5 flac.ogg=0.1.5 dynlink=[distributed with Ocaml] lame=0.3.2 shine=0.2.0 gstreamer=0.3.0 frei0r=0.1.0 theora=0.3.1 gavl=0.1.5 ffmpeg=0.4.1 bjack=0.1.4 alsa=0.2.3 ao=0.2.0 samplerate=0.1.2 taglib=0.3.1 ssl=0.5.9 magic=0.7.3 camomile=[unspecified] yojson=[unspecified] faad=0.4.0 soundtouch=0.1.7 portaudio=0.2.1 pulseaudio=0.1.2 ladspa=0.1.4 sdl=0.9.1 camlimages=4.2.0 lo=0.1.2 gd=1.0a5
2022/07/29 21:51:18 [gstreamer.loader:3] Loaded GStreamer 1.16.2 0
2022/07/29 21:51:18 [dynamic.loader:3] Could not find dynamic module for fdkaac encoder.
2022/07/29 21:51:18 [lang.deprecated:2] WARNING: “harbor.bind_addr” is deprecated! Please use “harbor.bind_addrs”.
2022/07/29 21:51:18 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz master.
2022/07/29 21:51:18 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples.
2022/07/29 21:51:18 [frame:3] Targetting ‘frame.duration’: 0.04s = 1764 audio samples = 1764 ticks.
2022/07/29 21:51:18 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks.
2022/07/29 21:51:18 [lang:3] Pulseaudio
2022/07/29 21:51:18 [lang:3] timeout --signal=KILL 45 libretime-playout-notify started &
2022/07/29 21:51:18 [sandbox:3] Could not find binary bwrap, disabling sandboxing…
2022/07/29 21:51:18 [video.converter:3] Using preferred video converter: gavl.
2022/07/29 21:51:18 [audio.converter:3] Using samplerate converter: ffmpeg.
2022/07/29 21:51:18 [harbor:3] Adding mountpoint ‘/master’ on port 8001
2022/07/29 21:51:18 [harbor:3] Adding mountpoint ‘/show’ on port 8002
2022/07/29 21:51:18 [clock.wallclock_pulse:2] Error when starting output pulse_out(liquidsoap:): Pulseaudio error: Connection refused!
2022/07/29 21:51:18 [clock.wallclock_pulse:3] Raised by primitive operation at file “pulseaudio.ml” (inlined), line 47, characters 6-67
2022/07/29 21:51:18 [clock.wallclock_pulse:3] Called from file “io/pulseaudio_io.ml”, line 82, characters 10-120
2022/07/29 21:51:18 [clock.wallclock_pulse:3] Called from file “tools/start_stop.ml”, line 108, characters 8-18
2022/07/29 21:51:18 [clock.wallclock_pulse:3] Called from file “clock.ml”, line 245, characters 20-38
2022/07/29 21:51:18 [LibreTime!:3] Connecting mount main for source@10.147.17.46
2022/07/29 21:51:18 [LibreTime!:3] Connection setup was successful.
2022/07/29 21:51:18 [lang:3] timeout --signal=KILL 45 libretime-playout-notify stream ‘1’ ‘1659131478.46’ &
2022/07/29 21:51:18 [main:3] Shutdown started!
2022/07/29 21:51:18 [main:3] Waiting for main threads to terminate…
2022/07/29 21:51:18 [clock.wallclock_pulse:3] Streaming loop starts, synchronized by active sources.
2022/07/29 21:51:18 [LibreTime!:3] Closing connection…
2022/07/29 21:51:18 [lang:3] timeout --signal=KILL 45 libretime-playout-notify live ‘live_dj’ ‘false’ &
2022/07/29 21:51:18 [harbor:3] Removing mountpoint ‘/show’ on port 8002
2022/07/29 21:51:18 [harbor:3] Nothing more on port 8002: closing sockets.
2022/07/29 21:51:18 [lang:3] timeout --signal=KILL 45 libretime-playout-notify live ‘master_dj’ ‘false’ &
2022/07/29 21:51:18 [harbor:3] Removing mountpoint ‘/master’ on port 8001
2022/07/29 21:51:18 [harbor:3] Nothing more on port 8001: closing sockets.
2022/07/29 21:51:18 [clock.wallclock_pulse:3] Streaming loop stopped.
2022-07-29 21:51:19.551 | INFO | libretime_playout.notify.main:stream:92 - Sending output stream ‘1’ status ‘OK’
2022-07-29 21:51:19.576 | INFO | libretime_playout.notify.main:live:73 - Sending currently playing live source ‘live_dj’ status ‘false’
2022-07-29 21:51:19.648 | INFO | libretime_playout.notify.main:live:73 - Sending currently playing live source ‘master_dj’ status ‘false’
2022/07/29 21:51:19 [server:3] New client: 127.0.0.1.
2022/07/29 21:51:19 [lang:3] streams.live_dj_stop
2022/07/29 21:51:19 [lang:3] streams.master_dj_stop
2022/07/29 21:51:19 [lang:3] streams.scheduled_play_start
2022/07/29 21:51:19 [lang:3] vars.stream_metadata_type
2022/07/29 21:51:19 [lang:3] vars.station_name
2022/07/29 21:51:19 [lang:3] vars.default_dj_fade
2022/07/29 21:51:19 [server:3] Client 127.0.0.1 disconnected.
2022/07/29 21:51:19 [server:3] New client: 127.0.0.1.
2022/07/29 21:51:19 [lang:3] queues.s8_skip
2022/07/29 21:51:19 [lang:3] queues.s8_skip
2022/07/29 21:51:19 [lang:3] queues.s8_skip
2022/07/29 21:51:19 [lang:3] queues.s8_skip
2022/07/29 21:51:19 [lang:3] queues.s8_skip
2022/07/29 21:51:19 [server:3] Client 127.0.0.1 disconnected.
2022/07/29 21:51:19 [server:3] New client: 127.0.0.1.
2022/07/29 21:51:19 [lang:3] vars.show_name
2022/07/29 21:51:19 [server:3] Client 127.0.0.1 disconnected.
2022/07/29 21:51:19 [server:3] New client: 127.0.0.1.
2022/07/29 21:51:19 [lang:3] dynamic_source.get_id
2022/07/29 21:51:19 [server:3] Client 127.0.0.1 disconnected.
2022/07/29 21:51:20 [main:3] Threads terminated.
2022/07/29 21:51:20 [threads:3] Shutting down scheduler…
2022/07/29 21:51:20 [threads:3] Scheduler shut down.
2022/07/29 21:51:20 [threads:3] Waiting for queue threads to terminate…
2022/07/29 21:51:20 [threads:3] Queues shut down
2022/07/29 21:51:20 [server:3] Closing socket.
2022/07/29 21:51:20 [main:3] Cleaning downloaded files…
2022/07/29 21:51:20 [main:3] Freeing memory…

I am thinking this might have something to do with permissions not being properly set for pulseaudio use.