Expression evaluator formulae?

Official support for: meldaproduction.com
Post Reply New Topic
RELATED
PRODUCTS

Post

My math skills have always been rudimentary at best, words have clicked more than numbers.
Could those of you who understand/ enjoy math post some formulae for the rest of us to experiment with? I, for one, would not only appreciate the effort, but be very interested to see what syntax is actually applicable.
Thanks in advance.

Post

Yeah, I'd love 5 or 10 examples, ideally added to the help, as inspiration

Post

+1
Melda Production & United Plugins
Surface Studio = i7, 32gb, SSD.
Windows 11. Bitwig, Reaper, Live. MTotal.
Audiofuse, Adam Audio monitors + sub, iLoud MTM.
Polybrute, Summit, Pro 3, Tempest, Syntakt, AH2.
Ableton Push 2, Roli Seaboard Block.

Post

+1

Post

Just trying to wrap my head around this cool feature:
I always start by simple examples and later get to more complex stuff

For the easy start: How to build a single sine cycle
x is our variable, it's range is [0, 1]. A whole sine cycle needs [0, 2*pi]
Therefore "sin(x*2*pi)" will give you one single cycle, "sin(x*4*pi)" will give you two cycles

How to build a linear "ramp down"
Values from the function should start with max value (left) and decrease linearily to 0 (right side)
Let's call the value y. So y has a range of [1,0 ] wheras x [0,1]
Therefore (1-x) will provide you with the correct value

How to build a combination of both
We want to have a sine wave which starts a full up/down range ans slowly "fades out".
We have all the components already above. We combine the "two full sine cycles" with the "ramp down" factor, which is (1-x) * sin(x*4*pi)

What...phase modulation?
In our first two examples we directly use x inside the sine function.
We call the parameter inside of the sine function the phase ...
What if we put a sine inside a sine? That way we have a inner function that somehow modulates the phase of the outer sine, like sin(inner_function(x))... if our inner_function itself has a value range [0,1] then for a complete cycle we again have to add the 2*pi factor, i.e. f(2*pi*inner_function(x))
Let's again build stuff from ground up:
For our example we use sin(2*pi*x) from above. This gives use values in the range [0,1]. This is our inner_function
Let's place it into the outer function...remember, we need 2*pi to get a full cycle...
Now give sin(2*pi*sin(2*pi*x)) a try ... The result is what you see in the attached screen shot.

Edit Tipp: Whenever your function looks not smooth, adjust the number of points, then go into the expression edit field, just type a extra blank at the end of your current formula. This will update the function evaluation with the adjusted number of points

Tipp: Please use more then 16 points to get smoother and more recognizable curves

Now let's go crazy???
What if we combine everything?
Try: sin(2*pi*(1-x)*sin(2*pi*x))
You do not have the required permissions to view the files attached to this post.

Post

Actually ... probabaly I went to fast to crazy with "inner_function" ...

Let's build an organ like sound
You might now a Draw Bar Organ. What this does is, that each draw bar can be used to add/remove a certain upper harmonic...i.e. actually this is a sine frequency which is a multiple of the base frequency. Let's see
we have already seen our base full cycle sine: sin(2*pi*x)
What is the sine with the double frequency? We've had this already sin(4*pi*x)
What is double frequency of that? sin(8*pi*x)
And so on and so on... forever...
Now that we are able to combine it by "adding" the harmonics together we have to take care that our value range of [-1,1] is not exceeded, therefore we need to make the values a little smaller by writting 0.5 * sin(2*pi*x) and as we go up the frequency we go down with the factor...

I have for instance applied this "Adding sines" using a "double the frequency and half the factor" for each next harmonics approach... giving:
0.5*sin(2*pi*x)+0.4*sin(4*pi*x)+0.3*sin(8*pi*x)+0.2*sin(16*pi*x) +0.1*sin(32*pi*x) +0.05*sin(64*pi*x) +0.025*sin(128*pi*x)

What happens if you use the following formula which look quite similar? Does this almost look like it could be a sawtooth if it's grown up?
0.5*sin(2*pi*x)+0.4*sin(4*pi*x)+0.3*sin(6*pi*x)+0.2*sin(8*pi*x) +0.1*sin(10*pi*x) +0.05*sin(12*pi*x) +0.025*sin(14*pi*x)

Post

Here's another one... I tried to bring the graph of arcus sinus into the signal shape window. Check out the function here: https://en.wikipedia.org/wiki/Inverse_t ... _functions

Because our variable x goes from [0,1] and the values are [-1,1] in the shape window, we have a problem, because arcsin is defined this way: arcsin [-1,1] -> [-pi/2, pi/2] which does not match [0,1] -> [-1, +1]

But it is possible to get the graph with this: 2*asin(-1+2*x)/pi
Let's break down the parts: -1+2*x goes from -1 to 1. Simple put the min x value into the formula it will give you -1+2*0 = -1, Then put the max x value into the formula: -1+2*1 = 1
asin then has values -pi/2 up to pi/2 - just multiply those values with pi. It will give you -1/2 to 1/2.
Then it's easy to multiply this by two to get [-1,1]

Post

LOL!
I was curiously typing things like: '-x' or '1-x' or 'x+1' and happy to see ramps when Peter steps in and goes from basic maths to complex trigonometry in 2 steps!
My personal interest in the shape creations here is for interesting modulation shapes, not sound creation, but he definitely shows some of the possibilities!
Thank you Peter.

Post

