Community Forums Archive

Go Back

Subject:Auto Markers - Editing the script
Posted by: Gibon143
Date:7/10/2012 5:38:35 PM

I edit big batches of songs at specific time intervals and am trying to edit the Marker script so that when it is run it automatically adds a marker at these time codes:

6.85 seconds
11.5 sec
15 sec
19.85 sec
30 sec
45 sec
60 sec
90 sec
120 sec

How can I do this? Any help would be amazing!

Cheers

Subject:RE: Auto Markers - Editing the script
Reply by: roblesinge
Date:7/11/2012 7:46:12 AM

Do you need it to work on just the open file, or do you want it to run on a batch of files at once?

Do you need the markers to say anything specifically, or just the default?

Rob.

Subject:RE: Auto Markers - Editing the script
Reply by: Gibon143
Date:7/11/2012 11:33:55 AM

Rob,
Thanks for the reply!

Just the one file as I have to spend some time with each one. Marker names would be great corresponding to the time code the marker is at.

This would make my days so much easier! Thanks for the help!


Subject:RE: Auto Markers - Editing the script
Reply by: roblesinge
Date:7/13/2012 8:53:43 AM

This is pretty simple to code up. I've had a rather busy week, but I'm hoping to have an idea of what you need in the next couple of days.

Rob.

Subject:RE: Auto Markers - Editing the script
Reply by: roblesinge
Date:7/16/2012 7:35:18 AM

The following script will do what you need. I built in a tiny bit of error checking, in case any of your files are less than the prescribed amount of silence.

Try it out and let me know if it works for you.


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

public class EntryPoint
{
public void Begin(IScriptableApp app)
{
if (app.CurrentFile.Length > app.CurrentFile.SecondsToPosition(6.85))
{
app.CurrentFile.Markers.AddMarker(app.CurrentFile.SecondsToPosition(6.85), "6.85 seconds");
}

if (app.CurrentFile.Length > app.CurrentFile.SecondsToPosition(11.5))
{
app.CurrentFile.Markers.AddMarker(app.CurrentFile.SecondsToPosition(11.5), "11.5 seconds");
}

if (app.CurrentFile.Length > app.CurrentFile.SecondsToPosition(15.0))
{
app.CurrentFile.Markers.AddMarker(app.CurrentFile.SecondsToPosition(15.0), "15.0 seconds");
}

if (app.CurrentFile.Length > app.CurrentFile.SecondsToPosition(19.85))
{
app.CurrentFile.Markers.AddMarker(app.CurrentFile.SecondsToPosition(19.85), "19.85 seconds");
}

if (app.CurrentFile.Length > app.CurrentFile.SecondsToPosition(30.0))
{
app.CurrentFile.Markers.AddMarker(app.CurrentFile.SecondsToPosition(30.0), "30.0 seconds");
}

if (app.CurrentFile.Length > app.CurrentFile.SecondsToPosition(45.0))
{
app.CurrentFile.Markers.AddMarker(app.CurrentFile.SecondsToPosition(45.0), "45.0 seconds");
}

if (app.CurrentFile.Length > app.CurrentFile.SecondsToPosition(60.0))
{
app.CurrentFile.Markers.AddMarker(app.CurrentFile.SecondsToPosition(60.0), "60.0 seconds");
}

if (app.CurrentFile.Length > app.CurrentFile.SecondsToPosition(90.0))
{
app.CurrentFile.Markers.AddMarker(app.CurrentFile.SecondsToPosition(90.0), "90.0 seconds");
}

if (app.CurrentFile.Length > app.CurrentFile.SecondsToPosition(120.0))
{
app.CurrentFile.Markers.AddMarker(app.CurrentFile.SecondsToPosition(120.0), "120.0 seconds");
}

}

public void FromSoundForge(IScriptableApp app)
{
ForgeApp = app; //execution begins here
app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name));
Begin(app);
app.SetStatusText(String.Format("Script '{0}' is done.", Script.Name));
}
public static IScriptableApp ForgeApp = null;
public static void DPF(string sz) { ForgeApp.OutputText(sz); }
public static void DPF(string fmt, params object[] args) { ForgeApp.OutputText(String.Format(fmt, args)); }
} //EntryPoint


Thanks,
Rob.

Subject:RE: Auto Markers - Editing the script
Reply by: Gibon143
Date:7/17/2012 11:18:54 AM

Worked Great! Thank you for taking the time to do that!

A whole lot easier considering the monotony of marking them every time!

Big Thanks

G


Go Back