Purpose of Expression Parameter in Waveform Channel Node

   2144   4   1
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Hi,

I've been working on setting up some digital asstets for a while now that makes use of the Sine Wave of the Waveform Channel Node.

So now I'm begining to explore the other options that this node offers in its “Type” drop down menu, like Triangle, Gaussian, Pulse, etc.

I find all of them are self explanatory in relation to the controls that the Waveform Node contains like Amplitude, Period, Offset, etc.

The one option though of the “Type” menu that kinda puzzles me is the “Expression” option.

Selecting this option makes available the parameter, and I am assuming, for the user to put in their own “formula” to give a desired type of waveform.

I am wondering if this “Expression” parameter is simply part of the drop down menu more for convenience sake than anything else?

Meaning its just the same as if we would “drop” down a float parameter, write our wave “formula” expression and make channel references of that nodes other parameters like amplitude, period, etc. if we wish to use their controls?

Or, are there some other “features” of this particular paramter that I may not know about?

I have tried putting in some expressions into the parameter to give some kind of wave with no luck. But I believe this is because of a few reasons.

One, is that I am not used to writing expressions that give waveform results.

The other is that the selections offered in the drop down, don't really show ( and I'm not suggesting it should ) the actual “formula” used for the particular waveform selected. Although you can see the results in the graph of the Motion FX View. And that being the case, don't have examples of what those options are doing and maybe modify and do my own based on that.

And lastly, I looked at the CookBook in the help section and maybe I didn't look closely enough but most of the examples seemed like those related to HScript and Vex expressions.

I pretty much jumped into learing Houdini using Python only.

So with some time spent I could probably “decipher” the cookbook examples, plug them in the expression and find out for myself, if my assumptions I mentioned earlier about this “Expression” parameter are correct.

Any input on this is much appreciated.

And, if its not too much and someone can think of something offhand, a simple python expression for this parameter to give me an idea of the “original” intent of the parameter, so from there I might be able to make use of and build other waveform options?

Thank you very much.
User Avatar
Member
2528 posts
Joined: June 2008
Offline
The Expression field actually accepts hscript code, not python or vex. So you can access basic $ variables.

cos($T) + sin ($T/2)

http://www.sidefx.com/docs/houdini15.0/network/expressions [sidefx.com]
Using Houdini Indie 20.0
Ubuntu 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Ok, so hscript code.

Played with that expression.

And that answered my other question about the other controls.

I was able to change the wave form of that expresion with ramp, decay and amplitude but not the others like period.

But that is ok, I am assuming what controls will affect your waveform depends on the type of expression you are using.

Otherwise, it shows that yes the other controls are “tied” to that expression box.

So thanks very much Enivob for the answer.

I'm on track again in looking more into waveforms and their expressions.

Cheers, have a great day
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Just wanted to post a note so no one reading this thread gets mislead.

Actually you can use python in the expredsion parameter of the waveform node.

When I first tried my expression I wasn't using any kind of “factor” that would change in relation to something else like over time or number of frames which is why I wasn't getting anything.

So when I tried Enivobs example but in python, it works.
User Avatar
Member
2036 posts
Joined: Sept. 2015
Offline
Another note I find odd.

When you put an expression ( HScript or Python ) in the Expression Paramter it won't show up as a “Graph” in the Motion FX View.

It will simply be drawn as a horizontal line.

If you run animation the horizontal bar will go up and down according to the expression you specified, but you can't ( or so I think ) get a graph of what that expression looks like.

I think this was the main reason I was originaly puzzled when I put my first expression in the Expression Parameter. All I got was a horizontal line.

I thought there was something wrong with me in the sense I didn't know how to write wave functions.
  • Quick Links