13
0
livetrax/share/scripts/_dump_midiregion.lua

21 lines
626 B
Lua
Raw Permalink Normal View History

ardour { ["type"] = "Snippet", name = "Dump MIDI Region" }
function factory () return function ()
local sel = Editor:get_selection ()
2022-09-27 12:58:53 -04:00
local tm = Temporal.TempoMap.read ()
for r in sel.regions:regionlist ():iter () do
local mr = r:to_midiregion ()
if mr:isnil () then goto next end
print (r:name (), "Pos:", r:position (), "Start:", r:start ())
local nl = ARDOUR.LuaAPI.note_list (mr:model ())
for n in nl:iter () do
2022-09-27 12:58:53 -04:00
print (" Note @", n:time (), tm:sample_at_beats (n:time ()),
ARDOUR.ParameterDescriptor.midi_note_name (n:note ()),
"Vel:", n:velocity ())
end
print ("----")
::next::
end
end end