13
0

Some initial track templates.

This commit is contained in:
Ben Loftis 2017-08-17 16:17:12 -05:00
parent 4914b7feea
commit 9a7bd07e8f
3 changed files with 292 additions and 59 deletions

View File

@ -1,6 +1,6 @@
ardour {
["type"] = "TrackSetup",
name = "Live Recording Session",
name = "Route Test",
description = [[ FOR TESTING AND PROTOTYING ONLY ]]
}

View File

@ -1,100 +1,333 @@
ardour {
["type"] = "TrackSetup",
name = "Live Band Tracks",
name = "Live Band Recording Session",
description = [[
This template helps create the tracks for a typical pop/rock band.
You will be prompted to assemble your session from a list of track types.
Each track comes with its pre-assigned grouping, routing, EQ and plugins.
]]
]]
}
function track_setup ()
function session_setup ()
--prompt the user for the tracks they'd like to instantiate
--prompt the user for the tracks they'd like to instantiate
local dialog_options = {
{ type = "heading", title = "Select the tracks you'd like\n to add to your session: " },
{ type = "checkbox", key = "LeadVox", default = false, title = "Lead Vocal" },
{ type = "checkbox", key = "ldvox", default = false, title = "Lead Vocal" },
{ type = "checkbox", key = "Bass", default = false, title = "Bass" },
{ type = "checkbox", key = "bass", default = false, title = "Bass" },
{ type = "checkbox", key = "Piano", default = false, title = "Piano" },
{ type = "checkbox", key = "E. Piano", default = false, title = "E. Piano" },
{ type = "checkbox", key = "Organ", default = false, title = "Organ" },
{ type = "checkbox", key = "piano", default = false, title = "Piano" },
{ type = "checkbox", key = "electric-piano", default = false, title = "E. Piano" },
{ type = "checkbox", key = "organ", default = false, title = "Organ" },
{ type = "checkbox", key = "ElecGuitar", default = false, title = "Electric Guitar" },
{ type = "checkbox", key = "SoloGuitar", default = false, title = "Guitar Solo" },
{ type = "checkbox", key = "AcousticGuitar", default = false, title = "Acoustic Guitar" },
{ type = "checkbox", key = "electric-guitar", default = false, title = "Electric Guitar" },
{ type = "checkbox", key = "solo-guitar", default = false, title = "Guitar Solo" },
{ type = "checkbox", key = "accoustic-guitar", default = false, title = "Acoustic Guitar" },
{ type = "checkbox", key = "basicDrums", default = false, title = "Basic Drum Mics (Kick + Snare)" },
{ type = "checkbox", key = "fullDrums", default = false, title = "Full Drum Mics (Kick, Snare, HiHat, 3 Toms)" },
{ type = "checkbox", key = "overDrums", default = false, title = "Overkill Drum Mics (Kick (2x), Snare(2x), HiHat, 3 Toms)" },
{ type = "checkbox", key = "basic-kit", default = false, title = "Basic Drum Mics (Kick + Snare)" },
{ type = "checkbox", key = "full-kit", default = false, title = "Full Drum Mics (Kick, Snare, HiHat, 3 Toms)" },
{ type = "checkbox", key = "overkill-kit", default = false, title = "Overkill Drum Mics (Kick (2x), Snare(2x), HiHat, 3 Toms)" },
{ type = "checkbox", key = "Drum O-Heads (2 mono)", default = false, title = "Drum O-Heads (2 mono)" },
{ type = "checkbox", key = "Drum O-Heads (Stereo)", default = false, title = "Drum O-Heads (Stereo)" },
{ type = "checkbox", key = "overhead-mono", default = false, title = "Drum O-Heads (2 mono)" },
{ type = "checkbox", key = "overhead-stereo", default = false, title = "Drum O-Head (Stereo)" },
{ type = "checkbox", key = "Room (Mono)", default = false, title = "Room (Mono)" },
{ type = "checkbox", key = "Room (Stereo)", default = false, title = "Room (Stereo)" },
{ type = "checkbox", key = "room-mono", default = false, title = "Room (Mono)" },
{ type = "checkbox", key = "room-stereo", default = false, title = "Room (Stereo)" },
{ type = "checkbox", key = "BGV", default = false, title = "Background Vocals (3x)" },
{ type = "checkbox", key = "bgvox", default = false, title = "Background Vocals (3x)" },
{ type = "heading", title = "-------------------" },
{ type = "checkbox", key = "group", default = false, title = "Group Track(s)?" },
{ type = "checkbox", key = "gates", default = false, title = "Add Gate(s)?" },
{ type = "checkbox", key = "char", default = false, title = "Add Character Plugin(s)?" },
}
local dlg = LuaDialog.Dialog ("Template Setup", dialog_options)
local rv = dlg:run()
if (not rv) then
return
end
local track_list = {}
local channel_count = 0
function add_track (io, name)
local tl = Session:new_audio_track (io, io, nil, 1, name, ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
table.insert (track_list, track)
channel_count = channel_count + io
-- helper function to reference processors
function processor(t, s) --takes a track (t) and a string (s) as arguments
local i = 0
local proc = t:nth_processor(i)
repeat
if ( proc:display_name() == s ) then
return proc
else
i = i + 1
end
proc = t:nth_processor(i)
until proc:isnil()
end
--INSTANTIATING MIDI TRACKS IS TOO DAMN HARD
function create_midi_track(name, chan_count) -- call this function with a name argument and output channel count
Session:new_midi_track(ARDOUR.ChanCount(ARDOUR.DataType ("midi"), 1), ARDOUR.ChanCount(ARDOUR.DataType ("audio"), chan_count), true, ARDOUR.PluginInfo(), nil, nil, 1, name, 1, ARDOUR.TrackMode.Normal)
return true
end
-- for each selected item, create track(s), add plugins, etc
if rv['Bass'] then
add_track (1, "Bass")
local trk = track_list.front()
local color = 0xff8800ff --orange
trk:presentation_info_ptr ():set_color (color)
if rv['group'] then
drum_group = Session:new_route_group("Drums")
drum_group:set_rgba(0x425CADff)
bass_group = Session:new_route_group("Bass")
bass_group:set_rgba(0x1AE54Eff)
guitar_group = Session:new_route_group("Guitars")
guitar_group:set_rgba(0xB475CBff)
key_group = Session:new_route_group("Keys")
key_group:set_rgba(0xDA8032ff)
vox_group = Session:new_route_group("Vox")
vox_group:set_rgba(0xC54249ff)
end
if rv['Room (Stereo)'] then
add_track (2, "Room (Stereo)")
local track_count = 0;
if rv['basic-kit'] then
local names = {"Kick", "Snare"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
local gate = ARDOUR.LuaAPI.new_plugin(Session, "XT-EG Expander Gate (Mono)", ARDOUR.PluginType.LV2, "")
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then drum_group:add(track) end
if rv['gates'] then track:add_processor_by_index(eg, 0, nil, true) end
end
end
track_count = track_count+2
end
-- TODO add others
if rv['full-kit'] then
local names = {"Kick", "Snare", "Hi-Hat", "Hi-tom", "Mid-tom", "Fl-tom"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
local eg = ARDOUR.LuaAPI.new_plugin(Session, "XT-EG Expander Gate (Mono)", ARDOUR.PluginType.LV2, "")
local tg = ARDOUR.LuaAPI.new_plugin(Session, "XT-TG Tom Gate (Mono)", ARDOUR.PluginType.LV2, "")
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then drum_group:add(track) end
if rv['gates'] then
if string.find(track:name(), '-tom') then
track:add_processor_by_index(tg, 0, nil, true)
else
track:add_processor_by_index(eg, 0, nil, true)
end
end
end
end
track_count = track_count+6
end
-- determine the number of physical inputs
if rv['overkill-kit'] then
local names = {"Kick In", "Kick Out", "Snare Top", "Snare Bottom", "Hi-Hat", "Hi-tom", "Mid-tom", "Fl-tom"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
local eg = ARDOUR.LuaAPI.new_plugin(Session, "XT-EG Expander Gate (Mono)", ARDOUR.PluginType.LV2, "")
local tg = ARDOUR.LuaAPI.new_plugin(Session, "XT-TG Tom Gate (Mono)", ARDOUR.PluginType.LV2, "")
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then drum_group:add(track) end
if rv['gates'] then
if string.find(track:name(), '-tom') then
track:add_processor_by_index(tg, 0, nil, true)
else
track:add_processor_by_index(eg, 0, nil, true)
end
end
end
end
track_count = track_count+8
end
if rv['overhead-mono'] then
local names = {"Overhead Left", "Overhead Right"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then drum_group:add(track) end
end
end
track_count = track_count+2
end
if rv['overhead-stereo'] then
local names = {"Stereo Overhead"}
for i = 1, #names do
local tl = Session:new_audio_track (2, 2, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then drum_group:add(track) end
end
end
track_count = track_count+2
end
if rv['room-mono'] then
local names = {"Room"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then drum_group:add(track) end
end
end
track_count = track_count+1
end
if rv['room-stereo'] then
local names = {"Stereo Room"}
for i = 1, #names do
local tl = Session:new_audio_track (2, 2, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then drum_group:add(track) end
end
end
track_count = track_count+2
end
if rv['bass'] then
local names = {"Bass"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
local bc = ARDOUR.LuaAPI.new_plugin(Session, "XT-BC Bass Character (Mono)", ARDOUR.PluginType.LV2, "")
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then bass_group:add(track) end
if rv['char'] then track:add_processor_by_index(bc, 0, nil, true) end
end
end
track_count = track_count+1
end
if rv['electric-guitar'] then
local names = {"Electric Guitar"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then guitar_group:add(track) end
end
end
track_count = track_count+1
end
if rv['solo-guitar'] then
local names = {"Solo Guitar"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then guitar_group:add(track) end
end
end
track_count = track_count+1
end
if rv['accoustic-guitar'] then
local names = {"Accoustic Guitar"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then guitar_group:add(track) end
end
end
track_count = track_count+1
end
if rv['piano'] then
local names = {"Piano"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then key_group:add(track) end
end
end
track_count = track_count+1
end
if rv['electric-piano'] then
local names = {"Electric Piano"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then key_group:add(track) end
end
end
track_count = track_count+1
end
if rv['organ'] then
local names = {"Organ"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then key_group:add(track) end
end
end
track_count = track_count+1
end
if rv['ldvox'] then
local names = {"Vox"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
local vc = ARDOUR.LuaAPI.new_plugin(Session, "XT-VC Vocal Character (Mono)", ARDOUR.PluginType.LV2, "")
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then vox_group:add(track) end
if rv['char'] then track:add_processor_by_index(vc, 0, nil, true) end
end
end
track_count = track_count+1
end
if rv['bgvox'] then
local names = {"Bg. Vox 1", "Bg. Vox 2", "Bg. Vox 3"}
for i = 1, #names do
local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
--track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
if rv['group'] then vox_group:add(track) end
end
end
track_count = track_count+1
end
--determine the number of tracks we can record
local e = Session:engine()
-- from the engine's POV readable/capture ports are "outputs"
local _, t = e:get_backend_ports ("", ARDOUR.DataType("audio"), ARDOUR.PortFlags.IsOutput | ARDOUR.PortFlags.IsPhysical, C.StringVector())
-- table 't' holds argument references. t[4] is the C.StringVector (return value)
local num_inputs = t[4]:size()
local _, t = e:get_backend_ports ("", ARDOUR.DataType("audio"), ARDOUR.PortFlags.IsOutput | ARDOUR.PortFlags.IsPhysical, C.StringVector()) -- from the engine's POV readable/capture ports are "outputs"
local num_inputs = t[4]:size(); -- table 't' holds argument references. t[4] is the C.StringVector (return value)
if num_inputs < channel_count then
-- warn the user if there are less physical inputs than created tracks
LuaDialog.Message ("Session Creation", "Check your routing :)", LuaDialog.MessageType.Info, LuaDialog.ButtonType.Close):run ()
else
--ToDo: if track_count > num_inputs, we should warn the user to check their routing.
-- otherwise record arm all created tracks
for _, t in ipairs (track_list) do
t:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
end
end
--fit all tracks on the screen
Editor:access_action("Editor","fit_all_tracks")
--fit all tracks on the screen
Editor:access_action("Editor","fit_all_tracks")
Session:save_state("");
end

View File

@ -12,7 +12,7 @@ You will be prompted for:
]]
}
function track_setup ()
function session_setup ()
local e = Session:engine()
-- from the engine's POV readable/capture ports are "outputs"
local _, t = e:get_backend_ports ("", ARDOUR.DataType("audio"), ARDOUR.PortFlags.IsOutput | ARDOUR.PortFlags.IsPhysical, C.StringVector())