Skip to content

Instantly share code, notes, and snippets.

@BusterNeece
Last active June 20, 2022 21:13
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BusterNeece/43a06ee6624975273fdc903ba4a39998 to your computer and use it in GitHub Desktop.
Save BusterNeece/43a06ee6624975273fdc903ba4a39998 to your computer and use it in GitHub Desktop.
Integrating the mkpascal audio processing script with AzuraCast.
# Custom Configuration (Specified in Station Profile)
# This script is customized from the original, which can be found here:
# https://github.com/mkpascal/mk_liquidsoap_processing/blob/master/process.liq
#
# It can be added to your station via `Utilities` > `Edit Liquidsoap Configuration`
# where it can then be pasted into the bottom-most open text area, before the broadcasts
# are sent out to the various sources.
# Audio Input --------------------->
mkpProcess = radio
# Processing Blocks --------------------->
# Gate
mkpProcess = ladspa.gate(mkpProcess, threshold = -60.0, attack = 0.15, hold = 1.0, decay = 200.0, range = -25.0)
# Wideband AGC + Pre-Processing
mkpProcess = normalize(target = 0., window = 0.03, gain_min = -16., gain_max = 0., mkpProcess)
mkpProcess = ladspa.sc4(rms_peak=0.3, attack_time = 0.5, release_time = 3., threshold_level = -36.0, ratio=1., makeup_gain = 6., mkpProcess)
# Stereo Expander
mkpProcess = ladspa.matrixspatialiser(width=16, mkpProcess)
# Bass EQ
mkpProcess = ladspa.tap_equalizer(band_1_freq=70., band_1_gain=8., mkpProcess)
mkpProcess = ladspa.tap_equalizer(band_1_freq=150., band_1_gain=4., mkpProcess)
# Middle EQ
mkpProcess = ladspa.tap_equalizer(band_2_gain=4., mkpProcess)
mkpProcess = ladspa.tap_equalizer(band_5_gain=2., mkpProcess)
# High EQ
mkpProcess = ladspa.tap_equalizer(band_7_gain=5., mkpProcess)
mkpProcess = ladspa.tap_equalizer(band_8_gain=6., mkpProcess)
# 5 Bands Compress/Limit
mkpProcess = compress.multiband(mkpProcess, [
{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
mkpProcess = compress.multiband(mkpProcess, [
{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
mkpProcess = ladspa.tap_deesser(threshold_level=-5., frequency=6000., mkpProcess)
# Final Limiter
mkpProcess = ladspa.tap_limiter(limit_level = -0.5, mkpProcess)
# Audio Output --------------------->
radio = mkpProcess
@Vaalyn
Copy link

Vaalyn commented Nov 10, 2021

Updated script for Liquidsoap 2.0:

# Custom Configuration (Specified in Station Profile)
# This script is customized from the original, which can be found here:
# https://github.com/mkpascal/mk_liquidsoap_processing/blob/master/process.liq
# 
# It can be added to your station via `Utilities` > `Edit Liquidsoap Configuration`
# where it can then be pasted into the bottom-most open text area, before the broadcasts
# are sent out to the various sources.

# Functions / Modules --------------------->

# Compressor Module / Limiter Module
compressor = ladspa.sc4(rms_peak = 0.5)
limiter = ladspa.tap_limiter(limit_level = -0.5)

# Single Band Compressor
def multiband_band(process, from_freq, to_freq, attack, release, ratio, threshold, gain)
	from_filter = filter.iir.eq.high(frequency = from_freq,)
	to_filter = filter.iir.eq.low(frequency = to_freq,)
	process_filtered = to_filter(from_filter(process))
	process_compressed = limiter(compressor(attack_time = attack, release_time = release, threshold_level = threshold, ratio=ratio, makeup_gain = gain, process_filtered))
	process_compressed
end

# Audio Input --------------------->

mkpProcess = radio

# Processing Blocks --------------------->

# Gate
mkpProcess = ladspa.gate(mkpProcess, threshold = -60.0, attack = 0.15, hold = 1.0, decay = 200.0, range = -25.0)

# Wideband AGC + Pre-Processing
mkpProcess = normalize(target = 0., window = 0.03, gain_min = -16., gain_max = 0., mkpProcess)
mkpProcess = ladspa.sc4(rms_peak=0.3, attack_time = 0.5, release_time = 3., threshold_level = -36.0, ratio=1., makeup_gain = 6., mkpProcess)

# Stereo Expander
mkpProcess = ladspa.matrixspatialiser(width=16, mkpProcess)

# Bass EQ
mkpProcess = ladspa.tap_equalizer(band_1_freq=70., band_1_gain=4., mkpProcess)
mkpProcess = ladspa.tap_equalizer(band_1_freq=150., band_1_gain=-2., mkpProcess)

# 5 Bands Compress/Limit
mkpProcess = add(normalize=false,
  [
  multiband_band(mkpProcess, 0., 200., 3.5, 30., 3., -10., 2.),
  multiband_band(mkpProcess, 200., 1000., 2.25, 40., 2., -13., 2.),
  multiband_band(mkpProcess, 1000., 3500., 2.25, 40., 3., -9., 2.),
  multiband_band(mkpProcess, 3500., 6500., 2.25, 60., 2., -6., 1.5),
  multiband_band(mkpProcess, 6500., 20000., 2.25, 70., 2., -4., 1.)
  ])

# 2 Bands Compress/Limit
mkpProcess = add(normalize=false,
  [
  multiband_band(mkpProcess, 0., 200., 10., 30., 2., -4., 0.),
  multiband_band(mkpProcess, 200., 20000., 10., 40., 2., -2., -2.)
  ])

# De-esser
mkpProcess = ladspa.tap_deesser(threshold_level=-5., frequency=6000., mkpProcess)

# Final Limiter
mkpProcess = limiter(mkpProcess)

# Audio Output --------------------->
radio = mkpProcess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment