code

Reverse Engineering the Korg Monotribe Firmware Upgrade

An excellent post (and useful comments) on the reverse engineering of the Korg Monotribe firmware update which apparently is provided as an audio file.  I’ll definitely be checking back on this regularly to watch Gravitronic’s progress.

GRAVITRONIC: Decoding the Korg Monotribe Firmware Upgrade.

Sound Forge Batch Export Script

I frequently use Sound Forge to edit large wave files into smaller samples and clips that I then use in software samplers, drum machines, or set aside for further editing, When you’re only creating two or three clips, highlighting, copying, pasting, saving, renaming isn’t a big deal. Recently though while working on a project I found myself I need of creating dozens of clips from a single file… and this had to be done for a hundred files.

Sound Forge scripting to the rescue.

Sound Forge comes with some great built in scripts. For the task above I found the script named “Save Regions as Files” particularly useful. At first anyway. The existing script still required me to name the file and select the file location. This is a minor detail but when you have to repeat this process over 100 times it can be extremely frustrating. With a little help from the Sound Forge scripting SDK I came up with the following modification to the original script that will export all regions to the original file’s directory without any prompting.

The example above is named “Test_Wave_Export.wav”. When running the script the 6 regions are automatically saved in the same directory as the source file in incremental format without any additional prompting. A huge time saver.

Test_Wave_Export-01.wav
Test_Wave_Export-02.wav
Test_Wave_Export-03.wav…

Once the script is saved in the Sound Forge Script folder you can make an icon and add the script directly on your toolbar for easy access. This script uses JScript

——————————————————-

import System;
import System.IO;
import System.Windows.Forms;
import SoundForge;

//Run with a file that contains regions
//Iterates through the regions, renders to format of your choice and
//saves the rendered file to the same directory as the source file
//Scan the file for MODIFY HERE to see how to quickly customize for your own use

public class EntryPoint {

public function CleanForFilename(szName)
{
szName = szName.Replace(“:”,”;”);
szName = szName.Replace(“?”,”!”);
szName = szName.Replace(“*”,”+”);
szName = szName.Replace(“/”,”|”);
szName = szName.Replace(“\\”,”|”);
if (szName.IndexOfAny(Path.InvalidPathChars) >= 0)
{
for (var ch in Path.InvalidPathChars)
szName = szName.Replace(ch.ToString(),”_”);
}
return szName;
}

public function Begin(app : IScriptableApp) {

//MODIFY HERE———————————————–
var szType = “.wav”; //choose any valid extension: .avi .wav .w64 .mpg .mp3 .wma .mov .rm .aif .ogg .raw .au .dig .ivc .vox .pca
var vPreset = “DaveTemplate”; //put the name of the template between the quotes, or leave blank to pop the Template chooser.
var FileFullName = app.CurrentFile.Filename; //obtain the full path and filename of the current file
var szDir = FileFullName.substring( 0, FileFullName.lastIndexOf(“\\”) ); //Set the directory to that of the source file.
var file = app.CurrentFile;

if (null == file)
{
app.SetStatusText(“open a file loser!”);
return;
}

//make sure the directory exists
Directory.CreateDirectory(szDir);

var rend : ISfRenderer = null;
if (szType.StartsWith(“.”))
rend = app.FindRenderer(null, szType);
else
rend = app.FindRenderer(szType, null);

if (null == rend)
{
app.SetStatusText(“Renderer not found. Script stopped.”);
DPF(“renderer for {0} not found.”, szType);
return;
}

var template = null;
if (vPreset != “”)
template = rend.GetTemplate(vPreset);
else
template = rend.ChooseTemplate(null, vPreset);
if (null == template)
{
app.SetStatusText(“Template not found. Script stopped.”);
return;
}

var szBase = file.Window.Title;
szBase = szBase.substring(0,szBase.length – 4);

for (var mk in file.Markers)
{
if (mk.Length <= 0)
continue;

var szName = String.Format(“{0}-{1}.{2}”, szBase, mk.Name, rend.Extension);

szName = CleanForFilename(szName);

var szFullName = Path.Combine(szDir, szName);
if (File.Exists(szFullName))
File.Delete(szFullName);

var range : SfAudioSelection = new SfAudioSelection(mk.Start, mk.Length);
file.RenderAs(szFullName, rend.Guid, template, range, RenderOptions(“RenderOnly”));
}

var status : SfStatus = app.WaitForDoneOrCancel();
DPF(“Done -{0}”, status);
}

public function FromSoundForge(app : IScriptableApp) {
ForgeApp = app;
app.SetStatusText(String.Format(“Script ‘{0}’ is running.”, Script.Name));
Begin(app);
app.SetStatusText(String.Format(“Script ‘{0}’ is done.”, Script.Name));
}
public var ForgeApp : IScriptableApp = null;
public function DPF(sz) { ForgeApp.OutputText(sz);}
public function DPF(sz,o) { ForgeApp.OutputText(System.String.Format(sz,o)); }
public function DPF(sz,o,o2) { ForgeApp.OutputText(System.String.Format(sz,o,o2)); }

public function DPF(sz,o,o2,o3) { ForgeApp.OutputText(System.String.Format(sz,o,o2,o3)); }

} // class EntryPoint