Some ideas about it. Just my ideas and made for consideration and discussion.
Step 1: Static simple math
Clicking a field and pressing special key brings up “Formula Editor”.
You can enter standard C style math there without any variables:
(10 + 20) / 6
When closing the formula editor the editor shows computed value. When
clicking it again it automatically brings up the formula editor.
Formula editor has a button “Save Statically” or something in the flavour
which removes the formula from memory and keeps only the computed value
converting the field back to standard value editor. Formula Editor is
automatically discarded when the value is set to real number without
any mathematic operators.
All values should be treated as floats. If the field expects integer
the result is floored to nearest integer value 5.7 = 5 or rounded:
5.7 = 6
Step 2: Static advanved math
Brings in advanced math functions like:
cos, sin, tanh, etc.
Also constants like PI.
Step 3: Dynamic math
Brings in variables. Now the value is recalculated on every tick when
the formula contains some variable. When the formula doesn’t contain
any variables it’s calculated only on init and calculated value used
during the song.
First variables should be:
BPM - Beats Per Minute
LPB - Lines Per Beat
CurrentRow - Currently playing row
CurrentTick - Current tick in the row
CurrentPattern - Currently playing pattern number
CurrentOrder - Currently playing order number
TimeSinceStart - Time since the start of the song milliseconds
Step 4: Macros
Macros are formulas that have a name and are saved in song, under SongSettings.
Defining them looks like MacroName=MacroCode
By default there should be some macros available like:
BeatLength=(60000/BPM) // Beat length in milliseconds.
The macros can be skipped and made available as static variables in renoise.
Step 5: Advanced variables.
Access to track dsp’s and other variables. Like
DeviceId.ValueId (Filter3.cutoff / 2)
Returns the Filter3 cutoff position in same track DSP chain.
There should be a simple select field in the formula editor
just like in LFO device for example. Where you can select device and
the value. Only this doesn’t make connection in background but enters
the suitable variable text to Formula Editor.