Change Playrate and Keep event Content

macdo wrote on 3/24/2004, 7:06 AM
Im having problems when i have to change length of an event (timecode, tomilliseconds() ???)
Here`s the main idea:

event length: 4 seconds
new playrate = 0.5 (slowmotion)
new desired event_length = 8 seconds

so the line scipt may look like:
AdjustStartLength(evnt.start, evnt.length / playrate, 0)

But what happens with the ruler, how i declare envt.length to recalculate it?
What do u thin about?

Thanks

Comments

jetdv wrote on 3/24/2004, 8:49 AM
This is MUCH easier using a velocity envelope. Just add the envelope, set the first point to 50%, and double the length.

If you WANT to use the playback rate, you also have to adjust the offset to match the new starting point. However, to change the length of the clip, just set evnt.length to the new desired length (i.e. old evnt.length / new playback rate).
macdo wrote on 3/24/2004, 9:42 AM
Im trying to change it to n selected events via scrpting...

Thanks JetDv, ive been reading lot of your posts and i think u re a genius!!!!
jetdv wrote on 3/24/2004, 10:23 AM
The Velocity Envelope can also be applied to a series of events.

I've not tested this but it *might* work using your method (or at least get you closer):

var newPlaybackRate = 0.5
ClipLen = evnt.Length.ToMilliseconds();
ClipLen = ClipLen / newPlaybackRate;
evnt.Length = new Timecode(ClipLen);
NewOffset = new Timecode(evnt.ActiveTake.Offset.ToMilliseconds() * evnt.PlaybackRate);
evnt.PlaybackRate = newPlaybackRate;


Personally, I think I would opt for the velocity envelope method.
macdo wrote on 3/24/2004, 7:35 PM
JetDv, I fixed your script:
/////////////////////////////////////////////////
import System;
import System.IO;
import SonicFoundry.Vegas;
import System.Windows.Forms;
import Microsoft.Win32;

try
{
// step through all selected video events:
for (var track in Vegas.Project.Tracks) {
for (var evnt in track.Events) {
if (!evnt.Selected || evnt.MediaType != MediaType.Video) continue;

var newPlaybackRate = 0.5
var ClipLen
var NewOffset

var dStart;
dStart = evnt.Start

ClipLen = evnt.Length.ToMilliseconds();
ClipLen = ClipLen / newPlaybackRate / 1000;
evnt.PlaybackRate = newPlaybackRate;
evnt.Length = new Timecode(ClipLen);



}
}
}


catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
/////////////////////////////////////////
I think its very usefull when u have to change the playrate to many events, so now i have to solve the blank gaps, audio.. auto ripple...

Thanks!!!
MAC
jetdv wrote on 3/24/2004, 8:11 PM
Look over your events carefully, you may need to adjust the offset when working with video clips that do not start at the beginning of the clip.