How to use pitch shift audio FX in script/extension?

fould12 wrote on 3/14/2017, 11:40 PM

I would like to have my extension add a 'pitch shift' audio FX to an event, and change the properties of the event to pitch shift the event audio by a certain number of semitones. I looked in the API, but I couldn't find out how to do this using an event's properties and methods. What would be the best way to do this?

Comments

jetdv wrote on 3/18/2017, 8:01 PM

You can add the effect and pick a preset.

fould12 wrote on 3/19/2017, 6:03 PM

You can add the effect and pick a preset.


Done! It took a little time to learn how to use an Effect's preset property, but I used it an it worked! Here's how I implemented it for anyone else who would like an example:

using (new UndoBlock("add plug-in"))
            {
                AudioEvent myAudio = (AudioEvent)myVegas.Project.Tracks[1].Events[0];
                PlugInNode myPlug = myVegas.AudioFX.GetChild(27); //Pitch Shift is #27
                Effect myEffect = new Effect(myPlug);
                myAudio.Effects.Add(myEffect);

                string myPresetName = "[custom]d1"; //My custom preset made in Vegas
                myEffect.Preset = myPresetName;
            }