5. OmniScript FX
OmniScript FX (Version 1.1)
An integrated system of native, scripted audio and MIDI effects for the Omni DAW environment. A single text file with an .omfx extension represents an entire, fully functional plugin. This environment requires no compilers or external dependencies – you simply write code and hear the results instantly.
Format Pliku
OmniScript files feature an .omfx extension. They are standard plain text files encoded in UTF-8, based on a simple sectioned structure.
// To jest komentarz (komentarze liniowe w stylu C)
@name: Mój Efekt
@desc: Krótki opis działania
@mode: audio // Tryby: audio | midi | modulator
@param[0] name="Freq" min=20 max=20000 default=1000 unit="Hz"
@param[1] name="Mix" min=0 max=1 default=0.5 unit="%"
@init
z1 = 0.0;
z2 = 0.0;
@block
g = tan(3.14159 * param[0] / sample_rate);
@sample
spl0 = spl0 * g;
spl1 = spl1 * g;Sekcje Skryptu
| Section | When it is called | Requirements |
|---|---|---|
@init | Once upon load and reset | Optional |
@block | Once per audio buffer (before the @sample loop) | Opcjonalna |
@sample | Once for each sample frame (Left+Right channel) | Required for audio mode |
@midi_note_on | On every MIDI note press event (Note On) | Required for midi mode |
@midi_note_off | On every MIDI note release event (Note Off) | Optional for midi mode |
@modulate | Once per buffer, generates the output value output | Required for modulator mode |
Wbudowane Zmienne
Read-only
sample_rate(f64) Sample rateframes(f64) Number of frames in buffertempo(f64) Tempo in BPMbeat_pos(f64) Position in beatsplay_state(f64) 0=stop, 1=play, 2=recordparam[0..63](f64) UI parameter values
Read and Write
- Audio
spl0, spl1 - MIDI
note, velocity, sample_offset - Modulator
output
User variables are initialized by default to 0.0 and retain their state between blocks.
Język Wyrażeń
The language provides standard arithmetic operators (+, -, *, /, %), logical operators (&&, ||, !), and comparisons (<, >, <=, >=, ==, !=).
Conditional Statements
Supported constructs include if / else conditions, as well as while and for loops with strict hardware RT-Safety rules (1024 iterations limit / call).
Built-in Functions
Available math operations (e.g., sin, cos, floor, min, pow, clamp, rand) and MIDI event functions: emit_note(note, velocity, offset).
User Functions
Declaration using fn my_function(x, y) before main blocks (e.g., @init).
Real-Time Safety (RT-Safety)
OmniScript was designed with a rigorous approach for generating audio within real-time loops. This means, among other things:
- 01No heap allocations: the entire state is created using pre-established and reserved internal memory buffer locations.
- 02Execution limit: The virtual machine has a hard limit defining the number of op-codes in a single buffer pass (10,000 compiler operational instructions), ensuring the code won't stall the DAW.
- 03No heavy I/O operations: the code processes only dry arithmetic for 64-bit floating point numbers. Compilation happens once, separately, right before the DSP is activated.