Audit to find completely overlapped events

johnmeyer wrote on 8/21/2006, 6:38 PM
This script will find every event on the selected track that completely overlaps another event. This is almost never what you want. You may have found, after lots of editing, that small event "slivers" are on one of your tracks, and they lie on top of another event. The smaller event takes complete precedence, which means that the video will suddenly switch to the smaller event and then back again to the longer event. If the event is really small, it is almost impossible to see by scanning the timeline with your eye, especially if you have lots of tracks.

This script will put a marker at every such event, so you can easily go to that location and move or delete the smaller event.

The one "pathological" case this doesn't check for is when one event is exactly identical in length to another event and sits directly on top of it.

[Edit] The script has been changed so it now will also find two events that are the exact same length that sit identically on top of each other -- November 13, 2006

Finally, this is a very simple script and not very elegant. It could easily be made much faster, as any programmer will instantly see, but for most people the difference in speed won't be noticeable, so I didn't bother to add the extra performance.
/**
* This script finds events that completely overlap another event on the first selected track.
*
* Written By: John H. Meyer
* Date: August 21, 2006
* Revised November 13, 2006
*
**/

import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas;


var MyMarker : Marker; // Global function used in main program and in function
var evnt : TrackEvent;
var trackEnum : Enumerator;
var i;

try {

var dirty = 0;
var track = FindSelectedTrack(); //Use this function to find the first selected track.

//Go through the list of Events
var eventEnum = new Enumerator(track.Events);
var count = track.Events.Count;

while (!eventEnum.atEnd() ) {
evnt = TrackEvent( eventEnum.item() );
var evntstart=evnt.Start.ToMilliseconds();
var evntend=evnt.End.ToMilliseconds();

for (i = 0; i < count; i++) {
var test1 = track.Events[i].Start.ToMilliseconds();
var test2 = track.Events[i].End.ToMilliseconds();
var thisevent = TrackEvent ( track.Events[i] );

// if ( (test1>=evntstart) && (test2<=evntend) && !((test1==evntstart) && (test2==evntend)) ) {
if ( (test1>=evntstart) && (test2<=evntend) && !(thisevent==evnt) ) {
if (!MarkerExist(test1) ) {
MyMarker = new Marker(track.Events[i].Start);
Vegas.Project.Markers.Add(MyMarker);
MyMarker.Label = "****Overlapped event";
}
dirty = 1;
}
}
eventEnum.moveNext();

} // End While eventEnum

if (dirty == 1) {
Vegas.UpdateUI();
MessageBox.Show("Overlaped events were found!","Completed",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
else {
MessageBox.Show("No overlaped events.","Completed",MessageBoxButtons.OK,MessageBoxIcon.Information);
}

} catch (e) {
MessageBox.Show(e);
}


function FindSelectedTrack() : Track {
trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());

if (track.Selected) {
return track;
}
trackEnum.moveNext();
}
return null;
}


function MarkerExist (dStart) : boolean {

var markerEnum = new Enumerator(Vegas.Project.Markers);

while (!markerEnum.atEnd()) {
MyMarker = markerEnum.item(); // MyMarker is a global function in this project
var MarkerStart = MyMarker.Position.ToMilliseconds();

if ( dStart == MarkerStart ) {
return 1;
}

markerEnum.moveNext();

} // End while markerEnum

return 0;
}


Comments

ForumAdmin wrote on 8/22/2006, 6:33 PM
Nice script JM.

re Punch-in events and this statement:

"This is almost never what you want."

Unless this IS what you want.

We can agree that having punch-in events in places you don't want them is bad (and if they are created accidently via splits or other editing processes, that's a problem worth solving, so good on ya), but there are editing scenarios where punch-ins are very valuable, critical even, to pros... or even the casual user who cares about sound (which hopefully is every Vegas user!).

Here's a key punch-in scenario that makes this feature very worthwhile: Voice punched into room tone.

Even in the quietest recording room with a very high end signal chain, there is still some coloration to "silence" (room tone, nobody talking/singing/playing). If you a record commercial grade vocal track (music or narration), and slice that up to time out properly, you'll often if not always get a smoother sounding track with room tone in between the voice takes.

Punch-in events let you drop all of the voice takes into a single long (or spliced together) room tone event, avoiding the time-consuming and often impossible task of having to slice up and crossfade room tone between voice takes.

