Last active
November 17, 2024 01:28
-
-
Save kikou2022/0748c451921f7834929488519672c26b to your computer and use it in GitHub Desktop.
SCRIPT LIQUIDSOAP POUR AUTOMATE RADIO SUR VPS OVH Ubuntu 22.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### SCRIPT LIQUIDSOAP POUR AUTOMATE RADIO SUR VPS OVH Ubuntu 22.04 #### | |
#### DECROCHAGE VERS FLUX EXTÉRIEURS ICECAST, DIFFUSION EMISSIONS, PLAYLISTES ET JINGLES SELON QUOTAS ET GRILLE HORAIRE #### | |
#### TRAITEMENTS DE SON EN SORTIE DES DIFFÉRENTES SOURCES AVANT DIFFUSION SUR ICECAST #### | |
#### Sources Automate : https://mkir.ch/ - Martin Kirchgessner #### https://github.com/martinkirch | |
#### Sources Process Son : | |
#####https://www.mkpascal.net/ - Pascal MUANG KHOT #### https://github.com/mkpascal/ | |
#####https://gist.github.com/BusterNeece | |
#### Modifications et adaptations : Kikou2022 - https://github.com/kikou2022 | |
#### Version 1.0 du 17/11/2024 pour Icecast 2.4.4 et Liquidsoap 2.2.4 | |
# FICHIER DE LOG | |
set("log.file.path","/tmp/basic-radio_quotas.log") | |
# Activation du serveur Telnet | |
set("server.telnet", true) | |
set("server.telnet.bind_addr", "127.0.0.1") # Limiter à localhost | |
set("server.telnet.port", 1234) # Spécifier le port (optionnel) | |
set("server.telnet.idle_timeout", -1) # Désactiver le timeout d'inactivité | |
set("server.telnet.max_connections", 10) # Limite de connexions simultanées | |
############################ EMISSIONS ###################################### | |
# attention les répertoires doivent être créés au lancement du script, même vides | |
emissions = switch(id="emissions", [ | |
({12h00-13h40}, blank.eat(start_blank=true, max_blank=1.0, threshold=-45.0, playlist(reload_mode="watch", mode="normal", id="superemission", "/home/ubuntu/test/Emissions/superemission"))), | |
({10h00-12h00}, blank.eat(start_blank=true, max_blank=1.0, threshold=-45.0, playlist(reload_mode="watch", mode="normal", id="matinale", "/home/ubuntu/test/Emissions/matinale"))), | |
({18h00-19h00}, blank.eat(start_blank=true, max_blank=1.0, threshold=-45.0, playlist(reload_mode="watch", mode="normal", id="apero", "/home/ubuntu/test/Emissions/apero"))), | |
({15h30-16h30}, blank.eat(start_blank=true, max_blank=1.0, threshold=-45.0, playlist(reload_mode="watch", mode="normal", id="blabla", "/home/ubuntu/test/Emissions/blabla"))), | |
({00h30-02h30}, blank.eat(start_blank=true, max_blank=1.0, threshold=-45.0, playlist(reload_mode="watch", id="nuit", "/home/ubuntu/test/Emissions/nuit"))) | |
]) | |
### DECROCHAGE VERS RDJ - AUTOMATE WINDOWS #################### | |
rdj = input.http(id="rdj", "https://icecast-vps-ovh.airvs.site/stream7" | |
) | |
exec_at(pred={ 01h00m00s }, | |
{ log(label="server_driver", "Démarrage du flux RDJ"); server.execute("rdj.start") } | |
) | |
exec_at(pred={ 22h00m00s }, | |
{ log(label="server_driver", "Arrêt du flux RDJ"); server.execute("rdj.stop") } | |
) | |
## DECROCHAGE VERS SHOWERGEL - AUTRE FLUX LIQUIDSOAP SUR SERVEUR ICECAST #################### | |
showergel = input.http(id="showergel", "https://icecast-vps-ovh.airvs.site/stream5" | |
) | |
exec_at(pred={ 9h00m00s }, | |
{ log(label="server_driver", "Démarrage du flux SHOWERGEL"); server.execute("showergel.start") } | |
) | |
exec_at(pred={ 22h00m00s }, | |
{ log(label="server_driver", "Arrêt du flux SHOWERGEL"); server.execute("showergel.stop") } | |
) | |
########################## Tambouille de musiques/quotas/jingles ################### | |
# On recharge toutes les heures le contenu des playlists, en cas d'ajout/suppression de fichiers | |
# Suppression des blancs de + 1 seconde | |
musique = blank.eat(start_blank=true, max_blank=1.0, threshold=-45.0, playlist(reload=360<à, id="musique", "/home/ubuntu/test/Musique/TOUT/")) | |
musique_FR = blank.eat(start_blank=true, max_blank=1.0, threshold=-45.0, playlist(reload=3600, id="musique_FR", "/home/ubuntu/test/Musique/FR/")) | |
musique_recente = blank.eat(start_blank=true, max_blank=1.0, threshold=-45.0, playlist(reload=3600, id="musique_recente", "/home/ubuntu/test/Musique/AIRPLAY/")) | |
# Application de quotas chansons françaises et nouveautés | |
playlist_quota = mksafe(id="playlist_quota", random( | |
[ musique, musique_FR, musique_recente], | |
weights=[40, 40, 20] | |
)) | |
# Création de la semaine musicale | |
semaine_musicale = switch(id="semaine_musicale", [ | |
({ (1w or 2w or 3w or 4w or 5w) and 6h30-22h30 }, playlist_quota), | |
({ (6w or 7w) and 8h-22h30 }, playlist_quota), | |
({ true }, mksafe(musique)) # switch n'est safe que s'il termine sur une source safe | |
]) | |
# Fonction CROSSFADE | |
def crossfade_3s(a,b) | |
add(normalize=false, | |
[ fade.in(duration=3.,b), | |
fade.out(duration=3.,a) ]) | |
end | |
######################### MONTAGE GRILLE ANTENNE ############################################ | |
grille = fallback([emissions, showergel, rdj, semaine_musicale], | |
transitions=[crossfade_3s, crossfade_3s, crossfade_3s, crossfade_3s], | |
track_sensitive=false, id="grille") | |
# 780 = au moins 13 minutes de délai entre les jingles - possibilité d'amplifier les jingles | |
# "delay" compte en secondes et c'est forcément un flottant d'où le point obligatoire | |
jingles = delay(780., id="jingles", | |
amplify(1.0, playlist.safe("/home/ubuntu/test/Jingles", mode="random", reload_mode="watch")) | |
) | |
# à la fin de chaque track, on va piocher un jingle s'il est dispo (après lecture, il n'est plus dispo) | |
grille_avec_jingle = fallback([jingles, grille], id="grille_avec_jingle") | |
# s'il y a plus de 7 secondes à -50dB, on zappe à la piste suivante ! | |
radio = skip_blank(grille_avec_jingle, max_blank=7., threshold=-50.) | |
########################### PROCESSES AUDIOS ########################################################### | |
# Gate | |
radio = ladspa.gate(radio, threshold = -60.0, attack = 0.15, hold = 1.0, decay = 200.0, range = -25.0) | |
# Wideband AGC + Pre-processing Compresseur SC4 | |
radio = normalize(target = 0., window = 0.03, gain_min = -12., gain_max = 0., radio) | |
radio = ladspa.sc4(rms_peak=0.3, attack_time = 0.5, release_time = 3., threshold_level = -36.0, ratio=1., makeup_gain = 6., radio) | |
# Stereo Expander | |
radio = ladspa.matrixspatialiser(width=16, radio) | |
################## EQUALIZER 8 BANDES ############################### | |
# Bass EQ TAP | |
#radio = ladspa.tap_equalizer(band_1_freq=40., band_1_gain=6., radio) | |
#radio = ladspa.tap_equalizer(band_2_freq=100., band_2_gain=6., radio) | |
radio = ladspa.tap_equalizer(band_1_freq=70., band_1_gain=8., radio) | |
radio = ladspa.tap_equalizer(band_1_freq=150., band_1_gain=4., radio) | |
#radio = ladspa.tap_equalizer(band_3_freq=200., band_3_gain=6., radio) | |
# Middle EQ TAP | |
radio = ladspa.tap_equalizer(band_2_gain=4., radio) | |
radio = ladspa.tap_equalizer(band_5_gain=2., radio) | |
#radio = ladspa.tap_equalizer(band_4_freq=500., band_4_gain=-10., radio) | |
#radio = ladspa.tap_equalizer(band_5_freq=1000., band_5_gain=-10., radio) | |
#radio = ladspa.tap_equalizer(band_6_freq=3000., band_6_gain=-7., radio) | |
# High EQ TAP | |
radio = ladspa.tap_equalizer(band_7_gain=5., radio) | |
radio = ladspa.tap_equalizer(band_8_gain=6., radio) | |
#radio = ladspa.tap_equalizer(band_7_freq=8000., band_7_gain=-11., radio) | |
#radio = ladspa.tap_equalizer(band_8_freq=16000., band_8_gain=-11., radio) | |
################### COMPRESSEURS / LIMITEURS ############################## | |
# 5 Bands Compress/Limit | |
radio = compress.multiband(radio, [ | |
{frequency=200., attack=3.5, release=30., ratio=3., threshold=-10., gain=2.}, | |
{frequency=1000., attack=2.25, release=40., ratio=2., threshold=-13., gain=2.}, | |
{frequency=3500., attack=2.25, release=40., ratio=3., threshold=-9., gain=2.}, | |
{frequency=6500., attack=2.25, release=60., ratio=2., threshold=-6., gain=1.5}, | |
{frequency=20000., attack=2.25, release=70., ratio=2., threshold=-4., gain=1.}, | |
]) | |
# 2 Bands Compress/Limit | |
radio = compress.multiband(radio, [ | |
{frequency=200., attack=10., release=30., ratio=2., threshold=-4., gain=0.}, | |
{frequency=20000., attack=10., release=40., ratio=2., threshold=-2., gain=-2.} | |
]) | |
# De-esser TAP | |
radio = ladspa.tap_deesser(threshold_level=-5., frequency=6000., radio) | |
# Limiter final | |
radio = ladspa.tap_limiter(limit_level = -0.5, radio) | |
##################### SORTIES ########################################### | |
#Paramétrage des différentes sorties matérielles et logicielles | |
#output.alsa(radio, id="alsa") | |
output.icecast(%vorbis, # ou bien mp3, wav, flac, cf. https://www.liquidsoap.info/doc-1.4.0/encoding_formats.html | |
host = "icecast-vps-ovh.airvs.site", | |
port = 8000, | |
name = "AIRVS", description = "La Radio en 1 CLIC !", genre = "Style", url = "stream3", | |
password = "hackme", | |
mount = "stream3", | |
mksafe(buffer(radio)) | |
) | |
output.icecast(%mp3(bitrate=128), # ou bien vorbis, wav, flac, cf. https://www.liquidsoap.info/doc-1.4.0/encoding_formats.html | |
host = "icecast-vps-ovh.airvs.site", | |
port = 8000, | |
name = "AIRVS", description = "La Radio en 1 CLIC !", genre = "Style", url = "stream2", | |
password = "hackme", | |
mount = "stream2", | |
mksafe(buffer(radio)) | |
) | |
output.icecast(%mp3(bitrate=192), # ou bien vorbis, wav, flac, cf. https://www.liquidsoap.info/doc-1.4.0/encoding_form> | |
host = "icecast-vps-ovh.airvs.site", | |
port = 8000, | |
name = "AIRVS", description = "La Radio en 1 CLIC !", genre = "Style", url = "stream4", | |
password = "hackme", | |
mount = "stream4", | |
mksafe(buffer(radio)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment