Sorry for the late reply. Scripts for creating audio and midi bus in Ardour 9.7.7.
To create a stereo mid bus:
ardour {
["type"] = "EditorAction",
name = "Create Stereo Midi Bus",
license = "MIT",
description = "Creates Stereo Midi Bus"
}
function factory ()
return function ()
local session = Session
-- 1. Safely initialize an empty Route Group to prevent memory crashes
local empty_group = ARDOUR.RouteGroup()
local type_midi = ARDOUR.DataType("midi")
local type_audio = ARDOUR.DataType("audio")
-- Open a transaction block to maintain host stability
session:begin_reversible_command("Create Stereo Midi Bus")
-- 2. Create the Destination MIDI Bus (1 MIDI input, 2 Audio outputs for Stereo)
local bus_in_count = ARDOUR.ChanCount(type_midi, 1)
local bus_out_count = ARDOUR.ChanCount(type_audio, 2)
local bus_list = session:new_midi_track(
bus_in_count,
bus_out_count,
true, -- strict_io
ARDOUR.PluginInfo(), -- instrument plugin
nil, -- pset (PresetRecord)
empty_group, -- Pass valid group memory object
1, -- Create exactly 1 bus
"MIDI Stereo Bus", -- Name
ARDOUR.PresentationInfo.max_order, -- order
ARDOUR.TrackMode.Normal, -- mode
true, -- input_auto_connect
false -- trigger_visibility
)
if bus_list:empty() then
print("Error: Could not instantiate the Destination MIDI Bus.")
session:abort_reversible_command()
return
end
local target_bus = bus_list:front()
-- Force the route to function explicitly as a processing Bus
target_bus:presentation_info():set_flag(ARDOUR.PresentationInfo.Flag.IsBus)
-- Commit the action safely to the session history log
session:commit_reversible_command()
print("Success: Generated 1 Stereo Midi Bus'.")
end
end
To Create a stereo Audio Bus
ardour {
["type"] = "EditorAction",
name = "Create Stereo Audio Bus",
license = "MIT",
description = "Creates Stereo Audio Bus"
}
function factory ()
return function ()
local session = Session
-- 1. Safely initialize an empty Route Group to prevent memory crashes
local empty_group = ARDOUR.RouteGroup()
local type_audio = ARDOUR.DataType("audio")
-- Open a transaction block to maintain host stability
session:begin_reversible_command("Create Stereo Audio Bus")
-- 2. Create the Destination Audio Bus (2 Audio inputs, 2 Audio outputs for Stereo)
local bus_in_count = ARDOUR.ChanCount(type_audio, 2)
local bus_out_count = ARDOUR.ChanCount(type_audio, 2)
local bus_list = session:new_midi_track(
bus_in_count,
bus_out_count,
true, -- strict_io
ARDOUR.PluginInfo(), -- instrument plugin
nil, -- pset (PresetRecord)
empty_group, -- Pass valid group memory object
1, -- Create exactly 1 bus
"Audio Stereo Bus", -- Name
ARDOUR.PresentationInfo.max_order, -- order
ARDOUR.TrackMode.Normal, -- mode
true, -- input_auto_connect
false -- trigger_visibility
)
if bus_list:empty() then
print("Error: Could not instantiate the Destination Audio Bus.")
session:abort_reversible_command()
return
end
local target_bus = bus_list:front()
-- Force the route to function explicitly as a processing Bus
target_bus:presentation_info():set_flag(ARDOUR.PresentationInfo.Flag.IsBus)
-- Commit the action safely to the session history log
session:commit_reversible_command()
print("Success: Generated 1 Stereo Audio Bus'.")
end
end
New here. If there’s a better way or place to submit code examples, please let me know.