Here's a script to add fade in/out to an event

JohnnyRoy wrote on 6/8/2003, 7:53 AM
I don’t know if there is a script like this out there but I couldn’t find one. I’m doing a picture montage where I have images fading in and out in different quadrants of the screen. I used track motion on 4 different tracks to set up where I want the images but then found it a pain to have to go adjust all the event edges for a 1 sec fade in and 1 sec fade out so I wrote this script to do it. I put in on a button on the toolbar and now I just drop an event on the track, press the fade-in/out button and my images have a 1 second fade on both ends. It’s a trivial script but its handy and quick for this common task. It also works for audio events.

/**
* Program: FadeEventInOut.js
* Description: This script will add a 1 second fade both ends of the current event
* Author: Johnny (Roy) Rofrano john_rofrano@hotmail.com
*
* Revision Date: June 7, 2003
**/

import SonicFoundry.Vegas;
import System.Windows.Forms;
import Microsoft.Win32;

try
{
var evnt = FindSelectedEvent();
if (evnt == null)
{
throw "Error: You must select an Event.";
}
// Change these next two values if you want a different fade time
evnt.FadeIn.Length = new Timecode(1000);
evnt.FadeOut.Length = new Timecode(1000);
}
catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}


/**
* Finds the currently selected event. Searches all tracks and returns the first
* even that is selected or null if no event is selected
* (Taken from the SonicFoundry Scripting FAQ)
*/
function FindSelectedEvent() : TrackEvent
{
var trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd())
{
var track : Track = Track(trackEnum.item());
var eventEnum = new Enumerator(track.Events);
while (!eventEnum.atEnd())
{
var evnt : TrackEvent = TrackEvent(eventEnum.item());
if (evnt.Selected)
{
return evnt;
}
eventEnum.moveNext();
}
trackEnum.moveNext();
}
return null;
}

~jr

Comments

roger_74 wrote on 6/8/2003, 11:06 AM
Here's one that works on multiple events: Multifade.
jetdv wrote on 6/8/2003, 3:12 PM
Yep, the script DOES already exist. In fact, it is part of Excalibur plus Excalibur includes three more separate scripts: Fade In/Out One second, Fade IN one second, and Fade OUT one second. The Fade In/Out version can also be found at: http://www.creativecow.net/articles/vegas_scripts.html

Additional Excalibur functionality includes fading to/from the current cursor position and/or ANY time length specified by timecode.
JohnnyRoy wrote on 6/9/2003, 7:00 AM
Roger, Thanks I downloaded it and will give it try. I guess I should have asked you first but it was late at night when I needed it so I just wrote it. ;-)

Jetdv, Thanks but I didn’t need all that other stuff. I just needed a quick fade (and at 11:pm I need it quickly).

~jr
jetdv wrote on 6/9/2003, 8:21 AM
That's the reason I gave the Creative Cow Scripting page link. There's several scripts available there - including the fade in/out.