serdeman
(Steve Erdeman)
April 9, 2020, 2:01am
#1
Greetings Ardour friends,
I’m trying my hand at writing a Lua script that will set all session faders to a certain value. Looking at the Lua section in the Ardour manual, I can’t seem to find “how” to actually set a fader value. Any guidance would be much appreciated.
Thank you,
Steve
x42
(Robin Gareus)
April 9, 2020, 2:23am
#2
The Fader is the main gain_control
of each Track. So to set all faders to -6dB (gain coefficient 0.5):
for t in Session:get_tracks():iter() do
t:gain_control():set_value (0.5, PBD.GroupControlDisposition.NoGroup)
end
I suggest to look at examples. The following two seem pertinent:
ardour {
["type"] = "EditorAction",
name = "Faders to Trims",
license = "MIT",
author = "PSmith",
description = [[Add 'Trim' plugins to all tracks. Move the fader value into the trim.]]
}
function action_params ()
return
{
}
end
function factory (params)
return function ()
-- loop over all tracks
for t in Session:get_tracks():iter() do
This file has been truncated. show original
ardour { ["type"] = "Snippet", name = "Fader Automation" }
function factory () return function ()
local playhead = Session:transport_sample ()
local samplerate = Session:nominal_sample_rate ()
-- get selected tracks
rl = Editor:get_selection ().tracks:routelist ()
-- prepare undo operation
Session:begin_reversible_command ("Fancy Fade Out")
local add_undo = false -- keep track if something has changed
-- iterate over selected tracks
for r in rl:iter () do
local ac = r:amp ():gain_control () -- ARDOUR:AutomationControl
local al = ac:alist () -- ARDOUR:AutomationList (state, high-level)
-- set automation state to "Touch"
ac:set_automation_state (ARDOUR.AutoState.Touch)
This file has been truncated. show original
serdeman
(Steve Erdeman)
April 9, 2020, 4:10am
#3
Hi Robin,
Thank you so much for helping me with this. It worked!
And I am so glad there is a quick script access under the Edit menu. Awesome.
Thank you,
Steve
system
(system)
closed
July 9, 2020, 10:10am
#4
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.