zigzag~ and curve~ (exponential ramp) functionality

radiotonga's icon

Hello,

I'm working with zigzag and would like to modify its linear ramp output. There's already an older thread asking about something similar in terms of how would you 'marry' zigzag~ with an object like curve~, which accepts multiple ramps and is flexible enough but can only work at control rate and hence is not useful to me.

I think that scaling zigzag~'s value would be overkill, requiring at least three buffers to store the scaling info (minimum and max) plus the curve value, and a complex enough system of arithmetic operations to fetch these values with three different index~ objects.

Is there a solution to this problem? Should this be on a feature list?

Thanks

radiotonga's icon

Hi Raja,

Your idea is good but not applicable to my current project. I'm gonna explain myself further:

I'm using a function object to control the frequency envelope of an oscillator. Why function and not table? I like the elegance and simplicity of function, in that I can input a couple of points and control curvature. As you know, function is designed to work with curve~, but curve~ is not useful to me because it only works at control-rate and what I want is a continuous envelope at the signal-rate, hence my choice of working with zigzag~.

Now that this is clear, I hope this next bit is gonna be understandable. Suppose I have this trajectory drawn in function (in Hz since we're talking about frequencies): 0 500 250 1000 0

zigzag~ will output this trajectory linearly, and I need it to be exponential whenever I draw a curve. I have made this patch that has all the above issues solved except for the 'juicy' part, where the Frequency output from zigzag~ has to be converted to a (0-1.) range to work with exponential curves and scaled back to the original Frequency range (0-1000 according to the function object). I hope you can understand it as I made my best to make it as transparent as possible.

Thanks!

Max Patch
Copy patch and select New From Clipboard in Max.

PS: BTW, forget that thing about the 3 buffers. In this patch I devised a more clever approach (l33t).

neceq's icon

Have you tried experimenting with putting the output of a function/line~ combo through a log~, sqrt~, or pow~? I would be curious to see how it worked out. Just a theory.

Edit: I wasn't able to check your patch because I am computerless, so I apologize if I already mentioned something you just posted. :P

radiotonga's icon

Well, in my patch I attempt to replicate the internal functionality of curve~ with pow~ objects. That part could be applied to the output of line~ but would be totally worthless since curve~ does this so well on its own.

Perhaps my own goal is absurd, but in the end I'm just looking for a way to implement such a nice way of drawn envelopes (function) to a continuous signal-rate. curve~ is just control-rate (44.1 samples minimum resolution).

radiotonga's icon

Yeah well, technoui.js is not very flexible (for instance, you can only have a fixed number of points, like a step-sequencer), and I'm very rusty on JS so I'll just have to figure out the complex way. Objects like function are very good for visual-oriented sketching. I will contact the guys at Cycling and make the request anyhow.

radiotonga's icon

Ok, here's my masterwork for posterity...

Max Patch
Copy patch and select New From Clipboard in Max.

(it goes to show how much DSP/list processing you could avoid with one single object, in case zigzag~ ever gets updated with this feature)