reaper.Undo_BeginBlock()
local hwnd = reaper.MIDIEditor_GetActive()
local take = reaper.MIDIEditor_GetTake(hwnd)
if reaper.ValidatePtr(take,'MediaItem_Take*') then
local track = reaper.GetMediaItemTake_Track(take)
for i = 0, 127 do
reaper.SetTrackMIDINoteNameEx(0, track, i, -1, '')
end
end
reaper.Undo_EndBlock('Set empty note names', -1)