Neue Scripts und Updates

snibchi schrieb am 01.12.2016 um 10:08 Uhr

Hallo zusammen,

ich dachte man könnte alte und bewährte Scripts mal auf den neuen Stand bringen und ggfls. neue hier veröffentlichen.

Wenn die Idee nicht gewünscht ist, kann dieser Beitrag auch entfernt werden.

1. Ich habe früher immer mal das Script "NormalizeAll.js" benutzt und habe ein ".cs" für Vegas draus gemacht (teilweise unter Verwendung von bereits mitgelieferten Code in Scripts):

/** This script normalizes all Audio Events in the current project. 

* This script works best if you run it after all event peaks have  

* been built.  
* 
* Revision Date: Nov. 30, 2016  **/

using System; 
using System.Collections.Generic; 
using ScriptPortal.Vegas;

public class EntryPoint 
{     
	public void FromVegas(Vegas vegas)     
	{
		// Collect lists of the audio events
		// and video events of media with audio

		List<TrackEvent> evtListAudio = new List<TrackEvent>();

		foreach (Track trkItem in vegas.Project.Tracks)
		{
			foreach (TrackEvent evtItem in trkItem.Events)
			{
				if (evtItem.MediaType == MediaType.Audio)
				evtListAudio.Add(evtItem);
			}
		}

		int numAudEvents = evtListAudio.Count;

		for (int ixAudEvt = 0; ixAudEvt < numAudEvents; ++ixAudEvt)
		{
			AudioEvent audioEvent = (AudioEvent) evtListAudio[ixAudEvt];
			audioEvent.Normalize = true;
		}
	}
}

Dieses Script normalisiert alle Audio Events.

PS: Sorry, so oft ediert, aber das CodeFenster ist echt gewöhnungsbedürftig.

Kommentare

Puschi schrieb am 13.12.2016 um 06:16 Uhr

und was macht das Script, sorry die Frage, bin da bissel leihe (alle Audio Events) wenn ich das so verstehe, ich lasse dieses Script laufen und alle Audio-Dateien werden auch die gleiche Lautstärke gestellt, oder wie verstehe ich dies?

Marco. schrieb am 13.12.2016 um 10:45 Uhr

Fast. Die Spitzenpegel aller Audio-Events werden damit auf den gleichen, in den Präferenzen voreingestellten, Wert gebracht.

Puschi schrieb am 13.12.2016 um 16:43 Uhr

okay, probiere ich mal aus, danke

snibchi1 schrieb am 20.12.2016 um 12:05 Uhr

Wie das bekannte "FadeInOut.js" nur mit GUI, Auswahlmöglichkeit von Überblendungslänge, Transition und Effect für ausgewählte Tracks.

/**
 * Program: FadeEventInOut.cs
 * Description: This script will add specified fade,
 * transitions and effects
 * both ends of the selected track events
 *
 * Revision Date: Dec 20, 2016
 **/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;

using ScriptPortal.Vegas;

public class EntryPoint
{
    Vegas myVegas = null;
    List<Track> trkListIsSel = new List<Track>();
    public void FromVegas(Vegas vegas)
    {
        myVegas = vegas;

        // Collect list of selected tracks
        foreach (Track selTrk in myVegas.Project.Tracks)
        {
            if (selTrk.Selected)
                trkListIsSel.Add(selTrk);
        }

        // leave if no track selected
        if (trkListIsSel.Count == 0)
        {
            MessageBox.Show("There is no track selected.");
            return;
        }

        // bring up the dialog
        DialogResult result = ShowUIDialog();
        myVegas.UpdateUI();

        // handle if click ok button
        if (DialogResult.OK == result)
        {
            // get user specified entrys and run fadeinout
            String overlapTimeMask = overlapTextbox.Text;
            DoFadeInOut(overlapTimeMask);
        }
    }

    String plugInName;
    String presetName;

