"Audit" Script

johnmeyer wrote on 11/10/2003, 3:22 PM
I am sick and tired of finding out that I accidentally "nudged" an event opacity or volume level. Usually the amount is so slight, I don't notice it, but it forces re-rendering, and of course will cause unintentional degredation to the final result.

This script works best if you zoom all the way out so you can see the entire timeline.


/**
* This script finds all events where the opacity level has been
* set to a level only slightly less than 100%, or the audio level
* set to slightly less than 0dB. This usually is not intentional
* and results from accidentally moving the opacity or volume
* line while moving an event. Without this script, such
* an accident is very difficult to detect, and can result in
* long rendering times.
*
* Written By: John H. Meyer
* Date: November 11, 2003
* Modied November 23, 2003
*
**/

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

// Change this line if you want a different threshold
var Opacity = 0.90;
var EventLevel = 0.50;

var OpacityMessage : String;
var TrackUnits : String;

try {

//Go through the list of Tracks
var trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());


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

while (!eventEnum.atEnd()) {
var evnt : TrackEvent = TrackEvent(eventEnum.item());
evnt.Selected = false; // De-select events in order to make problem events stand out
// (Problem events WILL be selected)

// If gain is less than 100% (or 0dB), but greater than the threshhold ...
if ( (evnt.FadeIn.Gain > Opacity) && (evnt.FadeIn.Gain < 1) ) {

// Highlight the "suspect" event
Vegas.SelectionStart = evnt.Start;
Vegas.SelectionLength = evnt.Length;
Vegas.Cursor = evnt.Start;
evnt.Selected = true;
Vegas.UpdateUI();

// Create error message to display in message box.
if (track.IsVideo()) {
TrackUnits = "100%";
EventLevel = 100 * evnt.FadeIn.Gain;
OpacityMessage = "This event is set to: " + EventLevel.toPrecision(2);
OpacityMessage = OpacityMessage + "%. Do you want to set to " + TrackUnits + "?";
}
else {
TrackUnits = "0dB";
EventLevel = 20 * Math.log (evnt.FadeIn.Gain);
OpacityMessage = "This event is set to: " + EventLevel.toPrecision(2);
OpacityMessage = OpacityMessage + "dB. Do you want to set to " + TrackUnits + "?";
}


var msgBoxResult = MessageBox.Show(OpacityMessage, "Region Selected", MessageBoxButtons.YesNo);
if (msgBoxResult == DialogResult.Yes) {
evnt.FadeIn.Gain = 1; // Correct the problem
}

}

evnt.Selected = false; // Clear all event selections
eventEnum.moveNext();

} // End While eventEnum

trackEnum.moveNext();

} // End While trackEnum
MessageBox.Show("Don't forget to check all track header levels.","Completed",MessageBoxButtons.OK,MessageBoxIcon.Information);

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


Comments

Grazie wrote on 11/11/2003, 2:20 AM
Thanks JM - Messy editor here! - This going in the Tool Box too . . . I think you may have openned up a veritable warehouse of "fixing-scripts" . . . . . . Hey that's an idea! An Ambulance Icon one could click on to get stuff back to where it should be - yeah?

Thanks for your time on this one - excellent!

Grazie
johnmeyer wrote on 11/11/2003, 9:24 AM
Grazie,

Glad you like it. I'm also thinking of doing one that would look for those annoying 1-2 frame gaps you sometimes get between events (or 1-2 frame overlaps). I don't want to do anything to step on Excalibur, but I think capabilities there are designed to create effects, not remove mistakes.