Export envelope value, How to get envelope value without point.

Quzeray wrote on 7/10/2022, 6:41 AM

Hello,
I want to write a script that would convert velocity from vegas to time remapping after effects. To do this, I need the value of the velocity on each frame. I'm interested in what formula the graph of the velocity is transformed by, with the envelop modes fast, slow, smooth. Using this formula, I would find out what value the velocity between two points has (screenshot 1).

(screenshot 1 - What is the velocity here?)

I'm weak in math, so I thought "what if I add a velocity point myself." But here's the problem: to add a velocity point, you need to specify the value of the velocity point in the constructor.
What are your thoughts on this. Maybe you know how to define the formula, or have ideas on how to add a velocity point without value yourself. I will be glad for any help.

Comments

jetdv wrote on 7/10/2022, 7:08 AM

Yes, you can get the value at any point without there needing to be a "point" at each location. Use the "ValueAt" to get the actual value at each timecode. I'll write up a full tutorial at www.jetdv.com & my YouTube channel but this will give you the information you're looking for:
 

using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;

        public void Main(Vegas vegas)
        {
            myVegas = vegas;

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                foreach (TrackEvent evnt in myTrack.Events)
                {
                    if (evnt.Selected)
                    {
                        VideoEvent vevnt = (VideoEvent)evnt;
                        foreach (Envelope env in vevnt.Envelopes)
                        {
                            if (env.Type == EnvelopeType.Velocity)
                            {
                                for (int i = 0; i<vevnt.Length.FrameCount; i++)
                                {
                                    double envPt = env.ValueAt(Timecode.FromFrames(i));
                                    MessageBox.Show("Frame " + i + "   - " + envPt);
                                }
                            }
                        }
                    }
                }
            }

        }

    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

 

Quzeray wrote on 7/10/2022, 9:17 AM

Yes, you can get the value at any point without there needing to be a "point" at each location. Use the "ValueAt" to get the actual value at each timecode. I'll write up a full tutorial at www.jetdv.com & my YouTube channel but this will give you the information you're looking for:
 

using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;

        public void Main(Vegas vegas)
        {
            myVegas = vegas;

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                foreach (TrackEvent evnt in myTrack.Events)
                {
                    if (evnt.Selected)
                    {
                        VideoEvent vevnt = (VideoEvent)evnt;
                        foreach (Envelope env in vevnt.Envelopes)
                        {
                            if (env.Type == EnvelopeType.Velocity)
                            {
                                for (int i = 0; i<vevnt.Length.FrameCount; i++)
                                {
                                    double envPt = env.ValueAt(Timecode.FromFrames(i));
                                    MessageBox.Show("Frame " + i + "   - " + envPt);
                                }
                            }
                        }
                    }
                }
            }

        }

    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

 

Thank you so much. The decision turned out to be so simple. It is a pity that I myself did not notice this in the documentation.

Quzeray wrote on 7/10/2022, 9:19 AM

Yes, you can get the value at any point without there needing to be a "point" at each location. Use the "ValueAt" to get the actual value at each timecode. I'll write up a full tutorial at www.jetdv.com & my YouTube channel but this will give you the information you're looking for:
 

using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;

        public void Main(Vegas vegas)
        {
            myVegas = vegas;

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                foreach (TrackEvent evnt in myTrack.Events)
                {
                    if (evnt.Selected)
                    {
                        VideoEvent vevnt = (VideoEvent)evnt;
                        foreach (Envelope env in vevnt.Envelopes)
                        {
                            if (env.Type == EnvelopeType.Velocity)
                            {
                                for (int i = 0; i<vevnt.Length.FrameCount; i++)
                                {
                                    double envPt = env.ValueAt(Timecode.FromFrames(i));
                                    MessageBox.Show("Frame " + i + "   - " + envPt);
                                }
                            }
                        }
                    }
                }
            }

        }

    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

 

Oh, I know you. When I decided to start writing scripts, I found your channel and learned from them. Thanks a lot for the content.

jetdv wrote on 7/10/2022, 2:09 PM

Glad to help. I will turn this into a tutorial too.

jetdv wrote on 8/29/2022, 9:05 AM

This tutorial is now available:

Quzeray wrote on 8/29/2022, 10:16 AM

This tutorial is now available:

Cool, already watched it.