    void DoFadeInOut(String overlapTimeMask)
    {

        Timecode overlap = new Timecode(overlapTimeMask);

        foreach (Track selTrack in trkListIsSel)
        {
            if (selTrack.Events.Count == 0)
                continue;

            Timecode swapStart = new Timecode(0);

            // count the events in track
            int sumEventsInThisTrack = selTrack.Events.Count;
            int evtNo = 0;
            foreach (TrackEvent evtItem in selTrack.Events)
            {
                ++evtNo;
                if (swapStart.ToMilliseconds() == 0)
                {   // the first event in track
                    swapStart = evtItem.End;
                    // FadeOut for the first event
                    evtItem.FadeOut.Length = overlap;
                    continue;
                }

                // set FadeIn and FadeOut
                evtItem.FadeIn.Length = overlap;

                // Set transition if selected track is
                // video type and pluginName is not empty
                if (evtItem.MediaType == MediaType.Video && plugInName != "(none)")
                {
                    // set transition
                    PlugInNode fx = myVegas.Transitions;
                    PlugInNode plugIn = fx.GetChildByName(plugInName);

                    Effect effect = new Effect(plugIn);
                    evtItem.FadeIn.Transition = effect;
                    if (presetName.Length != 0)
                        effect.Preset = presetName;
                }

                // the last event have no fadeout
                if (evtNo != sumEventsInThisTrack)
                    evtItem.FadeOut.Length = overlap;

                // move the event
                evtItem.Start = swapStart - overlap;
                swapStart = evtItem.End;
            }
        }
    }

    MaskedTextBox overlapTextbox;
    TreeView crossFadeTree;

    void fillTreeNode()
    {
        // the first item name in root node
        TreeNode treeNode0 = new TreeNode("(none)");
        crossFadeTree.Nodes.Add(treeNode0);

        // find more items
        List<PlugInNode> transList = new List<PlugInNode>();
        int totalTransitions = myVegas.Transitions.Count;
        foreach (PlugInNode trans in myVegas.Transitions)
        {
            transList.Add(trans);

        }

        // bring the item names into TreeView
        int numTransitions = transList.Count;
        for (int ixTrans = 0; ixTrans < numTransitions; ++ixTrans)
        {
            PlugInNode fx = transList[ixTrans];
            if (fx.IsContainer)
            {
                // add more root node to treeView
                TreeNode treeNode1 = new TreeNode(fx.Name);
                crossFadeTree.Nodes.Add(treeNode1);

                // get names from container childs
                IEnumerator enumChilds = fx.GetEnumerator();
                while(enumChilds.MoveNext())
                {
                    TreeNode lastRootNode = crossFadeTree.Nodes[crossFadeTree.Nodes.Count - 1];
                    crossFadeTree.SelectedNode = lastRootNode;
                    PlugInNode childNode = (PlugInNode) enumChilds.Current;
                    // only video crossfades
                    if (childNode.IsVideo)
                    {
                        // add crossfades to treeView
                        TreeNode treeChildNode = new TreeNode(childNode.Name);
                        crossFadeTree.SelectedNode.Nodes.Add(treeChildNode);
                        crossFadeTree.SelectedNode = treeChildNode;

                        // add presets to treeView
                        IEnumerator enumPresets = childNode.Presets.GetEnumerator();
                        while (enumPresets.MoveNext())
                        {
                            // add crossfade presets to treeView
                            String presetName = enumPresets.Current.ToString();
                            crossFadeTree.SelectedNode.Nodes.Add(presetName);
                        }
                    }  
                }
            }
        }
        // select first item in root node = "(none)" as default
        crossFadeTree.SelectedNode = treeNode0;
        crossFadeTree.Select();
    }
   
    /******************************
     * create Dialog
     ******************************/
    DialogResult ShowUIDialog()
    {
        Form dlog = new Form();
        dlog.Text = "FadeInOut";
        dlog.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
        dlog.MaximizeBox = false;
        dlog.StartPosition = FormStartPosition.CenterScreen;
        dlog.Width = 300;
        dlog.Height = 300;
        dlog.FormClosing += this.HandleFormClosing;

        int titleBarHeight = dlog.Height - dlog.ClientSize.Height;
        int buttonWidth = 80;

        overlapTextbox = AddTextControl(dlog, "Overlap", titleBarHeight + 6, 120, 10, "00:00:01.00");

        int buttonTop = dlog.Height - (2 * (buttonWidth + 10));
        int buttonsLeft = dlog.Width - (2 * (buttonWidth + 20));

        crossFadeTree = new TreeView();
        crossFadeTree.Left = 10;
        crossFadeTree.Width = buttonsLeft + (2 * buttonWidth);
        crossFadeTree.Top = overlapTextbox.Bottom + 10;
        crossFadeTree.Height = buttonTop - 50;
        crossFadeTree.AfterSelect += new TreeViewEventHandler(HandleTreeViewClick);
        dlog.Controls.Add(crossFadeTree);

        fillTreeNode();

        Button okButton = new Button();
        okButton.Text = "OK";
        okButton.Left = (dlog.Width / 2) - buttonWidth - 10;
        okButton.Top = buttonTop;
        okButton.Width = buttonWidth;
        okButton.Height = okButton.Font.Height + 12;
        okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
        dlog.AcceptButton = okButton;
        dlog.Controls.Add(okButton);

        Button cancelButton = new Button();
        cancelButton.Text = "Cancel";
        cancelButton.Left = (dlog.Width / 2) + 10;
        cancelButton.Top = buttonTop;
        cancelButton.Height = cancelButton.Font.Height + 12;
        cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
        dlog.CancelButton = cancelButton;
        dlog.Controls.Add(cancelButton);

        dlog.Height = titleBarHeight + okButton.Bottom + 8;
        dlog.ShowInTaskbar = false;

        return dlog.ShowDialog(myVegas.MainWindow);
    }

