# Our setup for using LibreTime in our french local radio /system audio output with pulseaudio and auto-dj

**URL:** <https://discourse.libretime.org/t/our-setup-for-using-libretime-in-our-french-local-radio-system-audio-output-with-pulseaudio-and-auto-dj/1962>\
**Category:** Get Help\
**Created:** [January 16, 2026, 3:48pm UTC](https://discourse.libretime.org/t/our-setup-for-using-libretime-in-our-french-local-radio-system-audio-output-with-pulseaudio-and-auto-dj/1962 "2026-01-16T15:48:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![raph](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/raph/32/776_2.png) [@raph](https://discourse.libretime.org/u/raph)\
**Post date:** [January 16, 2026, 3:48pm UTC](https://discourse.libretime.org/t/our-setup-for-using-libretime-in-our-french-local-radio-system-audio-output-with-pulseaudio-and-auto-dj/1962/1 "2026-01-16T15:48:24Z")

</div>

**Describe the problem**

This post is here to eventually help others solve similar issues, or maybe get better solutions from the community 🙂

Our problems were :

- impossible to use the hardware audio output with pulseaudio
- necessity to have a “default” auto-dj when there is no scheduled shows

**To reproduce**

Setting `enabled: true` in this section of the `config.yml` file should enable the audio output of the system but it does not work with pulseaudio.

```yaml
    system:
      - # Whether the output is enabled.
        # > default is false
        enabled: true
        # System output kind.
        # > must be one of (alsa, ao, oss, portaudio, pulseaudio)
        # > default is alsa
        kind: pulseaudio

```

**Expected behavior**

System audio output should work.

**Relevant log output or error messages**  
The liquidsoap logs show that liquidsoap loops on an error.

**LibreTime version**  
LibreTime version: `4.5.0`

**Installation method and OS / Environment**

Installed with the install script on an Ubuntu 20.04 machine.

# **Solutions**

## **Enabling system audio output**

We added the two following lines in the `libretime-liquidsoap.service` file :

```auto
Environment="XDG_RUNTIME_DIR=/run/user/1000"
Environment="PULSE_RUNTIME_PATH=/run/user/1000/pulse/"

```

## **Adding a default auto-dj**

We added the following lines in `/opt/libretime/lib/python3.8/site-packages/libretime_playout/liquidsoap/1.4/ls_script.liq` (sorry comments are in french) :

```auto
################ DEBUT AJOUT POUR L'AUTODJ
 
########################### INIT PLAYLIST ##################################
 
ignore(run_process("python3 /home/radio-dragon/autoDJ/scripts/create_playlist.py"))
 
 
########################### REFRESH PLAYLIST EVERY NIGHT ##################################
 
exec_at(freq=1800., pred={ 23h00-23h50 },
  fun() -> ignore(run_process("python3 /home/radio-dragon/autoDJ/scripts/create_playlist.py"))
)
 
########################### TRANSITIONS ##################################
 
# a 3-seconds crossfade operator that skips the cutted track.
# Skipping avoids getting back in the middle of a music track after a live show,
# but it requires a weird implementation. See https://github.com/savonet/liquidsoap/issues/1548
def crossfade_3s(a,b)
    faded = add(normalize=false, [
        fade.in(duration=3., type="exp", b),
        amplify(mkfade(duration=3., start=1., stop=0., type="exp", a) ,a)
    ])
    add_timeout(10., { source.skip(a) ; -1.})
    faded
end
 
# Transition entre émission et playlist
def back_to_playlist(live, playlist) =
  # Cancel current track. This will also set the playlist
  # to play a new track.
  source.skip(playlist)
  sequence([live, playlist])
end
 
# Transition vers libretime
def to_libretime(playlist, live) =
  sequence([playlist,live])
end
 
 
########################### AUTODJ ##################################
 
autodj = playlist(reload_mode="watch", "/home/radio-dragon/autoDJ/playlist_autodj.txt",mode="normal")
 
# 780 = au moins 13 minutes de délai entre les jingles
# "delay" compte en secondes et c'est forcément un flottant d'ou le point obligatoire
jingles = delay(780., id="jingles",
    playlist.safe("/home/radio-dragon/Musique/JINGLES-BA-FOCUS/Jingles en COURS", mode="random", reload_mode="watch")
)
 
# à la fin de chaque track, va piocher un jingle s'il est dispo (après lecture, il n'est pas dispo)
autodj_avec_jingle = fallback([jingles, autodj], id="autodj_avec_jingle")
 
########################### PLAYLIST SECOURS ##################################
 
secours = mksafe(playlist("/home/radio-dragon/Musique/playlist_secours",reload_mode="watch"))
 
########################### COMBINING SOURCES ##################################
 
default = fallback(track_sensitive=false,transitions=[back_to_playlist,to_libretime],
	[autodj_avec_jingle,secours], id="default")
 
 
######################################################## FIN AJOUT POUR L'AUTODJ 

```

So there are only 2 files to watch for and backup before upgrading to a new Libretime version.

Comments welcome !

---

<div class="post-metadata">

**Author:** ![NessRadio](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/nessradio/32/839_2.png) [@NessRadio](https://discourse.libretime.org/u/NessRadio)\
**Post date:** [January 21, 2026, 10:02am UTC](https://discourse.libretime.org/t/our-setup-for-using-libretime-in-our-french-local-radio-system-audio-output-with-pulseaudio-and-auto-dj/1962/2 "2026-01-21T10:02:18Z")

</div>

Thank you for sharing, it’s an interesting auto DJ solution!

Here is the solution I posted and works perfectly for me :

> [@“AutoDJ” liquidsoap code for 4.5.0 (updated)](https://discourse.libretime.org/t/autodj-liquidsoap-code-for-4-5-0-updated/1927):
>
> I’ve extended the default Liquidsoap setup to automatically play a random music playlist whenever no shows are scheduled or a DJ isn’t live. I tested it on LibreTime 4.5.0, and it appears to work just as well on earlier releases. The core steps are: 1- Create autodj.liq sudo nano /opt/libretime/lib/python3.9/site-packages/libretime\_playout/liquidsoap/1.4/autodj.liq Copy&past the code below and change path and .mp3 accordingly # Your jingles jingles = playlist("/myradio/jingle") # Your backu…
