我想修改现有的Sound Forge脚本,并将标记转换为区域并提取它,还将“酸属性”设置为Loop-1 Beat。
这是让我烦恼的方法,我希望有人可以提供帮助。
我正在使用64位Sound Forge Pro 12 Suite V12.1(Windows 7 64位)。
Sound Forge随附一个脚本,
名称:将标记转换为区域并提取
说明:此脚本会将标记转换为区域(菜单:特殊>区域列表>标记区域),然后运行提取区域(菜单:工具>提取区域)
除了将标记转换为区域并将其提取外,我还希望将其设置为将酸性质设置为Loop-1 Beat。
我不确定Sound Forge Pro 12是否甚至允许设置或修改酸属性,因为我找不到允许此操作的菜单-我已从具有特定菜单的Sony Sound Forge 8升级,因此也许修改后的脚本应该是Sound Forge 8版本。
万一有人可以帮助我,请在下面提供脚本代码。
我知道这是一个很大的问题,但这确实可以帮助我。
SOUND FORGE 12脚本 / * ================================================ ================================================== ===== *脚本名称:将标记转换为区域并提取 *说明:此脚本会将标记转换为区域(菜单:特殊>区域列表>标记为 *区域),然后运行提取区域(菜单:工具>提取区域) * *初始状态:在打开一个或多个包含区域的文件的情况下运行此脚本 * *参数(Args): * fAllFiles-设置为true以处理每个打开的文件-DEFAULT:false-仅处理活动文件 * *输出:已处理的文件数 * * ================================================== ================================================== = * /
using System;
using System.IO;
using System.Windows.Forms;
using SoundForge;
// Open one or more files containing markers before running the script
// BEHAVIOR:
// - Calls "Special | Regions List | Markers to Regions"
// - Calls "Tools | Extract Regions"
// - The script does not automatically save the changes that are made to each file.
//NOTE: Look for MODIFY HERE to quickly update the Script Args with your own preferences
public class EntryPoint {
public string Begin(IScriptableApp app) {
//start MODIFY HERE
bool fAllFiles = GETARG("All", false); //set to true to process every open file
// GETARG is a function that defines the default script settings. You can use the Script Args field to over-ride
// the values within GETARG().
// Example: To over-ride GETARG(Key, valueA), type Key=valueB in the Script Args field.
// Use an ampersand (&) to separate different Script Args: KeyOne=valueB&KeyTwo=valueC
//Example Script Args: All=true
//end MODIFY HERE
ISfFileHostList fileList = app.Files;
if (fileList.Count == 0)
{
DPF("Open a file containing markers before running this script. Script stopped.");
return "Open a file containing markers before running this script. Script stopped.";
}
int filesChanged = 0;
for (int i = 0; i < fileList.Count; i++)
{
SfStatus result;
SfStatus result2;
if ( ! fAllFiles && ! fileList[i].IsCurrent)
continue;
if (fileList[i].MarkerCount <= 0)
{
DPF(fileList[i].Filename + " does not contain any markers.");
continue;
}
fileList[i].IsCurrent = true;
result = app.DoMenuAndWait("RegionList.MarkersToRegions", false);
if (result == SfStatus.Success)
{
result2 = app.DoMenuAndWait("Tools.ExtractRegions", false);
if(result2 == SfStatus.Success)
filesChanged++;
}
}
DPF(String.Format("{0} file(s) affected. Script {1} is done.", filesChanged, Script.Name));
return String.Format("{0} file(s) affected. Script {1} is done.", filesChanged, Script.Name);
}
public void FromSoundForge(IScriptableApp app) {
ForgeApp = app; //execution begins here
app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name));
string szMessage = Begin(app);
app.SetStatusText((szMessage != null) ? szMessage : 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, object o) { ForgeApp.OutputText(String.Format(fmt,o)); }
public static void DPF(string fmt, object o, object o2) { ForgeApp.OutputText(String.Format(fmt,o,o2)); }
public static void DPF(string fmt, object o, object o2, object o3) { ForgeApp.OutputText(String.Format(fmt,o,o2,o3)); }
public static string GETARG(string k, string d) { string val = Script.Args.ValueOf(k); if (val == null || val.Length == 0) val = d; return val; }
public static int GETARG(string k, int d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsInt(k); }
public static bool GETARG(string k, bool d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsBool(k); }
} //EntryPoint
SOUND FORGE 8脚本
using System;
using System.IO;
using System.Windows.Forms;
using SoundForge;
// Open one or more files containing markers before running the script
// BEHAVIOR:
// - Calls "Special | Regions List | Markers to Regions"
// - Calls "Tools | Extract Regions"
// - The script does not automatically save the changes that are made to each file.
//NOTE: Look for MODIFY HERE to quickly update the Script Args with your own preferences
public class EntryPoint {
public string Begin(IScriptableApp app) {
//start MODIFY HERE
bool fAllFiles = GETARG("All", false); //set to true to process every open file
// GETARG is a function that defines the default script settings. You can use the Script Args field to over-ride
// the values within GETARG().
// Example: To over-ride GETARG(Key, valueA), type Key=valueB in the Script Args field.
// Use an ampersand (&) to separate different Script Args: KeyOne=valueB&KeyTwo=valueC
//Example Script Args: All=true
//end MODIFY HERE
ISfFileHostList fileList = app.Files;
if (fileList.Count == 0)
{
DPF("Open a file containing markers before running this script. Script stopped.");
return "Open a file containing markers before running this script. Script stopped.";
}
int filesChanged = 0;
for (int i = 0; i < fileList.Count; i++)
{
SfStatus result;
SfStatus result2;
if ( ! fAllFiles && ! fileList[i].IsCurrent)
continue;
if (fileList[i].MarkerCount <= 0)
{
DPF(fileList[i].Filename + " does not contain any markers.");
continue;
}
fileList[i].IsCurrent = true;
result = app.DoMenuAndWait("RegionList.MarkersToRegions", false);
if (result == SfStatus.Success)
{
result2 = app.DoMenuAndWait("Tools.ExtractRegions", false);
if(result2 == SfStatus.Success)
filesChanged++;
}
}
DPF(String.Format("{0} file(s) affected. Script {1} is done.", filesChanged, Script.Name));
return String.Format("{0} file(s) affected. Script {1} is done.", filesChanged, Script.Name);
}
public void FromSoundForge(IScriptableApp app) {
ForgeApp = app; //execution begins here
app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name));
string szMessage = Begin(app);
app.SetStatusText((szMessage != null) ? szMessage : 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, object o) { ForgeApp.OutputText(String.Format(fmt,o)); }
public static void DPF(string fmt, object o, object o2) { ForgeApp.OutputText(String.Format(fmt,o,o2)); }
public static void DPF(string fmt, object o, object o2, object o3) { ForgeApp.OutputText(String.Format(fmt,o,o2,o3)); }
public static string GETARG(string k, string d) { string val = Script.Args.ValueOf(k); if (val == null || val.Length == 0) val = d; return val; }
public static int GETARG(string k, int d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsInt(k); }
public static bool GETARG(string k, bool d) { string s = Script.Args.ValueOf(k); if (s == null || s.Length == 0) return d; else return Script.Args.AsBool(k); }
} //EntryPoint
我希望修改后的脚本将标记转换为区域,然后运行“提取区域”,并将每个提取区域的“酸属性”设置为“循环,1拍”,并使用“用户指定”将每个提取区域保存为wav文件文件名前缀和增量号。
上面的Sound Forge 8脚本除了设置酸属性外,还可以完成所有其他操作