Batch Apply FX to several diff audio clips

dulcett wrote on 1/4/2006, 1:38 AM
Is there a way to create a Vegas script that will apply Non-Realtime FX to a selected batch of audio clips. This would save me a great deal of time if any body could help me out. After browsing the Vegas API I was unable to find a way. Perhaps it's not possible. Could somebody please show me otherwise. Thanks.

Comments

jetdv wrote on 1/4/2006, 6:29 AM
How about applying the FX to the track and then rendering to a new file?
johnmeyer wrote on 1/4/2006, 9:29 AM
There's always this one. Not exactly what you want, but close:
/**
* This script will add an effect to each item in the current
* project's media pool.
*
* Revision Date: Jan. 30, 2003
**/
import System.Windows.Forms;
import Sony.Vegas;


// This is the full name of the effect plug-in you want to add.
var plugInName = "Sony Timecode";

// This is the name of the preset you want. Set this to null if you
// want the default preset.
var presetName = "SMPTE Drop (29.97 fps)";

try {
var fx = Vegas.VideoFX;

var plugIn = fx.GetChildByName(plugInName);
if (null == plugIn) {
throw "could not find a plug-in named: '" + plugInName + "'";
}

var mediaEnum = new Enumerator(Vegas.Project.MediaPool);
while (!mediaEnum.atEnd()) {
var media = mediaEnum.item();
// only add the effect if the media object has a video stream.
if (media.HasVideo()) {
var effect = new Effect(plugIn);
media.Effects.Add(effect);
if (null != presetName) {
effect.Preset = presetName;
}
}
mediaEnum.moveNext();
}

} catch (e) {
MessageBox.Show(e);
}
johnmeyer wrote on 1/4/2006, 9:31 AM
Here's another script, this one I wrote. It highlights all events that contain the fX. It could be re-worked to assign an fX, I think.
/**
* This script will find and highlight all video events
* to the right of the cursor if they contain the specified fX.
*
* Written By: John Meyer
* 12-11-2003
**/

import System;
import System.Collections;
import System.Text;
import System.IO;
import System.Drawing;
import System.Windows.Forms;
import Sony.Vegas;

try {
var AllFinished = false;
// Change this line to the name of the fX you want to find.
var plugInName = "Sony Unsharp Mask";
var fx = Vegas.VideoFX;
var plugIn = fx.GetChildByName(plugInName);
if (null == plugIn) {
throw "could not find a plug-in named: '" + plugInName + "'";
}

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 evnt : TrackEvent = TrackEvent(eventEnum.item());
if ( evnt.IsVideo() ) { // Only operate on video events
while (!eventEnum.atEnd()) {
evnt = TrackEvent(eventEnum.item());
// Only operate on events to the right of the cursor.
if (evnt.Start.ToMilliseconds() > Vegas.Cursor.ToMilliseconds() ) {
var videoEvent = VideoEvent(evnt);
var i;
for (i=videoEvent.Effects.Count - 1; i >= 0; i--) { // Look through all effects for this event.
var effect = videoEvent.Effects[i];
if (effect.PlugIn.Name == plugIn.Name) {
evnt.Selected = true; // Select the event
// Vegas.Cursor = evnt.Start;
// Vegas.UpdateUI();
// AllFinished = true;
// break;
}
}
}
else {
evnt.Selected = false; // De-select the event
}
// if (AllFinished) {
// Vegas.UpdateUI();
// break;
// }
eventEnum.moveNext();
}
}
Vegas.UpdateUI();

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

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

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


dulcett wrote on 1/4/2006, 6:34 PM
All of these scripts are great but I am talking about the audio rather than the video fx.