PitchSemis Property Exception on a Specific Audio Event

Cantersoft wrote on 5/5/2024, 6:45 PM

Vegas Version: 17

I've been scripting in Vegas Pro for about 4 years. I've encountered a bizarre scripting exception with the PitchSemis property which I have never seen before, while working with one specific audio file in Vegas Pro. This is the exception text:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
   at ScriptPortal.Vegas.IEventCOM.GetPitchSemis(UInt32 trackID, Int64 eventID, Double& value)
   at ScriptPortal.Vegas.AudioEvent.get_PitchSemis()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at ScriptPortal.Vegas.ScriptHost.ScriptManager.Run(Assembly asm, String className, String methodName)
   at ScriptPortal.Vegas.ScriptHost.RunScript(Boolean fCompileOnly)

Steps to reproduce the error:

1. Load this audio file into the zeroth track in Vegas Pro.

2. Run this code:

using ScriptPortal.Vegas;

public class EntryPoint
{
    Vegas this_application;
    public void FromVegas(Vegas vegas)
    {
        this_application = vegas;
        AudioEvent audio_event = (AudioEvent) this_application.Project.Tracks[0].Events[0];
        var pitchsemis = audio_event.PitchSemis;
    }
}

This code should assign the PitchSemis property of the zeroth audio event on the zeroth track to a variable.

The code has only raised this exception on the audio event generated from the particular audio file that I linked to (I did not upload the file directly because the forum does not support the upload of FLAC files). This leads me to believe that there is a unique property of this file that is causing an error in Vegas Pro's internal API.

To be clear, I have not tried modifying audio the file, because I am not working on a video project that uses it. I am developing a program that integrates with Vegas Pro, and I'd like my program to be robust, so I need to handle errors like these. Hoping y'all have some insight so I don't have to slap another try{}catch{} into my program! :)

Comments

zzzzzz9125 wrote on 5/6/2024, 9:05 AM

I got the expected output in 21 build 208, without making any changes to the original file:

Maybe it's a version-specific problem? I don't have another version and can't test it further.

Last changed by zzzzzz9125 on 5/6/2024, 9:08 AM, changed a total of 1 times.

Using VEGAS Pro 22 build 248 & VEGAS Pro 21 build 208.

Information about my PC:
Brand Name: HP VICTUS Laptop
System: Windows 11.0 (64-bit) 10.00.22631
CPU: 12th Gen Intel(R) Core(TM) i7-12700H
GPU: NVIDIA GeForce RTX 3050 Laptop GPU
GPU Driver: NVIDIA Studio Driver 560.70

Cantersoft wrote on 5/6/2024, 3:23 PM

Following a reboot, at first the error was not occurring at all anymore in version 17. But I added some other clips to the timeline and moved them around, then ran the code again, and the exception occurred. I added those same clips to the original Vegas instance and the error did not occur. 😱 Is this a system-specific issue, or is some internal variable in the Vegas application changing?