1 ardour { ["type"] = "Snippet", name = "Dump MIDI Region" }
3 function factory () return function ()
4 local sel = Editor:get_selection ()
5 for r in sel.regions:regionlist ():iter () do
6 local mr = r:to_midiregion ()
7 if mr:isnil () then goto next end
9 print (r:name (), "Pos:", r:position (), "Start:", r:start ())
10 local bfc = ARDOUR.BeatsFramesConverter (Session:tempo_map (), r:position ())
11 local nl = ARDOUR.LuaAPI.note_list (mr:model ())
12 for n in nl:iter () do
13 print (" Note @", bfc:to (n:time ()),
14 ARDOUR.ParameterDescriptor.midi_note_name (n:note ()),
15 "Vel:", n:velocity ())