Reaktor/Tutorials/Applied algebra for Reaktor users
What you should know
[edit | edit source]Algebra is by far the most important form of mathematics needed when it comes to working with Reaktor. Ideally one should have an understanding of high school algebra, along with at least some peripheral knowledge of trigonometry. One generally does not encounter circumstances in Reaktor where things such as the quadratic equation are needed, but generally speaking you should be comfortable with solving single variable linear equations (i.e. solving for x if: ) and double variable linear equations (i.e. solving for y if: ). Polynomials with terms to powers greater than one are not encountered too often (i.e. ), but you may encounter them when doing such things as shaping linear controller data into a curve.
Resources
[edit | edit source]- http://www.mathleague.com/help/algebra/algebra.htm -- A basic introduction to algebra with a focus on turning sentences into equations (you can ignore the section on sequences)
- http://www.ifigure.com/math/algebra/algebra.htm -- Contains several dozen useful web-based algebraic calculators
Useful formulas
[edit | edit source]Scaling data from one range to another
[edit | edit source]
- x = input
- f(x) = output
- m = min value of input
- M = max value of input
- m' = min value of output
- M' = max value of output
As an example, say you have an LFO which is outputting in a range from -1 to 1. However, you want the LFO to be outputting in a range from 30 to 50. We can use the above formula to construct a function which transforms our input from the old range to the new range: We simply plug in our values and then simplify.
NOTE: The dot ( ) signifies multiplication. Subtracting a negative is the same as adding.
Taking into account order of operations (from highest priority to lowest: parenthesis, exponents, multiplication and division, addition and subtraction), we see that we can transform our input via three easy steps:
- Add 1 to the input -- This shifts the range (-1..1) to (0..2).
- Multiply the result of that by 10 -- This scales the range of (0..2) to (0..20).
- Add 30 to the result of the multiplication -- This shifts the range of (0..20) to (30..50), our goal.
Here is one more example, where we transform our input with a range of -300 to 24 into data with a range of 100 to 10000.
NOTE: We do not reduce the fraction because 9900 ÷ 324 produces a repeating decimal (30.55555...).
Hence we get the following steps:
- Divide 9900 by 324 -- This gives us 30.555555...
- Add 300 to the input -- This shifts the range (-300..24) to (0..324).
- Multiply the result of step 1 by the result of step 2 -- This scales the range (0..324) to (0..9900).
- Add 100 to the result of step 3 -- This shifts the range of (0..9900) to (100..10000), our goal.
As you can see, linearly scaling data is as simple as shift, scale, shift.
MIDI Pitch => Frequency (Hz)
[edit | edit source]
- = pitch
- = frequency
Frequency (Hz) => MIDI Pitch
[edit | edit source]
- = frequency
- = pitch
- = the natural log
How many times MIDI pitch A is slower than MIDI pitch B (A < B)
[edit | edit source]
- A = MIDI pitch A
- B = MIDI pitch B
- f(x) = output