Adding Envelopes

cpalermo wrote on 3/4/2007, 5:26 PM
I'm a newbie at Vegas scripting and trying to create a script to automate the "snapshot photo effect" that I've read about on the Vegas forum. The first step is to add a velocity envelope to the current track. Easy enough... but for some reason the below snippet is failing:

var velocityEnvelope = new Envelope(EnvelopeType.Velocity);
track.Envelopes.Add(velocityEnvelope);

It throws "Error: bad envelope type". Any ideas what I'm doing wrong?

Thanks!

Comments

jetdv wrote on 3/5/2007, 7:59 AM
Velocity envelope is an EVENT envelope - not a Track envelope. You have to add it to the specific event instead.
johnmeyer wrote on 3/5/2007, 8:08 AM
These are some code snippets from a longer script that happens to set envelope points as part of a larger process. Perhaps some of these fragments will help you get the code working.

var envEnum : Enumerator = new Enumerator(track.Envelopes);
var env : Envelope = envEnum.item();

VolEnv = new Envelope(EnvelopeType.Volume);
MusicTrack.Envelopes.Add(VolEnv);

VolEnv.Points.Add(new EnvelopePoint(evntStart - FadeTime, LoudVol));