mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
Example script to load a modulation-script
This commit is contained in:
parent
b8bfa55864
commit
6ecb3b1d82
1 changed files with 25 additions and 0 deletions
25
scripts/_modulate.lua
Normal file
25
scripts/_modulate.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
ardour { ["type"] = "Snippet", name = "Modulation Test" }
|
||||
|
||||
function factory () return function ()
|
||||
local route = Session:get_remote_nth_route(0)
|
||||
assert (route)
|
||||
local pi = route:nth_plugin(0):to_insert()
|
||||
assert (not pi:isnil())
|
||||
-- this test is for x42-eq .. port 3 is "gain"
|
||||
print (pi:load_modulation_script ([[
|
||||
function dsp_modulate(ctrl, bufs, n_samples, offset, start)
|
||||
cnt = cnt or 0
|
||||
cnt = cnt + n_samples
|
||||
local sr = Session:nominal_frame_rate ()
|
||||
if cnt > sr then cnt = cnt - sr end
|
||||
--local gain = ctrl:at (Evoral.Parameter (ARDOUR.AutomationType.PluginAutomation, 0, 3)):to_automationcontrol():to_plugincontrol()
|
||||
--assert (gain)
|
||||
local a = ARDOUR.DSP.fast_coefficient_to_dB (ARDOUR.DSP.compute_peak(bufs:get_audio(0):data(offset), n_samples, 0)) + 10
|
||||
a = math.min (20, math.max(-20, a))
|
||||
--gain:modulate_to (5 * math.sin (math.pi * cnt / sr) - a)
|
||||
ARDOUR.LuaAPI.modulate_to (ctrl, 3, 5 * math.sin (math.pi * cnt / sr) - a)
|
||||
end
|
||||
]]
|
||||
))
|
||||
|
||||
end end
|
||||
Loading…
Add table
Add a link
Reference in a new issue