Fixing Script: Deleting Video and Audio Parts Together

andy-0 wrote on 10/7/2023, 7:49 PM

Hello, I'm trying to create a script that deletes both video and audio parts equally. However, even though I've attempted to use the lines of code from another script that has the same function, it doesn't seem to work and doesn't delete the video parts along with the audio. Any ideas on how to correct this?
 

using System;
using System.Windows.Forms;
using System.IO;
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Formulario : Form
    {
        private Label labelSignalBelow;
        private TextBox textBoxSignalBelow;
        private Label labelMinDuration;
        private TextBox textBoxMinDuration;
        private Label labelMinDistance;
        private TextBox textBoxMinDistance;
        private Button buttonOK;
        private Button buttonCancel;
        private bool formularioFechado = false;
        private Vegas myVegas;
        private string tempFilePath; 

        public Formulario(Vegas vegas)
        {
            myVegas = vegas;

            Text = "Remoção de áreas silenciosas";
            Size = new System.Drawing.Size(400, 175);
            FormBorderStyle = FormBorderStyle.FixedDialog;
            StartPosition = FormStartPosition.CenterScreen; 

            textBoxSignalBelow = CriarTextBox("-3381"); // Alteração aqui para -3381 dB
            textBoxSignalBelow.Location = new System.Drawing.Point(10, 30);

            labelSignalBelow = new Label();
            labelSignalBelow.Text = "Sinal abaixo de (dB):";
            labelSignalBelow.AutoSize = true;
            labelSignalBelow.Location = new System.Drawing.Point(textBoxSignalBelow.Left, textBoxSignalBelow.Top - labelSignalBelow.Height);

            textBoxMinDuration = CriarTextBox("00:00:00.500");
            textBoxMinDuration.Location = new System.Drawing.Point(labelSignalBelow.Right + 20, 30);

            labelMinDuration = new Label();
            labelMinDuration.Text = "Min Duration:";
            labelMinDuration.AutoSize = true;
            labelMinDuration.Location = new System.Drawing.Point(textBoxMinDuration.Left, textBoxMinDuration.Top - labelMinDuration.Height);

            textBoxMinDistance = CriarTextBox("00:00:00.100");
            textBoxMinDistance.Location = new System.Drawing.Point(labelMinDuration.Right + 20, 30);

            labelMinDistance = new Label();
            labelMinDistance.Text = "Min Distance:";
            labelMinDistance.AutoSize = true;
            labelMinDistance.Location = new System.Drawing.Point(textBoxMinDistance.Left, textBoxMinDistance.Top - labelMinDistance.Height);

            buttonOK = new Button();
            buttonOK.Text = "OK";
            buttonOK.Location = new System.Drawing.Point(10, ClientSize.Height - buttonOK.Height - 10);

            buttonCancel = new Button();
            buttonCancel.Text = "Cancelar";
            buttonCancel.Location = new System.Drawing.Point(buttonOK.Right + 10, ClientSize.Height - buttonCancel.Height - 10);

            buttonCancel.Click += (sender, e) =>
            {
                formularioFechado = true;
                Close();
            };

            buttonOK.Click += (sender, e) =>
            {
                formularioFechado = false;
                ExecuteSilentAreaRemovalScript();
                Close();
            };

            ControlBox = false;
            MinimizeBox = false;
            MaximizeBox = false;
            FormBorderStyle = FormBorderStyle.FixedDialog;

            Controls.Add(labelSignalBelow);
            Controls.Add(textBoxSignalBelow);
            Controls.Add(labelMinDuration);
            Controls.Add(textBoxMinDuration);
            Controls.Add(labelMinDistance);
            Controls.Add(textBoxMinDistance);
            Controls.Add(buttonOK);
            Controls.Add(buttonCancel);
        }

        private TextBox CriarTextBox(string defaultValue)
        {
            TextBox textBox = new TextBox();
            textBox.Text = defaultValue;
            textBox.Size = new System.Drawing.Size(100, 20);
            return textBox;
        }

        private void ExecuteSilentAreaRemovalScript()
        {
            double signalBelowDB = Convert.ToDouble(textBoxSignalBelow.Text);
            string minDurationStr = textBoxMinDuration.Text;
            string minDistanceStr = textBoxMinDistance.Text;

            if (string.IsNullOrWhiteSpace(minDurationStr) || string.IsNullOrWhiteSpace(minDistanceStr))
            {
                MessageBox.Show("Valores inválidos ou nenhum valor fornecido. O script será encerrado.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            Timecode minDuration = Timecode.FromString(minDurationStr);
            Timecode minDistance = Timecode.FromString(minDistanceStr);

            Class1 script = new Class1();
            script.Main(myVegas, signalBelowDB, minDuration, minDistance, tempFilePath);
        }

        public Tuple<string, string, string> GetSignalMinDurationDistance()
        {
            ShowDialog();
            return Tuple.Create(textBoxSignalBelow.Text, textBoxMinDuration.Text, textBoxMinDistance.Text);
        }

        public void SetTempFilePath(string path)
        {
            tempFilePath = path;
        }
    }

    public class Class1
    {
        public Vegas myVegas;
        Renderer myRenderer = null;
        RenderTemplate rndrTemplate = null;
        double QuietLimit = -3381; // Alteração aqui para -3381 dB
        Timecode logOffset = Timecode.FromFrames(15);
        Timecode minDuration = Timecode.FromMilliseconds(500);
        Timecode minDistance = Timecode.FromMilliseconds(100);

        public void Main(Vegas vegas, double signalBelowDB, Timecode minDuration, Timecode minDistance, string tempFilePath)
        {
            myVegas = vegas;

            FindRenderers();

            string tempLog = myVegas.TemporaryFilesPath + Path.DirectorySeparatorChar + "temp_loud.txt";

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsAudio())
                {
                    myTrack.Mute = false;

                    ProcessLog(tempLog, myTrack, signalBelowDB);

                    myTrack.Mute = true;
                }
            }
        }

        public void FindRenderers()
        {
            try
            {
                foreach (Renderer renderer in myVegas.Renderers)
                {
                    if ("adfa6a4b-a99b-42e3-ae1f-081123ada04b" == renderer.ClassID.ToString())
                    {
                        myRenderer = renderer;

                        try
                        {
                            foreach (RenderTemplate renderTemplate in renderer.Templates)
                            {
                                if (renderTemplate.IsValid())
                                {
                                    if ("8ab64a16-81f5-46e6-8155-1611d592088c" == renderTemplate.TemplateGuid.ToString())
                                    {
                                        rndrTemplate = renderTemplate;
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            catch
            {
            }
        }

        public void ProcessLog(string path, Track myTrack, double signalBelowDB)
        {
            var lines = File.ReadLines(path);

            bool foundfirst = false;
            bool FoundQuiet = false;
            Timecode QuietStart = Timecode.FromFrames(0);
            Timecode QuietEnd = Timecode.FromFrames(0);
            Timecode PreviousTC = Timecode.FromFrames(0);

            foreach (string line in lines)
            {
                if (line.StartsWith("------------"))
                {
                    if (FoundQuiet)
                    {
                        QuietEnd = PreviousTC;
                        ProcessSegment(QuietStart, QuietEnd, myTrack, signalBelowDB);
                    }
                    break;
                }
                if (line.StartsWith("              Pos."))
                {
                    foundfirst = true;
                }
                else
                {
                    if (foundfirst)
                    {
                        if (line.Length > 5)
                        {
                            string[] pieces = line.Split('\t');
                            Timecode trackTime = Timecode.FromString(pieces[1]);
                            double trackVolume = 0;
                            if (pieces[2].Contains("Inf"))
                            {
                                trackVolume = -100;
                            }
                            else
                            {
                                trackVolume = Convert.ToDouble(pieces[2]);
                            }

                            if (trackVolume < signalBelowDB)
                            {
                                if (!FoundQuiet)
                                {
                                    FoundQuiet = true;
                                    QuietStart = trackTime;
                                }
                                else
                                {
                                    QuietEnd = trackTime;
                                }
                            }
                            else
                            {
                                if (FoundQuiet)
                                {
                                    FoundQuiet = false;
                                    ProcessSegment(QuietStart, QuietEnd, myTrack, signalBelowDB);
                                }
                            }
                            PreviousTC = trackTime;
                        }
                    }
                }
            }
        }

        private void ProcessSegment(Timecode QuietStart, Timecode QuietEnd, Track audioTrack, double signalBelowDB)
        {
            Timecode startTC = QuietStart - logOffset;
            if (startTC < Timecode.FromFrames(0))
            {
                startTC = Timecode.FromFrames(0);
            }

            Timecode endTC = QuietEnd - logOffset;
            Timecode regionLen = endTC - startTC;

            if (regionLen > minDuration)
            {
                foreach (TrackEvent evnt in audioTrack.Events)
                {
                    if (evnt.Start < startTC && evnt.End > startTC)
                    {
                        evnt.Split(startTC - evnt.Start);
                    }
                    if (evnt.Start < endTC && evnt.End > endTC)
                    {
                        evnt.Split(endTC - evnt.Start);
                    }
                }
                for (int i = audioTrack.Events.Count - 1; i >= 0; i--)
                {
                    TrackEvent evnt = audioTrack.Events[i];
                    if (evnt.Start >= startTC && evnt.End <= endTC)
                    {
                        audioTrack.Events.Remove(evnt);
                    }
                }
            }
            else if (regionLen < minDistance)
            {
                // Implement logic for merging here if needed
            }
        }
    }

    public class EntryPoint
    {
        private Vegas myVegas;

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

            string tempFilePath = myVegas.TemporaryFilesPath + Path.DirectorySeparatorChar + Guid.NewGuid().ToString("N") + ".mp3";

            Formulario formulario = new Formulario(myVegas);
            formulario.SetTempFilePath(tempFilePath);

            var values = formulario.GetSignalMinDurationDistance();

            string signalBelowDB = values.Item1;
            string minDuration = values.Item2;
            string minDistance = values.Item3;

            if (string.IsNullOrWhiteSpace(signalBelowDB) || string.IsNullOrWhiteSpace(minDuration) || string.IsNullOrWhiteSpace(minDistance))
            {
                MessageBox.Show("Valores inválidos ou nenhum valor fornecido. O script será encerrado.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            double signalDB = Convert.ToDouble(signalBelowDB);
            Timecode minDur = Timecode.FromString(minDuration);
            Timecode minDist = Timecode.FromString(minDistance);

            Class1 script = new Class1();
            script.Main(myVegas, signalDB, minDur, minDist, tempFilePath);
        }
    }
}


Hello, I'm trying to create a script that deletes both video and audio parts equally. However, even though I've attempted to use the lines of code from another script that has the same function, it doesn't seem to work and doesn't delete the video parts along with the audio. Any ideas on how to correct this?

Comments

jetdv wrote on 10/8/2023, 4:33 PM

Ok, I've gone back to my original code which I know works (you left a LOT of the code out of the above - such as the rendering routine which gets us the file to process). I added in your form using the form designer so the code is now correct for the form as well. Then I added in to process the "line above the audio track" as I mentioned in the other post where you were asking about this. It was honestly easier to start over, re-design the form, and pull my working code in that trying to fix what you listed above and this version is much cleaner.

This version does not use your textBoxMinDistance value but it appears that was something you were going to add later anyway as it's not used in the code above either.

Anyway, here's my starting screen before running this version:

and after running this version:


 

using System;
using System.IO;
using System.Windows.Forms;
using ScriptPortal.Vegas;

namespace Test_Script_With_Form
{
    public partial class Form1 : Form
    {
        public Vegas myVegas;
        public Track vidTrack = null;
        public Renderer myRenderer = null;
        public RenderTemplate rndrTemplate = null;
        public double QuietLimit = -40.0;
        public Timecode logOffset = Timecode.FromFrames(10);
        public Timecode minLength = Timecode.FromSeconds(1.5);

        public Form1(Vegas vegas)
        {
            myVegas = vegas;
            InitializeComponent();
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            QuietLimit = Convert.ToDouble(textBoxSignalBelow.Text);
            minLength = Timecode.FromString(textBoxMinDuration.Text);

            FindRenderers();

            string tempFile = myVegas.TemporaryFilesPath + "temp.mp3";
            string tempLog = myVegas.TemporaryFilesPath + "temp_loud.txt";

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsAudio())// removing the selected requirement && myTrack.Selected)
                {
                    myTrack.Mute = false;

                    RenderTempFile(tempFile);
                    //assume the video track is the track above the audio track
                    vidTrack = myVegas.Project.Tracks[myTrack.Index - 1];
                    ProcessLog(tempLog, myTrack);
                    ProcessLog(tempLog, vidTrack);

                    File.Delete(tempFile);
                    File.Delete(tempLog);

                    myTrack.Mute = true;
                }
            }

            Close();
        }

        public void ProcessLog(string path, Track myTrack)
        {
            var lines = File.ReadLines(path);

            bool foundfirst = false;
            bool FoundQuiet = false;
            Timecode QuietStart = Timecode.FromFrames(0);
            Timecode QuietEnd = Timecode.FromFrames(0);
            Timecode PreviousTC = Timecode.FromFrames(0);

            foreach (string line in lines)
            {
                if (line.StartsWith("------------"))
                {
                    if (FoundQuiet)
                    {
                        QuietEnd = PreviousTC;
                        ProcessSegment(QuietStart, myVegas.Project.Length + logOffset, myTrack);
                    }
                    break;
                }
                if (line.StartsWith("              Pos."))
                {
                    foundfirst = true;
                }
                else
                {
                    if (foundfirst)
                    {
                        if (line.Length > 5)
                        {
                            string[] pieces = line.Split('\t');
                            Timecode trackTime = Timecode.FromString(pieces[1]);
                            double trackVolume = 0;
                            if (pieces[2].Contains("Inf"))
                            {
                                trackVolume = -100;
                            }
                            else
                            {
                                trackVolume = Convert.ToDouble(pieces[2]);
                            }

                            if (trackVolume < QuietLimit)
                            {
                                if (!FoundQuiet)
                                {
                                    FoundQuiet = true;
                                    QuietStart = trackTime;
                                }
                            }
                            else
                            {
                                if (FoundQuiet)
                                {
                                    FoundQuiet = false;
                                    QuietEnd = PreviousTC;

                                    ProcessSegment(QuietStart, QuietEnd, myTrack);
                                }
                            }
                            PreviousTC = trackTime;
                        }
                    }
                }
            }
        }

        private void ProcessSegment(Timecode QuietStart, Timecode QuietEnd, Track myTrack)
        {
            Timecode startTC = QuietStart - logOffset;
            if (startTC < Timecode.FromFrames(0))
            {
                startTC = Timecode.FromFrames(0);
            }

            Timecode endTC = QuietEnd - logOffset;
            Timecode regionLen = endTC - startTC;

            if (regionLen > minLength)
            {
                foreach (TrackEvent evnt in myTrack.Events)
                {
                    if (evnt.Start < startTC && evnt.End > startTC)
                    {
                        evnt.Split(startTC - evnt.Start);
                    }
                    if (evnt.Start < endTC && evnt.End > endTC)
                    {
                        evnt.Split(endTC - evnt.Start);
                    }
                }
                for (int i = myTrack.Events.Count - 1; i >= 0; i--)
                {
                    TrackEvent evnt = myTrack.Events[i];
                    if (evnt.Start >= startTC && evnt.End <= endTC)
                    {
                        myTrack.Events.Remove(evnt);
                    }
                }
            }
        }


        private void buttonCancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        public void RenderTempFile(string tempFile)
        {
            RenderArgs args = new RenderArgs();
            args.OutputFile = tempFile;
            args.RenderTemplate = rndrTemplate;
            args.Start = Timecode.FromFrames(0);
            args.Length = myVegas.Project.Length;
            args.IncludeMarkers = false;
            args.StretchToFill = false;
            args.GenerateLoudnessLog = true;

            RenderStatus status = myVegas.Render(args);
        }


        public void FindRenderers()
        {
            try
            {
                foreach (Renderer renderer in myVegas.Renderers)
                {
                    //MP3
                    if ("adfa6a4b-a99b-42e3-ae1f-081123ada04b" == renderer.ClassID.ToString())
                    {
                        myRenderer = renderer;

                        try
                        {
                            foreach (RenderTemplate renderTemplate in renderer.Templates)
                            {
                                if (renderTemplate.IsValid())
                                {
                                    //192 Kbps, CD Transparent Audio
                                    if ("8ab64a16-81f5-46e6-8155-1611d592088c" == renderTemplate.TemplateGuid.ToString())
                                    {
                                        rndrTemplate = renderTemplate;
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            catch
            {
            }
        }


        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.buttonOK = new System.Windows.Forms.Button();
            this.buttonCancel = new System.Windows.Forms.Button();
            this.textBoxSignalBelow = new System.Windows.Forms.TextBox();
            this.textBoxMinDuration = new System.Windows.Forms.TextBox();
            this.textBoxMinDistance = new System.Windows.Forms.TextBox();
            this.labelSignalBelow = new System.Windows.Forms.Label();
            this.labelMinDuration = new System.Windows.Forms.Label();
            this.labelMinDistance = new System.Windows.Forms.Label();
            this.SuspendLayout();
            //
            // buttonOK
            //
            this.buttonOK.Location = new System.Drawing.Point(73, 77);
            this.buttonOK.Margin = new System.Windows.Forms.Padding(2);
            this.buttonOK.Name = "buttonOK";
            this.buttonOK.Size = new System.Drawing.Size(75, 23);
            this.buttonOK.TabIndex = 2;
            this.buttonOK.Text = "OK";
            this.buttonOK.UseVisualStyleBackColor = true;
            this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
            //
            // buttonCancel
            //
            this.buttonCancel.Location = new System.Drawing.Point(217, 77);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(75, 23);
            this.buttonCancel.TabIndex = 3;
            this.buttonCancel.Text = "Cancelar";
            this.buttonCancel.UseVisualStyleBackColor = true;
            this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
            //
            // textBoxSignalBelow
            //
            this.textBoxSignalBelow.Location = new System.Drawing.Point(10, 30);
            this.textBoxSignalBelow.Name = "textBoxSignalBelow";
            this.textBoxSignalBelow.Size = new System.Drawing.Size(100, 20);
            this.textBoxSignalBelow.TabIndex = 4;
            this.textBoxSignalBelow.Text = "-33.81";
            //
            // textBoxMinDuration
            //
            this.textBoxMinDuration.Location = new System.Drawing.Point(135, 33);
            this.textBoxMinDuration.Name = "textBoxMinDuration";
            this.textBoxMinDuration.Size = new System.Drawing.Size(100, 20);
            this.textBoxMinDuration.TabIndex = 5;
            this.textBoxMinDuration.Text = "00:00:00.500";
            //
            // textBoxMinDistance
            //
            this.textBoxMinDistance.Location = new System.Drawing.Point(250, 33);
            this.textBoxMinDistance.Name = "textBoxMinDistance";
            this.textBoxMinDistance.Size = new System.Drawing.Size(100, 20);
            this.textBoxMinDistance.TabIndex = 6;
            this.textBoxMinDistance.Text = "00:00:00.100";
            //
            // labelSignalBelow
            //
            this.labelSignalBelow.AutoSize = true;
            this.labelSignalBelow.Location = new System.Drawing.Point(10, 11);
            this.labelSignalBelow.Name = "labelSignalBelow";
            this.labelSignalBelow.Size = new System.Drawing.Size(104, 13);
            this.labelSignalBelow.TabIndex = 7;
            this.labelSignalBelow.Text = "Sinal abaixo de (dB):";
            //
            // labelMinDuration
            //
            this.labelMinDuration.AutoSize = true;
            this.labelMinDuration.Location = new System.Drawing.Point(135, 11);
            this.labelMinDuration.Name = "labelMinDuration";
            this.labelMinDuration.Size = new System.Drawing.Size(70, 13);
            this.labelMinDuration.TabIndex = 8;
            this.labelMinDuration.Text = "Min Duration:";
            //
            // labelMinDistance
            //
            this.labelMinDistance.AutoSize = true;
            this.labelMinDistance.Location = new System.Drawing.Point(250, 11);
            this.labelMinDistance.Name = "labelMinDistance";
            this.labelMinDistance.Size = new System.Drawing.Size(72, 13);
            this.labelMinDistance.TabIndex = 9;
            this.labelMinDistance.Text = "Min Distance:";
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(384, 112);
            this.Controls.Add(this.labelMinDistance);
            this.Controls.Add(this.labelMinDuration);
            this.Controls.Add(this.labelSignalBelow);
            this.Controls.Add(this.textBoxMinDistance);
            this.Controls.Add(this.textBoxMinDuration);
            this.Controls.Add(this.textBoxSignalBelow);
            this.Controls.Add(this.buttonCancel);
            this.Controls.Add(this.buttonOK);
            this.Margin = new System.Windows.Forms.Padding(2);
            this.Name = "Form1";
            this.Text = "Remoção de áreas silenciosas";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion
        private System.Windows.Forms.Button buttonOK;
        private System.Windows.Forms.Button buttonCancel;
        private System.Windows.Forms.TextBox textBoxSignalBelow;
        private System.Windows.Forms.TextBox textBoxMinDuration;
        private System.Windows.Forms.TextBox textBoxMinDistance;
        private System.Windows.Forms.Label labelSignalBelow;
        private System.Windows.Forms.Label labelMinDuration;
        private System.Windows.Forms.Label labelMinDistance;
    }
}

public class EntryPoint
{
    private static Test_Script_With_Form.Form1 form;

    public void FromVegas(Vegas vegas)
    {
        form = new Test_Script_With_Form.Form1(vegas);
        form.ShowDialog();
    }
}

If you know there's only ONE audio track or you wanted to base everything on TOTAL audio and wanted to process every track based on total audio, you could change:

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsAudio())// removing the selected requirement && myTrack.Selected)
                {
                    myTrack.Mute = false;

                    RenderTempFile(tempFile);
                    //assume the video track is the track above the audio track
                    vidTrack = myVegas.Project.Tracks[myTrack.Index - 1];
                    ProcessLog(tempLog, myTrack);
                    ProcessLog(tempLog, vidTrack);

                    File.Delete(tempFile);
                    File.Delete(tempLog);

                    myTrack.Mute = true;
                }
            }

To be:

            RenderTempFile(tempFile);
            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                    ProcessLog(tempLog, myTrack);
            }
            File.Delete(tempFile);
            File.Delete(tempLog);

Then it will just render out the "total" audio from all tracks and then remove the "total quiet" sections from all tracks no matter how many. Here's the before with this change:

And after running the script:

andy-0 wrote on 10/8/2023, 4:58 PM

Thank you so, so, so much for the help, jetdv. The script worked as it should have. I wouldn't have been able to do it without your assistance. Now, the script is working correctly as it should. Thank you very, very much for the help.

jetdv wrote on 10/8/2023, 8:36 PM

@andy-0, glad I could help. I also changed your ("-3381"); // Alteração aqui para -3381 dB to -33.81 (adding the decimal) as it was picking up nothing at -3381 and I figured it really meant closer to -33 as my original was using -40.

Now combine it with this series and you can close all of the gaps on the timeline as well!