Script Tool

The Edison & Slicex Script Tool (Ctrl+T) - Opens a menu containing the list of available scripts. You can write your own scripts using Basic, Pascal or Javascript, which will be compiled by the paxCompiler and run when you select the script from the menu. The paxCompiler is a true Pascal compiler that allows you to write code to perform complex DSP on your samples.

Save scripts - as .pas files in the FL Studio installation directory under ..\Plugins\Fruity\Effects\Edison\Data\Scripts. Files saved here will be visible the next time you use the 'run script' command.

Dialogs - Note that while some of the demo scripts show a dialog, it isn't necessary to use them.

Errors - If a script has an error, a dialog is shown explaining the error with options to 'edit' the script or 'run' it again.

Writing scripts - Examine the contents of the existing scripts and read the Reference.txt file in the script directory to learn more about writing them and the functions available. You can learn more about Pascal HERE.

Edison Script Reference

Global variables
CRLF string - acts as a line feed for showing multiline messages
Editor TEditor
EditorSample TSample
ScriptPath string


Global functions
ProgressMsg procedure ProgressMsg(const Msg:String;Pos,Total:Integer);
ShowMessage procedure ShowMessage(const s: string);


Delphi/Windows functions
Dec procedure dec(var Value, Decrement: integer);
FloatToStr function FloatToStr(Value: extended): string;
Inc procedure inc(var Value, Increment: integer);
IntToStr function IntToStr(Value: integer): string;
Round function Round(Value: double): integer;
TimeGetTime function timeGetTime: integer; stdcall;


Wave related classes
// PasteFromTo modes
0: insert
1: replace
2: mix
// NormalizeFormat Mode flags (combine as needed)
NF_NumChannels: normalize the number of channels
NF_Format: normalize the sample format
NF_Samplerate: normalize the samplerate
NF_All: normalize all (combines all flags)
// region
TRegion = class
constructor Create;
procedure Copy(Source: TRegion);
property SampleStart: integer;
property SampleEnd: integer;
property Name: string;
property Info: string;
property Time: single;
property KeyNum: integer;
// sample
TSample = class
constructor Create;
function GetSampleAt(Position, Channel: integer): single;
procedure SetSampleAt(Position, Channel: integer; Value: single);
procedure CenterFromTo(x1, x2: integer);
function NormalizeFromTo(x1, x2: integer; Vol: single; OnlyIfAbove: boolean = FALSE): single;
procedure AmpFromTo(x1, x2: integer; Vol: single);
procedure ReverseFromTo(x1, x2: integer);
procedure ReversePolarityFromTo(x1, x2: integer);
procedure SwapChannelsFromTo(x1, x2: integer);
procedure InsertSilence(x1, x2: integer);
procedure SilenceFromTo(x1, x2: integer);
procedure NoiseFromTo(x1, x2: integer; Mode: integer = 1; Vol: single = 1);
procedure SineFromTo(x1, x2: integer; Freq, Phase: double; Vol: single = 1);
procedure PasteFromTo(aSample: TSample; var x1, x2: integer; Mode: integer = 0);
procedure LoadFromClipboard;
procedure DeleteFromTo(x1, x2: integer; Copy: boolean = FALSE);
procedure TrimFromTo(x1, x2: integer);
function MsToSamples(Time: double): double;
function SamplesToMS(Time: double): double;
procedure LoadFromFile(const Filename: string); // loads a full filename (use ScriptPath to complete it)
procedure LoadFromFile_Ask; // shows open dialog
procedure NormalizeFormat(Source: TSample; Mode: integer = nfAll);
function GetRegion(Index: integer): TRegion;
function AddRegion(const SetName: string; SampleStart: integer; SampleEnd: integer = MaxInt): integer;
procedure DeleteRegion(Index: integer);
property Length: integer;
property NumChans: integer;
property Samplerate: integer;
property RegionCount: integer;
// editor
TEditor = class
function GetSelectionS(var x1, x2: integer): boolean;
function GetSelectionMS(var x1, x2: double): boolean;
property Sample: TSample;


Dialog classes and functions
TInput = class
property DefaultValue: single;
property ValueAsInt: integer;
property Min: single;
property Max: single;
TScriptDialog = class
constructor Create;
function AddInput(const aName: string; Value: single): TInput;
function AddInputKnob(const aName: string; Value, Min, Max: single): TInput;
function AddInputCombo(const aName, ValueList: string; Value: integer): TInput;
function GetInput(const aName: string): TInput;
function GetInputValue(const aName: string): single;
function GetInputValueAsInt(const aName: string): integer;
function Execute: boolean;
function CreateScriptDialog(const Title, Description: string): TScriptDialog;