- Configuration
- Debugging
- JSFX Computation Stages
- Data Structures
- Audio Constants
- Math Constants
- Math Functions
Configures the plugin.
config({
description,
inChannels,
outChannels
}: {
description: number;
inChannels: number;
outChannels: number;
}): void;
Example:
config({ description: 'volume', inChannels: 2, outChannels: 2 });
Registers a slider and its bound variable to be displayed in the plugin.
slider(
sliderNumber: number,
variable: number,
initialValue: number,
min: number,
max: number,
step: number,
label: string
): void;
Example:
slider(1, volume, 0, -150, 18, 0.1, 'Volume [dB]');
Registers a select box and its bound variable to be displayed in the plugin.
selectBox(
sliderNumber: number,
variable: string,
initialValue: string,
values: { name: string; label: string }[],
label: string
): void;
Example:
selectBox(
3,
algorithm,
'sigmoid',
[
{ name: 'sigmoid', label: 'Sigmoid' },
{ name: 'htan', label: 'Hyperbolic Tangent' },
{ name: 'hclip', label: 'Hard Clip' }
],
'Algorithm'
);
JS2EEL only supports the .log()
method.
console.log()
creates a debug variable to print the value of a variable in the JSFX dev environment.
console: {
log: (someVar: number | string) => void;
};
Example:
let myVal = 3;
console.log(myVal);
These functions correspond to JSFX's @sample
etc.
Init variables and functions here.
onInit(callback: () => void): void;
What happens when a slider is moved.
onSlider(callback: () => void): void;
Called for every single sample.
onSample(callback: () => void): void;
Iterates over each channel and provides the current sample for manipulation.
eachChannel(callback: (sample: number, channel: number) => void): void;
A fixed-size, multi-dimensional container for audio samples.
Access: buf[dimension][position]
Translates to EEL2s memory objects. Is not inlined in the EEL source, so only feasible for large data. For small data, use EelArray.
EelBuffer {
constructor(dimensions: number, size: number);
dimensions(): number;
size(): number;
}
A fixed-size, multi-dimensional container for numeric data.
Access: arr[dimension][position]
Is inlined in the EEL source, dimensions and size are restricted to 16 each. For large data, use EelBuffer.
EelArray {
constructor(dimensions: number, size: number);
dimensions(): number;
size(): number;
}
The sample rate of your project
srate: number;
Number of channels available
num_ch: number;
How many samples will come before the next onBlock()
call
samplesblock: number;
The tempo of your project
tempo: number;
The current playback state of REAPER (0=stopped, <0=error, 1=playing, 2=paused, 5=recording, 6=record paused)
play_state: number;
The current playback position in REAPER (as of last @block), in seconds
play_position: number;
Read-only. The current playback position (as of last @block) in REAPER, in beats (beats = quarternotes in /4 time signatures).
beat_position: number;
Read-only. The current time signature numerator, i.e. 3.0 if using 3/4 time.
ts_num: number;
Read-only. The current time signature denominator, i.e. 4.0 if using 3/4 time.
ts_denom: number;
Channel 1 (L) sample variable
spl0: number;
Pi
$pi: number;
These functions correspond exactly to their equivalents in JSFX/EEL2.
Returns the Sine of the angle specified (specified in radians).
sin(angle: number): number;
Returns the Cosine of the angle specified (specified in radians).
cos(angle: number): number;
Returns the Tangent of the angle specified (specified in radians).
tan(angle: number): number;
Returns the Arc Sine of the value specified (return value is in radians).
asin(x: number): number;
Returns the Arc Cosine of the value specified (return value is in radians).
acos(x: number): number;
Returns the Arc Tangent of the value specified (return value is in radians).
atan(x: number): number;
Returns the Arc Tangent of x divided by y (return value is in radians).
atan2(x: number, y: number): number;
Returns the square of the parameter (similar to x*x, though only evaluating x once).
sqr(x: number): number;
Returns the square root of the parameter.
sqrt(x: number): number;
Returns the first parameter raised to the second parameter-th power. Identical in behavior and performance to the ^ operator.
pow(x: number, y: number): number;
Returns the number e (approx 2.718) raised to the parameter-th power. This function is significantly faster than pow() or the ^ operator.
exp(x: number): number;
Returns the natural logarithm (base e) of the parameter.
log(x: number): number;
Returns the logarithm (base 10) of the parameter.
log10(x: number): number;
Returns the absolute value of the parameter.
abs(x: number): number;
Returns the minimum value of the two parameters.
min(x: number, y: number): number;
Returns the maximum value of the two parameters.
max(x: number, y: number): number;
Returns the sign of the parameter (-1, 0, or 1).
sign(x: number): number;
Returns a pseudo-random number between 0 and the parameter.
rand(x: number): number;
Rounds the value to the lowest integer possible (floor(3.9)==3, floor(-3.1)==-4).
floor(x: number): number;
Rounds the value to the highest integer possible (ceil(3.1)==4, ceil(-3.9)==-3).
ceil(x: number): number;
Returns a fast inverse square root (1/sqrt(x)) approximation of the parameter.
invsqrt(x: number): number;