Community Forums Archive

Go Back

Subject:Looping a sample
Posted by: stikyy
Date:12/21/2005 7:07:50 PM

Can anyone help me with looping a WAV. I need a simple loop. I know the start and end times. I know it can be done through a menu. Any suggestions?

Subject:RE: Looping a sample
Reply by: _TJ
Date:12/21/2005 8:20:13 PM

Unfortunately scripts in Sound Forge don't have access to any of the sampler loop controls.
tj

Subject:RE: Looping a sample
Reply by: stikyy
Date:12/22/2005 6:36:55 PM

What about using the Special -> Edit sample menu to create a sustaining infinite loop (if i know the start and end markers) maybe use the “Edit.InsertSampleLoop” from IScriptableApp.DoMenu(). Can I access the parameters that way.

Subject:RE: Looping a sample
Reply by: _TJ
Date:12/22/2005 8:31:42 PM

Well you can use

SfAudioSelection asel = new SfAudioSelection(ccStart, ccLength);
app.ActiveWindow.Selection = asel;

To select a time range in the Active DataWindow. Then use

app.DoMenu("Edit.InsertSampleLoop", false);

to bring up the Loop creationg dialog. But from there your script will just sit
there and wait for the user to choose settings in the dialog and hit OK.

You could try and work around this by using System.Windows.Forms.SendKeys class, but whether this works or not is going to depend on what window has focus when you run your script.

This script, will create a sustaining loop 1 second long starting at 1 second (for 44.1Khz files). But it only works if the active data window has focus when the script is run, and it has the rather wierd side effect of playing the loop once.

So as a rule SendKeys() doesn't make for robust scripts, but at this point, there are no native methods in Sound Forge that allow editing of sample loops.


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

public class EntryPoint {
public void Begin(IScriptableApp app) {

app.ActiveWindow.Selection = new SfAudioSelection(44100, 44100);
SendKeys.SendWait("%L~");

}

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;
} //EntryPoint





Message last edited on12/22/2005 8:38:33 PM by_TJ.
Subject:RE: Looping a sample
Reply by: GPD
Date:9/12/2006 6:35:08 PM

Is this still the only way to batch edit/set loop points?

Or is there a better way at this point?

I need to batch insert and edit parmeters found in Menus/Special/EditSample/


Subject:RE: Looping a sample
Reply by: _TJ
Date:9/13/2006 10:13:58 PM

Sorry, This is still the only way. Updates to Sound Forge 8.0 since 8.0b have been bug fixes only, no new scripting features have been added.

tj

Subject:RE: Looping a sample
Reply by: GPD
Date:9/26/2006 10:48:08 PM

is it possible to use this method to insert the items found in menu/special/edit sample/? Namely:

MIDI Unity Note (and)
Fine Tune (and)
insert a sustaining loop that is the complete lenght of the file

Can this be done in batch for 100's of files?

Could you possibly provide an example script?


Subject:RE: Looping a sample
Reply by: GPD
Date:9/26/2006 10:48:58 PM

Is it possible yet to Batch insert/edit Acid properties?

Go Back