What Is The Formula Device?

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!