Skip to content

Instantly share code, notes, and snippets.

@x42
Last active October 18, 2025 02:11
Show Gist options
  • Save x42/bcc5dc0873ff8318e6fc0ae157bc444f to your computer and use it in GitHub Desktop.
Save x42/bcc5dc0873ff8318e6fc0ae157bc444f to your computer and use it in GitHub Desktop.
ardour { ["type"] = "dsp", name = "Beelzebub Maximizer", category = "Dynamics", license = "MIT", author = "Ardour Team", description = [[Barry's Satan Maximizer]] }
-- this is based on swh's https://github.com/swh/ladspa/blob/master/satan_maximiser_1408.xml
function dsp_ioconfig () return
-- -1, -1 = any number of channels as long as input and output count matches
{ { audio_in = -1, audio_out = -1 } }
end
function dsp_params ()
return
{
{ ["type"] = "input", name = "Decay time (samples)", min = 2, max = 30, default = 30},
{ ["type"] = "input", name = "Knee Point", min = -90, max = 0, default = 0, logarithmic = true},
}
end
local env = 0
local pos = 0
function dsp_configure (ins, outs)
self:shmem ():allocate (ins:n_audio () * 16)
self:shmem ():clear ()
end
function dsp_run (ins, outs, n_samples)
local ctrl = CtrlPorts:array ()
local knee = ARDOUR.DSP.dB_to_coefficient(ctrl[2]);
local env_time = ctrl[1];
local delay = math.floor (.5 + env_time * 0.5);
local env_tr = 1.0 / env_time;
-- get data for all channels
local i = {}
local o = {}
local b = {}
for c = 1,#ins do
local m = (c - 1) * 16
i[c] = ins[c]:array()
o[c] = outs[c]:array()
b[c] = self:shmem ():to_float (m):array ()
end
-- process all audio samples
for s = 1, n_samples do
-- get max level from all channels
for c = 1,#ins do
local f = math.abs (i[c][s])
if f > env then
env = f
else
env = f * env_tr + env * (1 - env_tr)
end
end
local env_sc
if env <= knee then
env_sc = 1 / knee
else
env_sc = 1 / env;
end
-- apply gain
local idx = (16 + pos - delay) & 15
for c = 1,#ins do
b[c][1 + pos] = i[c][s];
o[c][s] = b[c][1 + idx] * env_sc;
end
pos = (pos + 1) & 15
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment