Thank you.
I thought about trying to do something this, but seemed like so much work (and might not
even work :P). I was also going to try to tackle this issue with overlapping notes:
http://forum.cockos.com/showthread.php?t=159532 Note off of note 1 cuts note 2 short. What do you think about that? Figured I'd have to put them in a list, sort it, trim notes that were too long("correcting them"), then put them in a new item. I was going to delete muted notes that land under unmuted notes, but after running your script, it seems like muted/nonmuted can exist together outside MIDI editor. But two mutes that land on top of each other suffer the same fate as two nonmutes. I see you are doing something like (Python)list already for mutes. (Lua noob)
Well, if not then these will be great on their own as is.