LUA-Script: Mixer Strip Configuration and Automatic Coloring

I usually use the same track colours for the same instruments and often have similar names for the tracks and buses. However, I find colouring the tracks quite time-consuming and therefore I have extended the LUA script Trackorganizer a little.

The colouring of tracks, busses, groups and VCAs can now be done automatically based on tags. In addition, the colours and their assignment can be configured. This configuration is saved and is thus available to every session.

You can find more deatils and the downloads here on my Home - ardour-scripts - Codeberg.org page

ADDED: If there are problems, please open an issue at Issues - ardour-scripts - Codeberg.org

(I have not found a category for LUA-Scripts, so I hope it is ok here…)

4 Likes

VERY cool! Can’t wait to play with this. Well done!

Very convenient ! Thanks for sharing

I have added an EditorHook skript, which applies the coloring rules to added tracks/channels. This way, the correct colours are already assigned when a strip is created.

2 Likes

Hi,

I’m new to luascripts.
Documentation seems to be outdated.
Could you please describe how to integrate those luascripts into ardour6 ?

Best regards

1 Like

You first need to copy all three scripts in the users script-directory. The location is operating system dependent and can be found here: The Ardour Manual, paragraph “Managing Scripts”.
Then start ardour and open Edit->Lua Scripts->Scrip Manager.
In the tab ‘Action Scripts’ select one Line ‘Action x’ (The first four lines will add the action to the 4 upper right buttons in the ardour main window).
Then select ‘Add/Set’ and in the ‘Shortcut’ drop down seach for ‘Mixer Strip Configuration’. (I would recommend a position on one of the first four lines)
Then click the Button ‘Add’. Repeat the same for ‘Settings for Mixer Strip Configuration’. You won’t need this cript so often, so you can use a position beginning with 5.
You can ‘Call’ the scripts right here.
Then swich to the ‘Action Hook’ tab, Click ‘New Hook’, select ‘Coloring Strip When Added Hook’ and click ‘add’ again.

BTW: A more up to date documentation can be found for Mixbus: Scripting - Mixbus32C - 8

HTH Holger

1 Like

Nice idea and execution of it @holgerd. Thanks for sharing.

The first four lines will add the action to the 4 upper right buttons in the ardour main window
…
I would recommend a position on one of the first four lines
…
You won’t need this cript so often, so you can use a position beginning with 5

Just to add to that: four buttons are shown by default but it’s possible to show up to twelve of them.

1 Like

Thank you for scripting and help :grinning:

After all, there’s one question again.
If a script is “connected” to one of the upper right buttons,
a shortcut char or an icon is shown on the button.

How/where can i change it if two buttons show the same char ?

Is it possible to move the buttons to another place in the menu
where i would like to have them ?

Best regards

Hi Harry, it’s not possible to change the icon in Ardour. However, an Icon can be included in the script, but this has to be drawn ‘line by line’, which is a lot of effort.
If someone sends me a simple design, I can try and see if I can get it to work. I myself unfortunately have neither an idea for it, nor the talent :frowning:
Regarding movin the Buttons: No idea!

The script can also use text for the button icon, instead of a drawn icon. There are some examples in the sample scripts, e.g. remove_unknown_procs.lua and preare_record_example.lua.

Below is what I use, adjusting those four “configuration” lines as needed…

function icon (params) return function (ctx, width, height, fg)
  -- configuration
  local iconText = "Hi" -- the text to display
  local iconFont = "ArdourMono" -- the font to use, e.g. "Liberation Sans Narrow" for a narrower one 
  local iconFontScale = 0.5 -- the size of the text; smaller number = smaller text
  local iconColor = fg -- the color. fg is the Ardour skin's foreground color, e.g. white. Can use custom RGBA value, e.g. 0xff0000ff = red, 0x0000ffff = blue.

  local txt = Cairo.PangoLayout (ctx, iconFont.." ".. math.ceil(math.min(width, height) * iconFontScale) .. "px")
  txt:set_text (iconText)
  local tw, th = txt:get_pixel_size ()
  ctx:move_to (.5 * (width - tw), .5 * (height - th))
  ctx:set_source_rgba(ARDOUR.LuaAPI.color_to_rgba (iconColor))
  txt:show_in_cairo_context (ctx)
end end

@HarryR if the script you are talking about truly is using a “character” (text) then look for that character in the script’s icon function and replace it with what you want. E.g. If the button is shown the letter A then look for “A” (including the quotes) and change it to “B” or whatever. Alternatively, replace that entire icon function with the above and set its configuration section. Either way, after that, unassign the script from the button then reassign it (a refresh might be needed first) to see the new icon on the button.

Thank you @johndev!
I added icons with custom text for the two action scripts:

  • “msc” in cyan for the strip configuration
  • “smc” for the settings

@befloibent had found a bug with leading zeros which i fixed and made some suggestions.

  • colors in the settings dialog are always displayed with 6 digits
  • if you copy a html-color string with the leading hash (#12aabb), this is removed automatically

Additionally I extended the error messages a little bit and fixed some typos.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.