# Expression

I was wondering if I’m using the expression node in a way more people do. Anyway, is it a workabout, or is it something that does the trick? It certainly does nice stuff in my opinion! Since I knew about the exp-node it has become a little obsession of me. I enormously enjoy how Audulus is designed this way! Also @robertsyrret’s tutorial on counters, really got me into a rollercoaster. I am a professional musician and have, as a pianist, a world of music litteraly at my fingertips, but this is something else that triggers me a lot. Somehow I never got any math any further than the tables. No trigonometry, no nothing else. Learning this now and guess what? Thank to Audulus, just getting it all step by step! But here’s the thing: I learned about f(x). Which is a function. And how to ‘use’ it. That is, tincker with whatever x may be and the output. Great. I get it. Now I wanted to use it in Audulus. Because Audulus rewards you instantly with an audible answer aswell. Since A3 doesn’t understand f(x) I designed an expression for it to do so. With a counter that constantly changes x and an output for x. Plug it into a VCO and instant bebop. Have a look at it and tell me if I’m right or just too high on rabbithole fumes. I uploaded the expression: x==o?sin(o+o):0
Hope this may be fun to others too!

1 Like

Interesting. So x input is a counter? What is o in this case? Assuming 1v/oct tuning but what are you feeding it in this case?

1 Like

Hi Jersmi! Nice to see you. I guess I forgot an important thing here! The input of the VCO should have the expression sin(x). So it is as follows: x==o?sin(o+o):0 into sin(x). Both the inputs of the first expression are the same counter. For starters. You can always change the (o+o) part into (o*o+1) etc. Hope I got something here. I should upload a patch I guess. Let me hear if it works. Cheers!

1 Like

Here’s another more complete example. The counter goes from 0 to 7. I got it from Robert Syrret’s video on counters, which really was a game changer for me. Also, you notice that ‘y’ has nothing fed yet. Feed it the same counter for a new variation! I’ll upload a patch later. Need a PC for that. Cheers.

1 Like

Ok, makes sense, let’s see – I like your “do stuff and depending on what you do come back to the root” approach with the “:0” in your if/else logic statement. This would play nice with sin(x) because sin(0) is 0, ie., root. Looks like by “instant bebop” you mean swing-ish rhythm created by the sin(x), which will force the counter values into -1,1 range and (depending on what you send it) make the values speed up/slow down.

In general, the way I do stuff I would have my eye on what happens between sin(x) and VCO oct input. The way it is in this picture, no matter what you do prior to sin(x) the output will always be between -1,1 (which is a two octave range). Quick suggestion – you can modify your range with a multiply or add operation after sin(x) (before VCO o input). Multiply to increase/decrease range, add (or subtract) to offset range. Further – use a quantizer to force sin(x) output to some scale.

1 Like

Thanks. That really helped. If I didn’t do that allready within an extended expression where the coeficient, the variables, the operators and constants also are changed by the counter. It doesn’t however, slow or speed things up. It’s quiet different. It plays a steady 4/4 16th pattern. But I’ll have a look at the octave ranges. Added a quantizer after the sin(x). Does nice stuff!

1 Like

Hey @Stanley! I just wanted to point out that an expression node actually is a function, in/of itself. All that you do in Audulus is create a visual representation of real programming.

It is a bit similar to C++, but doesn’t require a compiler for you to use the program you have created, which makes it more functionally close to JavaScript or Python programming, in that regard.

The expression of your node is an if/else statement, and the node itself is the container that makes it a function. Here’s a direct Python clone of what you put together in the expression node’s function.

``````#!/usr/bin/env python3

# import the math library module
import math

# function definition here
def sin_f(x, o):
if x == o:
return math.sin(o + o)
else:
return 0
# the result of this is sin(10)
print(sin_f(5, 5))

# the result of this is 0
print(sin_f(2, 5))
``````

So, as you can see, the algorithm you have created, for any variable input parameters (x and o are the parameters), if the numbers are equal, the function should return `sin(2o)` and if they are not, it will simply return `0`. It’s pretty neat how that works, isn’t it? Audulus is so incredible!

P.S. I hope I made this clear enough for you to follow what is happening, and be able to understand the parallels. If you have any questions, I’ll be happy to answer them. Additionally, @stschoen is a retired developer on a level I can’t even see, from my vantage point lol. He’s very measurably more intelligent than I am and he is better at giving explanations than me, so he might even have something more helpful to add to this.

1 Like