jetdv wrote on 2/27/2003, 9:02 AM
Sounds like you would need to read all of the events on the narration track and retrieve all of the start and stop points. Once you have gathered all of the points, THEN go to the volume envelope and start adding new points based on the retrieved values. One way to find the narration track would be to give it a specific name and search for a track with that name.
AlexB wrote on 2/28/2003, 10:03 PM
How do I put a new point on an audio envelope?
rextilleon wrote on 3/1/2003, 7:42 AM
right click on the envelope and chose add point---its that easy
jetdv wrote on 3/1/2003, 8:02 AM
He means via a script!
AlexB wrote on 3/1/2003, 8:50 AM
Exactly. I have no problems with dobleclicking, I just don't like to do it 4 times for every event on the narration track. It would be of great help if I could do this automatically with a script.
ibliss wrote on 3/1/2003, 5:52 PM
Shift+left click is faster for adding points.
jetdv wrote on 3/1/2003, 9:58 PM
It appears that the correct call to add a point with the script would be:

EnvelopePoint(Timecode, Value)

Of course, I haven't figured out how to find the envelope yet!!!

SonicPJM, could finding the volume envelope on the selected track be added to the FAQ???
roger_74 wrote on 3/2/2003, 4:18 AM
I'm making a script that will add four envelopepoints and change the volume within your selection (select the whole event by doubleclicking). If all you want to do is lower the volume you can of course just use Split and change the gain, but with envelopepoints you have a little bit more control.
roger_74 wrote on 3/2/2003, 5:56 PM
I've released the script here.
AlexB wrote on 3/3/2003, 7:01 AM
Thank you, roger_74, you did a brilliant job. I have yet to try it out (no chance here at work) but a friend has tried it already and said it worked well. This will make work with audio envelopes really easy.
Thanks again! A.
Found some time and tried it on my notebook. Works perfectly like I had hoped.
:-)))))) *very happy* A.
taliesin wrote on 3/3/2003, 8:01 AM
Yes, I tested it and it works perfectly!

Thanks Roger, you helped us saving lots of time :-)

Grazie wrote on 3/3/2003, 11:10 AM
Jack - I'm getting a Error message. I've created a .jpg screen capture of the message. Is there any chance of getting it to you? I'm sure I'm doing something silly - and with one look at the Error message you'll recognise what I've done.

Thanks in advance

jetdv wrote on 3/4/2003, 8:39 AM
Back to the original question, here's a script that will add the points to the volume envelope of the music track for ALL events on the narration track. So, If you have:

Narrative: .........AAAAA........BBBBB......CCCCCC........DDDDDD......

It will lower and raise the music for each narrative section - Once for A, B, C, and D. However, if you have

Narrative: ..........AAAAAA........BBBBB.........CCCCCCCDDDDDDDD.....

You will get an error because it will try to insert a multiple point between C and D.

For the script to work, the narrative track MUST be titled "Narrative" and the background music track MUST be titled "Music".

There are four variables at the beginning which will allow you to configure how the script works.

FadeWhen - Set to ONE, it will be faded down completely by the time the narration starts and won't fade back up until the narration clip ends. Set to TWO, the fade down and up will be centered narration clip borders.

FadeMS - Number of Milliseconds for the fade to last. It is defaulted to 500 or 1/2 second.

LoudVol - The volume to fade down from and up to. Default is 0db which is numerically 1

SoftVol = The volume to fade down to and up from. Default is -12db which is numerically .25

The script can be found Here.

AlexB wrote on 3/4/2003, 6:07 PM
Hi Edward!
Thank you for your script! Luckily this was no competition, because it would be difficult to decide which script ist best. Of course yours has the advantage of handling all the events on the narration track at once, really great. Tried it out right now, immediate success.
:D A.
SonyPJM wrote on 3/5/2003, 9:14 AM
My FAQ has been updated with some topics about envelopes and using "non-standard" .NET assemblies.

jetdv wrote on 3/5/2003, 11:05 AM
In #2.3, for the function:

should the var plugIn line have nameRegExp instead of /Dissolve/??????

One rule to keep in mind that no two points can have the same position. An exception is thrown if you attempt to add a point with the same position as another.

So, is there a call I can make to determine if there is a point already at a specific time? I tried the "GetPointAtX" but could never get that to work.
SonyPJM wrote on 3/5/2003, 11:29 AM
Good catch on 2.3! The error has been corrected.

Regarding GetPointAtX, the following code fragment works for me:

var env = Vegas.Project.Tracks[0].Envelopes[0];
var point = new EnvelopePoint(new Timecode(1000), 0, CurveType.Linear);
var foundPoint = env.Points.GetPointAtX(new Timecode(1000));

So I think your problem may be that the point you are looking for may not
have EXACTLY the same X offset as you're specifying in the GetPointAtX
call... admittedly, that call has a somewhat limited use when your
script is looking for a point that was added via the GUI... the
point's X value is subject to where the point was dropped. Unless
the point was "snapped" to a grid point, the exact value is somewhat

jetdv wrote on 3/5/2003, 11:53 AM
So, can GetPointAtX be used to determine if there is already a point there? Can it be used to prevent the duplication of points by calling it before calling the add point routine?
SonyPJM wrote on 3/5/2003, 12:06 PM
Yes, I believe so. If GetPointAtX returns null, no point is at the specified position so it should be safe to add a new one there.
roger_74 wrote on 3/5/2003, 12:14 PM
Is there any way to get the Y value on an envelope at a specific time where there is no point? If you move an envelope up or down in the GUI (not clicking the points) then Vegas displays the volume and timecode. It would be useful to me in scripting.

SonyPJM wrote on 3/5/2003, 1:21 PM
I'll try to add that for the next release (4.0b).
jetdv wrote on 3/5/2003, 1:59 PM
But, don't change the functionality of GetPointAtX if it can be used to determine if a point exists. Maybe add a GetValueAtX????
SonyPJM wrote on 3/5/2003, 3:54 PM
Right... Envelope.GetValue(Timecode position) has been added... no changes to EnvelopePoints.GetPointAtX
dreamlx wrote on 3/9/2003, 2:14 AM

I have changed this script to handle multiple successive or overlapping events correctly. jetdv has now the version with my changes available for download. For download link see previous post.