Is there a formula documentation that is more complete than this?
--[[ Input variables ---------------- ]]--
A : First input parameter [0..1]
B : Second input parameter [0..1]
C : Third input parameter [0..1]
--
--[[ Math constants ----------------- ]]--
PI : Pi constant
TWOPI : Two Pi constant
INF : Plus infinity (huge number)
--
--[[ Musical variables -------------- ]]--
SRATE : Actual sampling rate
BEATS : Current position in beats
SAMPLES : Current position in samples
PLAYING : Play or stopped
BPM : Beats per minute
LPB : Lines per beat
TPL : Ticks per line
SPL : Samples per line
LINE : Line number in current pattern (integer)
LINEF : Line number in current pattern (fractional)
NUMLINES : Number of lines in current pattern
TICK : Tick number in current line
TICKCOUNTER : Absolute tick count
SEQPOS : Current pattern index in sequencer
--
--[[ Functions ---------------------- ]]--
abs(x) : Absolute value
acos(x) : Arc cosine
asin(x) : Arc sine
atan(x) : Arc tangent
ceil(x) : Round number to ceil
cos(x) : Cosine
cosh(x) : Hyperbolic cosine
deg(x) : Convert to degrees
exp(x) : Exponential (e^x)
floor(x) : Round number to floor
fmod(x) : Modulo operator for float numbers
frexp(x) : Split value in fraction and exponent
ldexp(x) : Float representation for a normalised number
lin2db(x): Convert a 0..1 number to its decibel value
db2lin(x): Convert a decibel value to its 0..1 normalised value
log(x) : Natural logarithm of a number
log10(x) : Logarithm base 10 of a number
max(a, b [, c[, ...]]) : Maximum of two or more numbers
min(a, b [, c[, ...]]) : Minimum of two or more numbers
mod(x) : Modulo operator
modf(x) : Integral and fractional parts of a number
pow(x, n): Nth power of x
rad(x) : Convert to radians
random([a [, b [, c]]]) : Random value
randomseed(x): Seed the random number generator
sin(x) : Sine
sinh(x) : Hyperbolic sine
sqrt(x) : Square root
tan(x) : Tangent
tanh(x) : Hyperbolic tangent
hi, could you help me on what the logic would be in writing a formula device which, say, cycles a LFO 4 times (say, a sinewave) for the length of the pattern. and if the pattern is 512 rows or 4 rows, it will always cycle 4 times.
or even just one time. iād really appreciate it. btw, are you on discord or elsewhere? i really need to get more information and maybe a call.
i was thinking it might be possible for there to be more documentation and since my textfile is from 2009 or 2011, maybe there had been more examples added, or more definitions added.
i am trying to go through the posts that mention formulas, to find out examples, etc, but so far no go. especially since the amount of presets for the formula device is severely limited:
I believe renoise scripting (and thus also the formula device) operate on the programming languange lua 5.1.
So any tutorial that teaches you correct lua 5.1, like those on www.lua.org, will help you learning how to code for the device. Just on the formula device you have no libraries other than unprefixed math and the internal variables in the help window.
The formula device itself works likeā¦first the whole code window is executed once, and all variables and functions are read. Then for each tick in song the formula paragraph is called to produce the (0ā¦1) result value of the formula paragraph. You can call functions and use variables from the code paragraph in the formula, that is the meaning of the bigger code window. The A,B and C parameters are the three input sliders, with these you can control your formulas. All code is just lua code, and you can test the code i.e. in scripting terminal or another lua environment, you just need to wrap your functions like math etc. to test your code and simulate inputs. Thatās the only way to debug your code btw, I hope this gets better in future.
Thatās about it. Iām a formula device nerd and love using it and writing code for it, if you have any questions, send me some message, Iām always glad to help when itās okay when my code is shared with others.
Can the formula device apply slight modulation to a sinusoidal LFO, imprinting (for want of a better word) a random lfo to have a ānoisyā sinusoidal modulation signal output? Im interested in long, slow āanalogā modulation of a source for example - like semi predictable, noisy drift as one example? I know we cant do audio rate but is that possible? Or would i be better off with the meta mixer?
Yes, definitely you can program that. You can just use a sine wave and add another noise drift generator on top of it - it can calculate tick by tick, and if you want it to be precise you can measure the current tick to calculate the data right. You can code any lua algorithm to drive your LFO! And youāre right, to fake such a thing you can also try to use LFO and meta mixer with another noise LFO.
Did you find out anything new since this post was made?
Iām currently digging into some signal processing stuff and would love to try more things in the Formula device. More examples would be very appreciated, even user made ones.
formula device only outputs a modulation signal, at tick rate - afaik. Not usable for audio rate signal processing, unfortunately.
I have a few examples, though. Will post them here shortly. Although Iām sure there are many here in the forum who understand how to utilize the formula device much more deeply than I do 3 sin.xrdp (888 Bytes) perlin noise.xrdp (2.3 KB) zen quant.xrdp (1.1 KB)
here are a few examples
thanks, will add them to my formula research folder
i keep meaning to make Paketti address the Formula device but i just havenāt had the time because thereās so much other stuff to add
@untilde
so i rescued my formula āmanualā and added some of these forum links to it and the krakengore inertial slider and that spring slider someone else made. iām currently trying to see what else could be done and how.
my idea is that these should be stored inside the tool and loaded with a button, and hopefully eventually itāll result in some more ideas.
i still canāt seem to do a single thing, like a simple thing, like have A control the bpm for instance.
just so i could understand simple things
it just throws me how i canāt for the life of me figure out the simplest things with this. it feels like iām back in 2010 trying to comprehend lua.
hi
so i, while fooling around with making all dialogs close with a specific shortcut, ended up rewriting the formula manual part of Paketti. then i took a look at it and realized it should actually have buttons for writing formulas to the current row). so hereās what i have now:
when you boot up the formula āmanualā, it will create a formula device if not already there.
iām slowly adding stuff like Inertial Slider and Spring Slider and some formula forum links, with the hopes thisāll kick me into working on this in a better way.
ok, inertial slider + springslider have been formatted to the correct capitalisationā¦ phew.
itās such a jungle here. textfiles + xml stuff that are old, some are clipboard stuff, some presetā¦ some doing xdrp stuff, some sharing txt + xml + forum clips.
ok, now what? i read and re-read. āset a value with Input Aā ā to me, means, i move the A slider.
if playhead is stopped, itāll output 0, right?
if playhead is playing, itāll output Value of A, right?
butā¦ where? where does it go?
ā¦ EDIT: okay, i get it. if playing, then A goes to āout of formulaā, aka where the āHelpā text ends. i wonder if i could use this to write to the pattern selection or something.
ok, so, in this example, A / B / C are not set to anything, right? so iām guessing i should maybe rename them to or , so people would then not think about that.
actually, this is the first one that definitely utterly makes sense to me. itās a really nice thing!
now, if i wanted to reverse it, would i just go NUMLINES/LINES ?
ok so itās definitely not just switching LINES/NUMLINES and then it goes from max to min (end of pattern).
so looks like, maybe my next question is, @uncle_c - if i wanted to reverse this, what would i do in the formula editor?
renoise.song isnāt available from the formula device. Itās a meta device to control DSP parameters by a formula. The target parameter to control is set under āDest.ā (like in all meta devices).
Since the formula should return a normalized value (0-1), reversing the effect of LINE/NUMLINES would be done with 1-LINE/NUMLINES. Example: Instead of returning 0.1 it would then return 0.9 - in effect āreversingā the movement of the output.