[PD] Implementing "switch-and-ramp" technique to cancel discontinuities

Frank Barknecht fbar at footils.org
Wed May 2 20:56:31 CEST 2007


Hallo,
simon wise hat gesagt: // simon wise wrote:

> That is: the whole example/technique described depends on the  
> assumption that the re-triggered sample starts from zero, it doesn't  
> make sense otherwise.

Well, that's what's keeping me awake ATM: I believe in theory it is
possible, to use the technique to also ramp to new values that don't
start at zero. 

Assuming you have the old control value (envelope) end at time t0 at
value "old[t0] and the new starts at value "new[t0]". The difference
between the two is: "diff = old[t0] - new[t0]"

Now the switch-ramp idea is this: You create a signal "ramp" that at
t0 is exactly the difference between the two signals, and then you add
this to the new envelops: 

 ramp[t0] = old[t0] - new[t0]

which gives: 

 ramp[t0] + new[t0] = old[t0]

without any discontinuity if new[t0] is zero or not. Then you let
ramp[t] fade out to 0 so that after the fade, only new[t] is left.

And now while writing this, I have found the error in my patch: I
didn't do the "old[t0] - new[t0]"  subtraction at all to get the
ramp[t0] value! Because of that, it was of course only working if
new[t0] = 0, because then ramp[t0] simply is equal to old[t0]. 

Attached patch shows switch and ramp correctly in action. Note to "hard
off": Crossfading of course also works, however I was trying to
understand the technique Miller describes. (Now I wonder, if the
description in the book is complete. Miller, do you copy?)

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
A non-text attachment was scrubbed...
Name: switch-and-ramp.pd
Type: application/puredata
Size: 1893 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20070502/5e5f865d/attachment.bin>


More information about the Pd-list mailing list