werzel wrote: Fri Jan 17, 2020 9:58 pm LOL!
I was curiously typing things like: '-x' or '1-x' or 'x+1' and happy to see ramps when Peter steps in and goes from basic maths to complex trigonometry in 2 steps!
My personal interest in the shape creations here is for interesting modulation shapes, not sound creation, but he definitely shows some of the possibilities!
Thank you Peter.
I think you can use all this stuff for LFOs as well. I haven't tried it out, but I think the example I've called "Phase Modulation" would be fun sounding if it controlls a filter cutoff.

If your here for the wob-wob stuff... Try
1.) 2 or 4 ramp ups in a single cycle ( (x / 0.125 ) % 2 ) / 2, or ( (x / 0.125 ) % 4 ) / 4
2.) Kind of a stair case with 4 steps: floor(x / 0.25) / 4
3.) Wobbles with increasing rate of 1,2,3,4 cycles: sin((floor(x / 0.25)+1)*8*pi*x) (s. screen and example patch)
For these formulae please use large number of points

Use the following code like this: Click "Select All". Use Ctrl-C (copy). Go to MSF, open the toolbar to the right, then click on the Paste icon.

If you want - please go an use sin(2*pi*sin(2*pi*x)) in LFO1 instead of the provided expression and set the LFO1 sync rate from 1 to 1/2

Code: Select all

$eNrtXE1zGzmSvetXMOhrU8JHApkZQXKi7ZZmOtZqaU33xxxpqWwxmmJpyKLH3l+-gSKryC7AqHTsHuZQDB8sMl8VPhMvH4Cc-u3L83r0udjuVuVmNtaXajwqNg-l42rzaTbeVx8nNP7b-GJ6uyj3m8eb5UNVbr-uiqpabT7tRq9mYz0evfrxp5+Kl+ppNlaXwPWHDJEfj17drNZVsb0p1+vy37flpgwmSh1s2Fs0djx69ff16rF4v3ouwq9a1R+NSK7+rfywXO-eLz8cXrV4Lsvq6fW2WB7eFz3sYHD95WVb7A51+qbRzbb4177YPHzN2NwuVxvd97vqM+h9gukzsH0G0Gfg+gx8j0FfGfuK2FfCvgL2lQ97fqee3zn3e-n4+1NRrDM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CiVflRuuM2WK-q5arTcbil7Iq7j5+jC3+vl49Foer9tFvb8pNtS3X62K7Gy1Wm0-r4s3TcrMp1s1s+fGhWn0uQqMW1ehNuV4vX3bF+21R1Jfqrx9XdeqN+fTNsio+lduvP1fF88+bj+Xofrnb-bvcPs7GoSvf7LfbYpN4wiHXyNkDFtWyKubTmyJkCCl29SvC5f-GfXXsro5Pnk9-vD+Usk7qcFbqUIntyzFJQPCOF9Pboiq2OzOf-r56rJ5u59NFud8+FKP7bfGxznqy2nxqchE0JlcN6GJ6dbso95vHY2KQ3SFvx25+8b+BzS0K
You do not have the required permissions to view the files attached to this post.

Post

I don't have specific goals in mind for the shapes, just experimentation!

One odd thing that I noticed is that if you use the same window to input the equations into (one after another) and then use the Undo arrow, the resulting waveshapes are NOT the same. I'm not sure if this would qualify as a bug or perhaps my expectations are incorrect.

Thanks again for your insights Peter!
BTW, you introduced 2 new elements that I don't quite understand, the % and 'floor'.

Post

Uuuuu :o :clap:
Vojtech
MeldaProduction MSoundFactory MDrummer MCompleteBundle The best plugins in the world :D

Post

werzel wrote: Sat Jan 18, 2020 1:38 pm I don't have specific goals in mind for the shapes, just experimentation!

One odd thing that I noticed is that if you use the same window to input the equations into (one after another) and then use the Undo arrow, the resulting waveshapes are NOT the same. I'm not sure if this would qualify as a bug or perhaps my expectations are incorrect.

Thanks again for your insights Peter!
BTW, you introduced 2 new elements that I don't quite understand, the % and 'floor'.
No problem, I try to explain
"%" is the modulo operator: if you divide natural numbers, i.e. without fraction part, at times ther will be a reminder (hope it's called this way in englisch)
I think best is to give examples
0 % 4 = 0
1 % 4 = 1
2 % 4 = 2
3 % 4 = 3
4 % 4 = 0
5 % 4 = 1 (4 fits into 5 exactly one time, with 1 as reminder)
6 % 4 = 2
7 % 4 = 3
8 % 4 = 0
The interessting thing is that if you do "m % n" you get only the numbers [0, n-1]
If you count m [0, ...] the cycle [0, n-1] will repeat. That's how you can make steps...

Second thing is floor and this is much easier. If you have a real number it simply will cut the fraction part. floor(3.8) = 3, floor(3.1) = 3. It's not the way we have learnt rounding in school. It will always "drop" down to the next integer number, therefore "floor". Btw "ceil" works the other way round, it will give you allways the next higher integer number.

Now how can you make the x in the window have 4 steps?
x is [0,1] ... divide it by 0.25 and you'll get all real numbers in [0, 4].
Apply the floor to it and you get the steps: floor(x / 0.25) /4

Post

Thanks for this Peter, I haven't had time to sit down and absorb it all yet but I'm looking forward to getting the opportunity! Appreciate the effort it took to write all this up, thanks again!

Post Reply

Return to “MeldaProduction”