    MaskedTextBox AddTextControl(Form dlog, String labelName, int left,
        int width, int top, String defaultValue)
    {
        Label label = new Label();
        label.AutoSize = true;
        label.Text = labelName + ":";
        label.Left = left;
        label.Top = top + 4;
        dlog.Controls.Add(label);

        MaskedTextBox textbox = new MaskedTextBox();
        textbox.Multiline = false;
        textbox.Left = label.Right;
        textbox.Top = top;
        textbox.TextAlign = HorizontalAlignment.Center;
        textbox.Mask = "00:00:00.00";
        textbox.Text = defaultValue;
        dlog.Controls.Add(textbox);

        return textbox;
    }

    /******************************
     * Mouse Handles
     ******************************/
    void HandleTreeViewClick(object sender,
    TreeViewEventArgs e)
    {
        TreeNode tmpNode = e.Node;

        // compute column in treeview
        int col = -1;
        while(tmpNode != null) {

            tmpNode = tmpNode.Parent;
            ++col;
        }

        // set pluginName and presetName
        switch(col)
        {
            case 0: // is root container
                crossFadeTree.SelectedNode = crossFadeTree.Nodes[0];
                crossFadeTree.Select();
                plugInName = "(none)";
                presetName = "";
                break;

            case 1: // is crossfade
                plugInName = e.Node.Text;
                presetName = "";
                break;

            case 2: // is preset
                plugInName = e.Node.Parent.Text;
                presetName = e.Node.Text;
                break;
        }
    }

    void HandleFormClosing(Object sender, FormClosingEventArgs args)
    {
        Form dlg = sender as Form;
        if (null == dlg) return;
        if (DialogResult.OK != dlg.DialogResult) return;
    }
}

 

Audiovisuelle Geräte

  • Canon EOS 6D
  • Canon EOS 450D
  • Nicon Coolpix S7000
  • AC800 Actioncam
  • Sony HDR-SR5

Hardware-Ausstattung

  • Monitor: LG Ultrawide 34UC79G
  • Tastatur: MSI GK 50 Elite
  • Maus: Corsair M65 PRO RGB
  • Gehäuse: CooMas HAF X 942-KKN1 ATX
  • PSU: be quiet! Staight P11 850W
  • Board: MSI MEG X570 ACE (Bios 7C35 v 1.K0, 01.03.2023)
  • CPU: AMD Ryzen 9 3900x
  • Cooler: Noctua NH-D14 SE2011 (AMD Adapter)
  • RAM: 2x 16GB D432GB 3600-17 Predator K2 KHX
  • SSD: 1x 2TB Gigabyte GP-ASM2NE6200TTTD
  • SSD: 1x 4TB SanDisk Ultra 3D
  • SSD: 1x 512GB Samsung 850 Pro
  • GPU: 1x 12GB MSI Radeon RX 6750 XT
  • NAS: Synology DS 218+ 2x 6TB

Software

  • Windows 11 Pro 23H2 (Build 22631.3235)
  • MAGIX Vegas Pro 14 - 21 (Build 108)
  • MAGIX Photostory Deluxe 2024 23.0.1.159 (UDP3)
  • Sound Forge Audio Studio 17
  • ADOBE Master Suite CS6, Photoshop CC