Math&Scripts In Fields

Hello
If I want to dial in a correct delay for a channel for example I would need to use a calculator.

My surgetion is that we can be able to write simple math in the fields directly.
This works very well in other applications I use.

example.

I want a 3/4 delay at 125bpm
Click the value field and type “60000/125*(3/4)”

-mads

Should it remember the formula? It would be cool if it would let enter variables like BPM and LPB and CurrentRow and NumRows and stuff :). So you could type: “60000/BPM*(3/4)”.

Or maybe do weird autoautomations: (CurrentLine % 16) / 16

But the edit fields in Renoise are quite small, you would never see the whole formula. Is this still useful then?

Which other programs do this? So we could take a look at how they’ve solved this…

Haha, having excel like formulas in Renoise would be kinda ironic.

I propose that you get formula editor popup in some conditions, like when entering more than 4 characters in the window or when pressing some special key.

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.

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.

Or

TrackDSP[DevicePosition].ValueId

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.

in blender you can use python expressions in numeric fields. that’s quit nice.

Yeah, this is why I added this in steps. Where first step actually describes the one which first poster asked about. And second and third step what I thought about.

If the functionality is advanced enough it would probably raise lot of interest among more scientifically oriented musicians who like to play with numbers. Depending on what you can do.

Is it worth it? I don’t know. I just thought to add some perspective to the thing. ;)

:panic:

+1

Small range of applications?

Take a look at the presets of Winamp’s Advanced Visualization Studio this to see what you can do with formulas…

If it was a small scripting language with conditional statements and loops and such, you could do a lot if things… it would be easier to list what you could not do with it… and there could be global variables, so the various formulas can interact with each other… hmm I think I’ll have to lie down for a while.

Come on, for Renoise 5.0… 20 years should be enough time to implement it properly :w00t:

Great idea! That’s something I loved about Apple Shake (compositing app). It supports math equations in fields, as well as variables. The latter was especially helpful for automation. You could link nodes and values, so that changing a single setting would affect other settings automatically.

Let’s say you have two tracks, Track1 and Track2. The volume of Track2 is supposed to be half the volume of Track1 no matter what, and the volume for Track1 is automated. You’d simply write “Track1.volume / 2” in the volume field for Track2, and the values would be linked. Every change to the volume of Track1 would instantly affect the volume of Track2.

I did some research on this and found some helpful things on the net. I could implement a prototype in C++ for experimenting and research, and release the code to public domain if Renoise or anyone else wants to use it.

Really interesting idea guys! It lends itself well especially to trackers, in my opinion… just wondering how it would be presented. Pop-up text field perhaps?

Maya does this. It’s extremely useful. It’s also how you add scripts to values, like in the rotationX field you’ll type in time/3, and as the animation plays rotationX will be animated accordingly.

Adobe programs do this. You can add simple math like +/-/*/% to every box containing number. Like you have something at 20mm and you just enter “+5” and you will have it at 25mm.

I fail to see the need for really really complex formulas in renoise though.

sometime we can realise that renoise users are really strange people…
:D