Try this next time you need to record some quality VO- make sure you get 30 or 60 secs at least of "clean" room tone. Hard to get people to stay still but having half a minute of good room tone is very much worth the effort when a quality soundtrack counts (which is...always).


johnmeyer wrote on 8/22/2006, 10:35 PM
Try this next time you need to record some quality VO- make sure you get 30 or 60 secs at least of "clean" room tone.

I do this all the time, but I've always done it by putting the background sound on another track because I found it difficult to keep track of the overlapped events when they are the same track. They are difficult to see. Is there any advantage to having them on the same track?

Oh, I guess I can answer my own question, in that any effects you put on that track will affect everything the same way. Having said that, I think you could ensure that same outcome by routing the audio from both tracks through a bus.

Anyway, thanks for the response. I did this script mostly for myself. Judging by the response (total lack thereof) I guess I was solving a problem that was pretty unique to me.

MarkWWWW wrote on 8/23/2006, 6:04 AM
Well, I for one appreciate the fact that you make these scripts available to others - many thanks for doing so and I hope you will continue to do so.

Although I don't believe I have ever suffered from this problem myself I can certainly recall discussions in the past about problems people had been experiencing which certainly sounded like they were caused by tiny slivers of events being left over after some (perhaps slightly inaccurate) editing processes. This could indeed be tricky to spot and it would certainly be helpful to have a script like this available to check for this problem.

Many thanks again.

Mark
ForumAdmin wrote on 8/23/2006, 7:12 AM
"Is there any advantage to having them on the same track? "

Yes- you don't double up on room tone. There will be some room tone within the voice events, so having room tone on a separate track (regardless of routing) will sound different than punching voice events into room tone.

Also, we changed a/v event pair right edge behaviors in Vegas 6 so that a/v from the same file should always be precisely the same length. This one change should go a long way toward eliminating split-induced slivers.
ECB wrote on 9/22/2006, 10:39 AM
"Yes- you don't double up on room tone. There will be some room tone within the voice events, so having room tone on a separate track (regardless of routing) will sound different than punching voice events into room tone."

Many thanks! You just saved me many hours of work! :)

Ed B
MRe wrote on 11/13/2006, 10:03 AM
"The one "pathological" case this doesn't check for is when one event is exactly identical in length to another event and sits directly on top of it."

John, would it be easy to change the script so that it would also find events which are exactly of the same length?

I do most of my editing with 5.1 surround setting and I have reserved two tracks for dialog, where 1'st track contains only center channel and the other is reserved for L/R. Now, when I insert an event and drag and drop (using SHIFT + mouse left) to make copy of the audio event, if I at the same time forget to enable "ignore event grouping" I end up with two copies of the same video event with the same length. When later on I edit the event, it may lead to strange things.

The problem is that events are exactly the same length (and with the same name).
MRe wrote on 11/14/2006, 2:48 AM
Thank you John! It works fine.

And the script is now very easy to revert to original (by switching the commented line).
CClub wrote on 11/21/2006, 7:05 PM
This script is exactly what I need, as sometimes I leave those "slivers." But when I copy these scripts and try to paste them, for some reason I'm copying them wrong, as they just give me errors. Anyway I can get a link to this script as a completed file?
MRe wrote on 11/21/2006, 10:44 PM
Just copy the script (i.e. highlight all the text from first "/**" to last "}" and copy it to clipboard "ctrl-c"). And then paste it to Word or Wordpad (notepad did lose CR's from the text and all the text was as single line).

Then save the file to Vegas script-folder with any name you like (e.g. AuditForCompletelyOverlappedEvents.js) WITH .js -extension. Not .txt, not .doc. Check that the name has only .js extension by opening the folder you saved the script in. And it should also have a "parchment" icon representing it.

Open up Vegas, go to Tools-Scripts and select "rescan script folder". The script should be there.
CClub wrote on 11/22/2006, 4:54 AM
John, Thanks so much for the script. I'm not sure how people missed how useful this one is, but one of the pro software script programs should add this one. Nothing worse than rendering a full project and then seeing/hearing a 1/2 second blip where you had overlapped events.

MRe: Thanks for the instructions regarding how to copy the text. I'll be experimenting with that this week so I can save them myself in the future.