-
Scripting: automatic audio ducking
Posted by Arturas Bojarunas on June 15, 2015 at 6:12 amhello every one
several years ago i used a script which did audio ducking automatically for me. all i had to do is to rename audio tracks to “voice” and “music” and run the script. now i can’t find it anymore.. all that i found is vegasaur project and similar expensive stuff.it was a pretty simple script just for free.
any advice please, where to find it?..p.s. still using vegas pro 10 at work.
Arturas Bojarunas
PenkiTV(IPTV)
Vilnius, LithuaniaArturas Bojarunas replied 11 years, 1 month ago 4 Members · 4 Replies -
4 Replies
-
Graham Bernard
June 15, 2015 at 8:27 am[Arturas Bojarunas] “now i can’t find it anymore.. all that i found is vegasaur project and similar expensive stuff.”
If you still can’t find the Freebie, can you afford $9.95? Here’s VASST’s Voice Assistant
Grazie
Video Content Creator and Potter
PC 7 64-bit 16gb * Intel® Core™i7-2600k Quad Core 3.40GHz * 2GB NVIDIA GEFORCE GTX 560 Ti
Cameras: Canon XF300 + PowerShot SX50HS Bridge -
Wayne Waag
June 20, 2015 at 10:51 pmI think this is what you are looking for. Name of the script is Adjustvolume.js
/**
* This script will reduce the volume on a music track whenever there are clips
* on a narrative track.
* Written By: Edward Troxel - Vegas Tips, Tricks, & Scripts
* Modified By: David Arendt - multiple successive tracks now working
**/import System;
import System.IO;
import System.Object;
import System.Windows.Forms;
import Sony.Vegas;try {
// Set the defaults
var FadeWhen = 2; // 1 = all before/after, 2 = Centered on start/end
var FadeMS : Double = 2000; //500 = 1/2 second - Time is MilliSeconds
var LoudVol = 1; //1 = 0db, 2 = 6db, 1.5 = 3.5db, 1.75 = 4.8db
var SoftVol = 0.25; //0 = -inf, .5 = -6db, .25 = -12dbif (FadeWhen == 2) {
FadeMS = FadeMS / 2;
}var FadeTime = new Timecode(FadeMS);
// Find the two audio tracks by name
var VoiceTrack = FindTrack("Narrative");
if (null == VoiceTrack)
throw "no selected track";var MusicTrack = FindTrack("Music");
if (null == MusicTrack)
throw "no selected track";// Find the volume envelope on the music track - add if needed
var VolEnv = FindEnvelope(MusicTrack, EnvelopeType.Volume);
if (null == VolEnv) {
VolEnv = new Envelope(EnvelopeType.Volume);
MusicTrack.Envelopes.Add(VolEnv);
}// Go thru the events on the narrative track finding in/out points
var eventEnum = new Enumerator(VoiceTrack.Events);
while (!eventEnum.atEnd()) {
var evnt : TrackEvent = TrackEvent(eventEnum.item());
var evntStart : Timecode = evnt.Start;
var evntLen : Timecode = evnt.Length;// begin modification by David Arendt
eventEnum.moveNext();
var nextEvnt : TrackEvent;
var nextEvntStart : Timecode;
var nextEvntLen : Timecode;
while (!eventEnum.atEnd())
{
nextEvnt = TrackEvent(eventEnum.item());
nextEvntStart = nextEvnt.Start;
nextEvntLen = nextEvnt.Length;
if (nextEvntStart > evntStart + evntLen + FadeTime + FadeTime)
break;
evntLen = nextEvntStart - evntStart + nextEvntLen;
eventEnum.moveNext();
}
// end modification by David ArendtVolEnv.Points.Add(new EnvelopePoint(evntStart - FadeTime, LoudVol));
if (FadeWhen == 2) {
VolEnv.Points.Add(new EnvelopePoint(evntStart + FadeTime, SoftVol));
} else {
VolEnv.Points.Add(new EnvelopePoint(evntStart, SoftVol));
}if (FadeWhen == 2) {
VolEnv.Points.Add(new EnvelopePoint(evntStart + evntLen - FadeTime, SoftVol));
} else {
VolEnv.Points.Add(new EnvelopePoint(evntStart + evntLen, SoftVol));
}
VolEnv.Points.Add(new EnvelopePoint(evntStart + evntLen + FadeTime, LoudVol));}
} catch (e) {
MessageBox.Show(e);
}function FindTrack(WhichTrack) : Track {
var trackEnum = new Enumerator(Vegas.Project.Tracks);
var PrevTrack : Track = Track(trackEnum.item());
while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());
if (WhichTrack == "Current") {
if (track.Selected) {
return track;
}
}
if (WhichTrack == "Previous") {
if (track.Selected) {
return PrevTrack;
}
}
if (track.Name == WhichTrack) {
return track;
}
trackEnum.moveNext();
}
return null;
}function FindEnvelope(track : Track, etype : EnvelopeType) : Envelope {
var envEnum : Enumerator = new Enumerator(track.Envelopes);
while (!envEnum.atEnd()) {
var env : Envelope = envEnum.item();
if (env.Type == etype) {
return env;
}
envEnum.moveNext();
}
return null;
}Have not tried it, so I don’t know if it works. Just copy and save it with Notepad with a .js extension. Good luck.
wwaag
-
Arturas Bojarunas
June 23, 2015 at 4:50 amthank you very much Wayne, this is exactly what i am looking for! i remember start of this script with it configuration.
Edward, how can i see, this is your original script. and only it working for me. i am tried excalibur, but it’s not working on my version of vegas pro 10.0e (build 738, 64-bit). os is windows 8.1 enterprise 64-bit.
thank you Graham.
Arturas Bojarunas
PenkiTV(IPTV)
Vilnius, Lithuania
Reply to this Discussion! Login or Sign Up
