tag:support.nodebox.net,2012-11-01:/discussions/show-your-work/334-waveformNodeBox: Discussion 2019-07-18T10:05:13Ztag:support.nodebox.net,2012-11-01:Comment/474478272019-07-18T10:05:10Z2019-07-18T10:05:10ZWaveform<div><p>As a newbie I was frustrated by the wave node. It's a simple mathematical function: give it an X and it will spit out a Y. But I wanted and expected to actually see the different kind of waves.</p>
<p>Of course you can see them by hooking a range node to the wave node, turning the X and Y values into points, and connect those points. This gives you a decent approximation, but it was not immediately obvious how to do this at first. It's a pain to have to do it each time. And, as a purist, I don't want an approximation with hundreds or thousands of tiny line segments; I want the real thing!</p>
<p>Hence, the waveform node. This draws the same four wave types as the wave node (sine, square, triangle, and sawtooth) across whatever X values you want. And it produces clean, efficient, precise paths.</p>
<p>This is actually rather hard to do. It's mathematically impossible to draw a true sine wave using bezier curves, but you can come close enough that no one can tell the difference. The other three waves are simpler but a tad tricky because of various corner cases. For easy viewing, waveform produces continuous paths even for the discontinuous square and sawtooth waves; it would not be hard to remove the vertical segments if need be.</p>
<p>I am not sure how useful this node really is, though sine waves can be quite beautiful when rotated or overlaid in various ways. It can also help you more quickly understand the best min, max, period, and range of X values to use with the wave node when doing animations or music synthesis. You could also make a nifty oscilloscope with this node if you wanted.</p>
<p>Requires my make_curve.py custom node (included). The zip file also contains a little animation I made using sine waves.</p>
<p>Enjoy!</p>
<p>John</p></div>john