2 ["type"] = "TrackSetup",
3 name = "Live Band Recording Session",
5 This template helps create the tracks for a typical pop/rock band.
7 You will be prompted to assemble your session from a list of track types.
9 Each track will be pre-assigned with a color.
11 Optionally, tracks may be assigned to sensible Groups ( vocals, guitars, drums )
13 Optionally, tracks may be assigned Gates and other plugins.
17 function session_setup ()
19 --prompt the user for the tracks they'd like to instantiate
20 local dialog_options = {
21 { type = "heading", title = "Select the tracks you'd like\n to add to your session: " },
23 { type = "checkbox", key = "ldvox", default = false, title = "Lead Vocal" },
25 { type = "checkbox", key = "bass", default = false, title = "Bass" },
27 { type = "checkbox", key = "piano", default = false, title = "Piano" },
28 { type = "checkbox", key = "electric-piano", default = false, title = "Electric Piano" },
29 { type = "checkbox", key = "organ", default = false, title = "Organ" },
31 { type = "checkbox", key = "electric-guitar", default = false, title = "Electric Guitar" },
32 { type = "checkbox", key = "solo-guitar", default = false, title = "Lead Guitar" },
33 { type = "checkbox", key = "accoustic-guitar", default = false, title = "Acoustic Guitar" },
35 { type = "checkbox", key = "basic-kit", default = false, title = "Basic Drum Mics (Kick + Snare)" },
36 { type = "checkbox", key = "full-kit", default = false, title = "Full Drum Mics (Kick, Snare, HiHat, 3 Toms)" },
37 { type = "checkbox", key = "overkill-kit", default = false, title = "Overkill Drum Mics (Kick (2x), Snare(2x), HiHat, 3 Toms)" },
39 { type = "checkbox", key = "overhead-mono", default = false, title = "Drum OH (2 mono)" },
40 { type = "checkbox", key = "overhead-stereo", default = false, title = "Drum OH (Stereo)" },
42 { type = "checkbox", key = "room-mono", default = false, title = "Drum Room (Mono)" },
43 { type = "checkbox", key = "room-stereo", default = false, title = "Drum Room (Stereo)" },
45 { type = "checkbox", key = "bgvox", default = false, title = "Background Vocals (3x)" },
47 { type = "heading", title = "-------------------" },
49 { type = "checkbox", key = "group", default = false, title = "Group Track(s)?" },
50 { type = "checkbox", key = "gates", default = false, title = "Add Gate(s)?" },
51 { type = "checkbox", key = "char", default = false, title = "Add Character Plugin(s)?" },
54 local dlg = LuaDialog.Dialog ("Template Setup", dialog_options)
60 -- helper function to reference processors
61 function processor(t, s) --takes a track (t) and a string (s) as arguments
63 local proc = t:nth_processor(i)
65 if ( proc:display_name() == s ) then
70 proc = t:nth_processor(i)
74 --INSTANTIATING MIDI TRACKS IS TOO DAMN HARD
75 function create_midi_track(name, chan_count) -- call this function with a name argument and output channel count
76 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)
81 drum_group = Session:new_route_group("Drums")
82 drum_group:set_rgba(0x425CADff)
83 bass_group = Session:new_route_group("Bass")
84 bass_group:set_rgba(0x1AE54Eff)
85 guitar_group = Session:new_route_group("Guitars")
86 guitar_group:set_rgba(0xB475CBff)
87 key_group = Session:new_route_group("Keys")
88 key_group:set_rgba(0xDA8032ff)
89 vox_group = Session:new_route_group("Vox")
90 vox_group:set_rgba(0xC54249ff)
93 local track_count = 0;
94 if rv['basic-kit'] then
95 local names = {"Kick", "Snare"}
97 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
98 for track in tl:iter() do
99 local gate = ARDOUR.LuaAPI.new_plugin(Session, "XT-EG Expander Gate (Mono)", ARDOUR.PluginType.LV2, "")
100 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
101 if rv['group'] then drum_group:add(track) end
102 if rv['gates'] then track:add_processor_by_index(eg, 0, nil, true) end
106 track_count = track_count+2
109 if rv['full-kit'] then
110 local names = {"Kick", "Snare", "Hi-Hat", "Hi-tom", "Mid-tom", "Fl-tom"}
112 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
113 for track in tl:iter() do
114 local eg = ARDOUR.LuaAPI.new_plugin(Session, "XT-EG Expander Gate (Mono)", ARDOUR.PluginType.LV2, "")
115 local tg = ARDOUR.LuaAPI.new_plugin(Session, "XT-TG Tom Gate (Mono)", ARDOUR.PluginType.LV2, "")
116 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
117 if rv['group'] then drum_group:add(track) end
119 if string.find(track:name(), '-tom') then
120 track:add_processor_by_index(tg, 0, nil, true)
122 track:add_processor_by_index(eg, 0, nil, true)
128 track_count = track_count+6
131 if rv['overkill-kit'] then
132 local names = {"Kick In", "Kick Out", "Snare Top", "Snare Btm", "Hi-Hat", "Hi-tom", "Mid-tom", "Fl-tom"}
134 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
135 for track in tl:iter() do
136 local eg = ARDOUR.LuaAPI.new_plugin(Session, "XT-EG Expander Gate (Mono)", ARDOUR.PluginType.LV2, "")
137 local tg = ARDOUR.LuaAPI.new_plugin(Session, "XT-TG Tom Gate (Mono)", ARDOUR.PluginType.LV2, "")
138 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
139 if rv['group'] then drum_group:add(track) end
141 if string.find(track:name(), '-tom') then
142 track:add_processor_by_index(tg, 0, nil, true)
144 track:add_processor_by_index(eg, 0, nil, true)
150 track_count = track_count+8
153 if rv['overhead-mono'] then
154 local names = {"Drum OHL", "Drum OHR"}
156 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
157 for track in tl:iter() do
158 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
159 if rv['group'] then drum_group:add(track) end
163 track_count = track_count+2
166 if rv['overhead-stereo'] then
167 local names = {"Drum OH (st)"}
169 local tl = Session:new_audio_track (2, 2, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
170 for track in tl:iter() do
171 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
172 if rv['group'] then drum_group:add(track) end
176 track_count = track_count+2
179 if rv['room-mono'] then
180 local names = {"Drum Room"}
182 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
183 for track in tl:iter() do
184 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
185 if rv['group'] then drum_group:add(track) end
189 track_count = track_count+1
192 if rv['room-stereo'] then
193 local names = {"Drum Room (st)"}
195 local tl = Session:new_audio_track (2, 2, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
196 for track in tl:iter() do
197 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
198 if rv['group'] then drum_group:add(track) end
202 track_count = track_count+2
206 local names = {"Bass"}
208 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
209 for track in tl:iter() do
210 local bc = ARDOUR.LuaAPI.new_plugin(Session, "XT-BC Bass Character (Mono)", ARDOUR.PluginType.LV2, "")
211 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
212 if rv['group'] then bass_group:add(track) end
213 if rv['char'] then track:add_processor_by_index(bc, 0, nil, true) end
217 track_count = track_count+1
220 if rv['electric-guitar'] then
221 local names = {"El Guitar"}
223 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
224 for track in tl:iter() do
225 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
226 if rv['group'] then guitar_group:add(track) end
230 track_count = track_count+1
233 if rv['solo-guitar'] then
234 local names = {"Ld Guitar"}
236 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
237 for track in tl:iter() do
238 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
239 if rv['group'] then guitar_group:add(track) end
243 track_count = track_count+1
246 if rv['accoustic-guitar'] then
247 local names = {"Ac Guitar"}
249 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
250 for track in tl:iter() do
251 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
252 if rv['group'] then guitar_group:add(track) end
256 track_count = track_count+1
260 local names = {"Piano"}
262 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
263 for track in tl:iter() do
264 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
265 if rv['group'] then key_group:add(track) end
269 track_count = track_count+1
272 if rv['electric-piano'] then
273 local names = {"E Piano"}
275 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
276 for track in tl:iter() do
277 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
278 if rv['group'] then key_group:add(track) end
282 track_count = track_count+1
286 local names = {"Organ"}
288 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
289 for track in tl:iter() do
290 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
291 if rv['group'] then key_group:add(track) end
295 track_count = track_count+1
299 local names = {"Vox"}
301 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
302 for track in tl:iter() do
303 local vc = ARDOUR.LuaAPI.new_plugin(Session, "XT-VC Vocal Character (Mono)", ARDOUR.PluginType.LV2, "")
304 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
305 if rv['group'] then vox_group:add(track) end
306 if rv['char'] then track:add_processor_by_index(vc, 0, nil, true) end
310 track_count = track_count+1
314 local names = {"Bg. Vox 1", "Bg. Vox 2", "Bg. Vox 3"}
316 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
317 for track in tl:iter() do
318 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
319 if rv['group'] then vox_group:add(track) end
323 track_count = track_count+1
326 --determine the number of tracks we can record
327 local e = Session:engine()
328 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"
329 local num_inputs = t[4]:size(); -- table 't' holds argument references. t[4] is the C.StringVector (return value)
331 --ToDo: if track_count > num_inputs, we should warn the user to check their routing.
333 --fit all tracks on the screen
334 Editor:access_action("Editor","fit_all_tracks")
336 Session:save_state("");