m1gin 16

I use Ardour to create podcast. Most of the times I need to shift all the regions in all tracks next to the selected one. Even though Ardour give us the chance to shift all regions in the same track, it doesn't I have an option for all the tracks.

I was using Wavelab before and it has two options for that called as "Track auto-grouping" and "Global auto-grouping".

I tried to find similar feature in Ardour for "Gloabl auto-grouping". I spend so much time but I couldn't find an easy option for that.

Here are the steps I do every time to change the positions of all the next regions of a point.

  1. I select a region
  2. Press Ctrl + Shift + E to select all regions after edit point. If there are selected overlapped regions in other tracks they will be also selected.
  3. I do Ctrl + Click to deselect the regions I don't want to move.
  4. I press mouse down and shift the selection to the desired point.

This is really so tiresome, specially if you have so many regions need to be moved.

Today I realized Ardour 6 is relaesed. With a big hope I wanted to look if they developed such a feature or not.
I installed Ardour 6 and started to examine it. But I couldn't find something for what I was hoping.

Since Ardour have the ability to to use some LUA scripts, I started to think about it. I know nothing about Ardour or LUA scripting. Maybe I can learn things and develop my own script for such feature.

And this page will hold my notes about what I will learn about Ardour scripting.

Get the names and positions of selected regions:

-- Region selection
-- http://manual.ardour.org/lua-scripting/class_reference/#ArdourUI:RegionSelection

local sel = Editor:get_selection ()
for r in sel.regions:regionlist ():iter () do
-- each of the items is a
-- http://manual.ardour.org/lua-scripting/class_reference/#ARDOUR:Region
print ("Region:", r:name (), r:position ())

Get selection range:

-- The total time extents of all selected regions and ranges
local ok, ext = Editor:get_selection_extents (0, 0)
if ok then
print ("Selection Extents:", ext[1], ext[2])
print ("No region or range is selected")

  • Session:get_tracks ()

After a couple hours, it looks like I succeeded to develop a script that does the job. Hurray!

I wonder if it is possible to assign a hotkey for this script to make it run. I will try to dig for that after taking some rest. :)

Assigning a hotkey to the script also possible!
To be able to do that, load the script in Script Manager and assing a hotkey in Keyboard Shortcus window.

ardour {
["type"] = "EditorAction",
name = "mb_SelectAllNextRegions",
author = "mim.mbirgin.com",
description = [[Select all regions after selection.]]

function factory () return function ()
local ok, ext = Editor:get_selection_extents (0, 0)

local start_pos = 0;
if (ok) then
start_pos = ext[1]
--end_pos = ext[2]
-- print ("Selection Extents:", ext[1], ext[2])
print("start_pos:", start_pos)

local sl = ArdourUI.SelectionList () -- empty selection list

local sel = Editor:get_selection () -- get current selection
-- for each selected track/bus..
for route in Session:get_tracks ():iter () do
-- consider only tracks
local track = route:to_track ()
if track:isnil() then
goto continue

-- iterate over all regions of the given track
for region in track:playlist():region_list():iter() do
print(region:name(), region:position());
if (region:position () < start_pos) then
-- skip regions before the start point.
-- get RegionView (GUI object to be selected)
local rv = Editor:regionview_from_region (region)
-- add it to the list of Objects to be selected
sl:push_back (rv);

-- set/replace current selection in the editor
Editor:set_selection (sl, ArdourUI.SelectionOp.Set);
end end

Add to: