Skip to content

Instantly share code, notes, and snippets.

@JamesHarrison
Created March 12, 2012 19:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JamesHarrison/d17d667597ce42ba6f09 to your computer and use it in GitHub Desktop.
Save JamesHarrison/d17d667597ce42ba6f09 to your computer and use it in GitHub Desktop.
#!/usr/bin/liquidsoap
# Example liquidsoap encoder for multiple online streams from a single audio source
# Includes some basic processing examples using LADSPA and built in effects
## Liquidsoap Runtime parameters
# Log path
set("log.file.path","/tmp/basic-radio.log")
# Allow remote access on telnet
set("server.telnet", true)
set("server.telnet.bind_addr","0.0.0.0")
set("server.telnet.port",1234)
# Input from ALSA
source = input.alsa(bufferize=false, id="input_source")
# Or JACK
# source = input.jack(id="input_source")
# Or input from another stream - just make sure it's as high-quality as possible and really, really, really use raw audio if you can
# Force the source ID name.
# source = mksafe(input.http("http://some-address:8000/live-source.mp3", id="input_source"))
## Audio processing
# Gate the input for starters, stops noise from clobbering things in silent periods.
source = ladspa.gate(source, threshold = -60.0, attack = 0.15, hold = 1.0, decay = 200.0, range = -25.0)
# Multiband compression - split up, compress, recombine, sky does it all, but is not very configurable. 3-band.
source = sky(source)
# Now overall compression, faster attack, harder ratio, mostly RMS based.
source = compress(source, attack = 25.0, gain = 3.0, knee = 6.0, ratio = 4.0, release = 150.0, threshold = -14.0, rms_window = 0.7)
# Normalize, with a higher threshold to stop suck-up.
source = normalize(source, target = -2.0, threshold = -45.0)
# Limiter, this one's a scaling one which limits nicely and without artefacting mostly
source = ladspa.tap_limiter(source, limit_level = -0.5)
# And a final limiter - this should never really get hit, but stops anything nasty hitting the DAC. Highly peak-focused.
source = limit(source, threshold = -0.2, attack = 5.0, release = 50.0, rms_window = 0.05)
# Stick a meter on this. This is queryable via telnet. Force the source name.
source = server.rms(source, id="input_source")
# Stream it out in all the formats we want.
output.icecast(%mp3.cbr(bitrate=320, samplerate=48000),
host = "INSERT YOUR ICECAST HOST HERE", port = 8000,
password = "INSERT YOUR PASSWORD HERE", mount = "live-320k.mp3",
name = "Insanity Radio - 103.2 MHz FM / 1287 kHz AM - 320k MP3",
genre = "Community Radio",
timeout = 10.0,
url = "http://www.insanityradio.com",
description = "Across the campus on air, across the world online",
source)
output.icecast(%mp3.cbr(bitrate=192, samplerate=44100),
host = "INSERT YOUR ICECAST HOST HERE", port = 8000,
password = "INSERT YOUR PASSWORD HERE", mount = "live-192k.mp3",
name = "Insanity Radio - 103.2 MHz FM / 1287 kHz AM - 192k MP3",
genre = "Community Radio",
timeout = 10.0,
url = "http://www.insanityradio.com",
description = "Across the campus on air, across the world online",
source)
output.icecast(%mp3.cbr(bitrate=96, samplerate=44100),
host = "INSERT YOUR ICECAST HOST HERE", port = 8000,
password = "INSERT YOUR PASSWORD HERE", mount = "live-96k.mp3",
name = "Insanity Radio - 103.2 MHz FM / 1287 kHz AM - 96k MP3",
genre = "Community Radio",
timeout = 10.0,
url = "http://www.insanityradio.com",
description = "Across the campus on air, across the world online",
source)
output.icecast(%aacplus(bitrate=64, channels=2, samplerate=44100),
host = "INSERT YOUR ICECAST HOST HERE", port = 8000,
password = "INSERT YOUR PASSWORD HERE", mount = "live-64k.aac",
name = "Insanity Radio - 103.2 MHz FM / 1287 kHz AM - 64k HE-AACv2",
genre = "Community Radio",
timeout = 10.0,
url = "http://www.insanityradio.com",
description = "Across the campus on air, across the world online",
source)
output.icecast(%aacplus(bitrate=32, channels=2, samplerate=44100),
host = "INSERT YOUR ICECAST HOST HERE", port = 8000,
password = "INSERT YOUR PASSWORD HERE", mount = "live-32k.aac",
name = "Insanity Radio - 103.2 MHz FM / 1287 kHz AM - 32k HE-AACv2",
genre = "Community Radio",
timeout = 10.0,
url = "http://www.insanityradio.com",
description = "Across the campus on air, across the world online",
source)
output.icecast(%aac(bitrate=192, channels=2, samplerate=44100, adts=true),
host = "INSERT YOUR ICECAST HOST HERE", port = 8000,
password = "INSERT YOUR PASSWORD HERE", mount = "live-192k.aac",
name = "Insanity Radio - 103.2 MHz FM / 1287 kHz AM - 192k AAC",
genre = "Community Radio",
timeout = 10.0,
url = "http://www.insanityradio.com",
description = "Across the campus on air, across the world online",
source)
output.icecast(%aac(bitrate=128, channels=2, samplerate=44100, adts=true),
host = "INSERT YOUR ICECAST HOST HERE", port = 8000,
password = "INSERT YOUR PASSWORD HERE", mount = "live-128k.aac",
name = "Insanity Radio - 103.2 MHz FM / 1287 kHz AM - 128k AAC",
genre = "Community Radio",
timeout = 10.0,
url = "http://www.insanityradio.com",
description = "Across the campus on air, across the world online",
source)
output.icecast(%aac(bitrate=96, channels=2, samplerate=44100, adts=true),
host = "INSERT YOUR ICECAST HOST HERE", port = 8000,
password = "INSERT YOUR PASSWORD HERE", mount = "live-96k.aac",
name = "Insanity Radio - 103.2 MHz FM / 1287 kHz AM - 96k AAC",
genre = "Community Radio",
timeout = 10.0,
url = "http://www.insanityradio.com",
description = "Across the campus on air, across the world online",
source)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment