Hi!
I'd like to have a script that automatically lowers volume on the background music sound track for the duration of a sound event on the narration track. How do I insert keyframes on an Audio volume envelope at given start and end on another track?
A.
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.
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.
A.
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.
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.
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.
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:
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
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.
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.
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);
env.Points.Add(point);
var foundPoint = env.Points.GetPointAtX(new Timecode(1000));
MessageBox.Show(foundPoint.Y);
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
arbitrary.
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?
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.
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.