• ### Signal rate separate positive/negative slew

Hi!

I've been stumped over this problem for so so long. Is there a straightforward way to apply slew to a signal that has a separate rate for positive going changes vs. negative going changes?

For example to limit the speed of an increase in a signal to 15Hz and limit a decrease in the same signal to 5Hz.

I've tried various foolish things to keep this at signal rate and have decided that I should just convert to messages and use a buffer table or something. I'd love to hear from you if you have a signal-rate solution.

If no one does, I'll try some kind of control-rate buffer and upload my results.

• Posts 9 | Views 5311
• how would what you want differ from line~?

• I'd like to process a signal in the way I would use lop~ 5, signal in and out.

So something like lop~ 15 for increases in sample value and lop~ 5 for decreases in sample value.

You're right about line~ though, I could compare a message to the previous message and pair the value with a different time value if it's greater vs lesser. But that's taking a message in, signal out and so reduces time resolution.

• Or rather, compare against the current value.

This is really sloppy, but this is the idea. Is there a way to do this at the signal rate?
slewing.pd

• In that case the issue is that you need a lop~ with a signal rate input. I suppose you could use bob~.

If you find such a thing (btw I will release a clone of supercollider's lag in my library very soon, which is capable of this) you can find out if the samples are increasing or decreasing with `[rzero 1]`. If the numbers are > 0 samples are increasing and if < 0 samples are decreasing . So you could feed [rzero] into [>~ 0} and use tabread~ perhaps to read the frequency for your hypothetical lowpass filter from a 2-value table

edit: here is the source code for lag if you are interested in compiling it: lag~.c
the basic formula is y[n] = x[n] + a*(y[n - 1 ] - x[n])
also, now that I think about it things might be more complicated because I think what you want is to "latch" the frequency of the lowpass filter to stay the same until a new change in the direction of the input

• here's an example. Making this makes me want a "hold~" object that simply holds the left inlet when the right inlet is 1.

lagtime.zip

the output doesn't reach the target all the way because of the float resolution of making lag~ using Pd vanilla objects with only single precision floating point (aside from the theoretical exponentials never reaching their value) but I suppose that's the case with lop~ also..
the table has the "downward" lag 60db time @ 0 and the "upward" time at 1 in the "time" array

• This is beautiful! Wow, thank you so much for putting together lagtime. I'm very clueless on [rzero]

I was working on some unspeakably bad patches using the same signal patched to both inlets of samphold~

After looking through lagtime - I am coming to terms that there will be a jump once the signal changes from trending in one direction to another- that is, if the output is trailing the input and then the input changes direction - the output will move to the current value at the slew specified by the new direction. I'm dreaming of a system that would adopt the new slew once the output signal caught up to the new value. I just put together a very ugly patch that sort of approaches this using a feedback line.
nonsense.pd

This was a funny patch to put together. Comparing a signal with the positive value of a delay line and adjusting the feedback to chase the signal. Am I asking for trouble with this method?

• @LarsXI Might be a job for some of the signal-rate binops from the zexy library?
See [zigbinops-help].
You might also find [iemlib/peakenv_hold~] useful as it will operate only when the incoming signal starts to fall...... with hold and release for the downward slew settable in the signal-rate object.
This sort of does what you want (I think... but can be wrong of course) and no delay required.
The plot will show "jumps" from impossible settings......
slew.pd
David.

• Hi David, Awesome! I like the peakenv_hold~ patch. I need to get serious and finally install Zexy.

I'm going to hit my old patches and work out what sounds best, now that I have the method

Posts 9 | Views 5311
Internal error.

Oops! Looks like something went wrong!