What Is The Formula Device?

Cool… About a little bit of programming, I do see the User there and one could write to that… if one knew what to write.
So far it seems that the formula device does not directly have access to the transport ( LPB / BPM ), or if it does, it’s not dead-obvious (=obvious enough) to me.
This would be really swell for controlling an arpeggiator metadevice’s parameters tho.

sorry, meant ‘actual attempts at making tracks’, not ‘threads’. bit tired i suppose. editted the post.

what i meant was not so much that that thread shows you examples of formulas, but rather examples of experiences with usage of the device itself. in other words, it was an attempt to underline my comment on the alpha-ness of the device by providing you with a thread of people trying to use it in tracks and failing because of crashes etc.

i don’t have any real-life examples of formulas etc for the device because i suck at math and therefore have trouble making something proper with that device.

Don’t think so. All you can do is route the result of the formula to some other DSP chain device.

Maybe some interesting thing to do with it is complex automations over a longer time period, without writing down automation explicitely in the Automation tab.

You can create something of a kin to automation lanes or LFOs by entering formulas, with three controllable variables (A, B & C) a lot of built in functions and variables (pattern/song postistion etc) and more programmable via LUA.

So you could use it to create a simple automation that builds through an entire track with a few simple commands or use it to completely mash and modulate something by combing say a signal follower with trigonometric functions and much more.

Is there any possibility to directly address the audio stream with the math device, for example for programming a little synth?

maybe through a workaround using the dc offset device?

Hm, but what about also reading the audio stream, for example for processing it with some dsp math?

Is the formula device script based or compiled c++?

The formula device is a native C++ compiled device, so there is not much that can be tweaked outside the core dev-circle here.

Thanks for the info, I just asking because of theoretical performance of the formula device. So it would be theoretically possible to manipulate the audio stream with it… :)

the formula device embed a stripped down lua interpreter so what you actually see there is plain lua. in fact in the user tab you can define your own lua functions and initializations, to be used in the formula itself.

i will soon collect some useful recipes i have here to explain its use cases.

see https://forum.renoise.com/t/inertial-slider/35039

mmm, recipes )

Also, this thread is a completely dead duck without this (thanks to kazakore from another thread ( Enabling The Formula Meta Device ) ):

[details=“Click to view contents”]<?xml version="1.0" encoding="UTF-8"?>








true

false

Init

false

true

Mixer



0.5

Device only





1.0

Device only





0.0

Device only





0.5

Device only





1.0

Device only



true





true

true

Init

true

true













A

B

C

true

1



0.0

Device only





0.0

Device only





0.0

Device only





-1

Device only





-1

Device only





-1

Device only









[/details]

Are you saying, that since I do know how to say

  
renoise.song().transport.bpm = 110  

that the Formula part could be used to say, read A + LINE
and the User part could be used to do

renoise.song().transport.bpm = Formularesult  

?
How would I go about doing that?

These would be appreciated very much! :)

Are you still not using Meta Devices a lot??
Basically you can create (amongst others) complexer LFOs, or LFOs that always have 4 cycles per pattern no matter how long the pattern, stuff like that. I used to make some chiptunes by typing in weird formulas, like sin(X+sin(X)) where X is something to do with LINEF/NUMLINES2PI - and then letting it control a DC offset and render the pattern. Voila a chiptune.
demo-formula.xrns

These kinds of waveforms are also what I mean by ‘complex LFOs’ - but usually, I’ll indeed just try using a couple LFOs with them bound to Offset or Amplitude or even Frequency of another LFO, throw some MMixers in etc.

tldr; I don’t really use it in a lot of songs, I did have a wobbly bassline with it once but I lost that xrns. It was fun to make, but because you can change only 3 params, I don’t know it’s still just a little bit made for the diehard…

hi @cas - unfortunately, your demo song is no longer there. could you assist in making it available again? it would really help me understand. this “4 cycles per pattern no matter the length” sounds like a great idea and should be made into a “LFO “tool””.
any pointers would be appreciated. i’m not sure who to ask about Formula device and it’s usecases and examples.

Hello friend!

You can try using the formula:

LINEFCOUNTER*4/NUMLINES

and maybe you need to wrap or modulo or floor() it before using it as saw wave lfo directly.

So it takes these variables into account, and instead of the “4” you could use any other number of repetitions through the pattern. The LINEFCOUNTER is the current position with fractions, and NUMLINES is the number of lines in each pattern. I believe if you stop, the LFO would still run, LINEFCOUNTER would keep cycling depending on current pattern position.

Here are some basic formulas, you can just put them into the formula field of the formula device and define these variables in the code field or change them to numbers: “num_cycles” is the repetitions per pattern, “offset” is the starting phase 0…1, both can be fractional numbers.

sine wave LFO:

sin(TWOPI*LINEFCOUNTER*num_cycles/NUMLINES+offset)*0.5+0.5

Or saw wave:

mod(LINEFCOUNTER*num_cycles/NUMLINES+offset,1)

Or square:

floor(mod(LINEFCOUNTER*num_cycles/NUMLINES+offset,1)+0.5

take care how you need to push the sine function from -1…1 to 0…1 and how you need to do modulo on the saw wave and square wave value to keep it in range, while the sine function does this intrinsically. The floor function will make the square wave alternate between 0 and 1 once the phasor passes 1.0, and because it was shifted by 0.5 this is to happen exactly at the halve of each cycle. You can adjust this offset, as well, to generate a PWM on the LFO!

With these functions as starting point, you can tweak i.e. value range by multiplying the result to scale it and then adding an offset, like i’ve done on the sine wave function to make it fit within a slider range.

1 Like

Yo! Funny that you have been landing on replying to 2 of my 10+ year old messages here in two weeks!!
Haha.
I did a quick search and the file was somewhere on my backup, so here it is. No warranty :smiley:
https://www.dropbox.com/scl/fi/w570hppgkwybrrp5fyfqz/demo-formula.xrns?rlkey=ayv5zuwi953zr5ajuwovnaboa&st=vw7ylggo&dl=0

1 Like

thanks, saved!