2020-04-11 05:41:22 -04:00
|
|
|
ardour {
|
|
|
|
["type"] = "dsp",
|
2020-09-30 15:59:20 -04:00
|
|
|
name = "ACE Noise",
|
2020-04-11 05:41:22 -04:00
|
|
|
category = "Utility",
|
|
|
|
license = "MIT",
|
2020-09-30 15:59:20 -04:00
|
|
|
author = "Ardour Community",
|
2020-04-23 23:47:02 -04:00
|
|
|
description = [[Noise Generator featuring either white noise with uniform or gaussian distribution, or pink-noise. The signal level can be customized.]]
|
2020-04-11 05:41:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
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 = "Noise Level", min = -80, max = 0, default = -18, unit="dBFS"},
|
|
|
|
{ ["type"] = "input", name = "Noise Type", min = 0, max = 2, default = 0, enum = true, scalepoints =
|
|
|
|
{
|
|
|
|
["White Noise"] = ARDOUR.DSP.NoiseType.UniformWhiteNoise,
|
|
|
|
["Gaussian White Noise"] = ARDOUR.DSP.NoiseType.GaussianWhiteNoise,
|
|
|
|
["Pink Noise"] = ARDOUR.DSP.NoiseType.PinkNoise,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
local cmem = nil
|
|
|
|
local gen = nil
|
|
|
|
local noise = 0
|
|
|
|
|
|
|
|
function dsp_init (rate)
|
|
|
|
cmem = ARDOUR.DSP.DspShm (8192)
|
|
|
|
gen = ARDOUR.DSP.Generator ()
|
|
|
|
end
|
|
|
|
|
|
|
|
function dsp_run (ins, outs, n_samples)
|
|
|
|
local ctrl = CtrlPorts:array()
|
|
|
|
local lvl = ARDOUR.DSP.dB_to_coefficient (ctrl[1])
|
|
|
|
if (noise ~= ctrl[2]) then
|
|
|
|
noise = ctrl[2]
|
|
|
|
gen:set_type (noise)
|
|
|
|
end
|
|
|
|
for c = 1,#ins do
|
|
|
|
if ins[c] ~= outs[c] then
|
|
|
|
ARDOUR.DSP.copy_vector (outs[c], ins[c], n_samples)
|
|
|
|
end
|
|
|
|
gen:run (cmem:to_float(0), n_samples)
|
|
|
|
ARDOUR.DSP.mix_buffers_with_gain (outs[c], cmem:to_float(0), n_samples, lvl)
|
|
|
|
end
|
|
|
|
end
|