Oh, here's a version that actually works, and without the one sample delay:
amp_follower_ar(att,rel) = abs <: ((>,at,rt:select2),_:smooth) ~ _ with { at = tau2pole(att); rt = tau2pole(rel); }; And simplified, a bit more generic: /***************************************************** lag_ud(up, dn, signal); Lag filter with separate times for up and down. *****************************************************/ lag_ud(up,dn) = _ <: ((>,tau2pole(up),tau2pole(dn):select2),_:smooth) ~ _; /Jonatan On Sun, Jan 18, 2015 at 4:08 PM, Jonatan Liljedahl <li...@kymatica.com> wrote: > Hi! > > Here's my take on an envelope follower with truly separate attack and > release times. The release can be shorter than the attack, which is > not possible with amp_follower_ud from effect.lib > > However, it has a built-in delay of one sample. I had to add that > since the detected state (going up or down) is already delayed, and we > can't allow any samples into the env filter that doesn't belong to the > new state (not sure if I'm making myself clear here..) > > Any ideas for improvements? > > /***************************************************** > amp_follower_ar(attack, release, signal); > > Like amp_follower_ud, but allows release times that are shorter > than attack time. > Has a delay of one sample. > *****************************************************/ > > amp_follower_ar(att,rel) = abs <: ((_,_,_ <: > ((_,at,rt:select2),mem:env),_ <: >,_,!) ~ _) : !,_ with { > env(p,x) = x * (1.0 - p) : + ~ max(x,_) * p; > at = tau2pole(att); > rt = tau2pole(rel); > }; > > > -- > /Jonatan > http://kymatica.com -- /Jonatan http://kymatica.com ------------------------------------------------------------------------------ New Year. New Location. New Benefits. New Data Center in Ashburn, VA. GigeNET is offering a free month of service with a new server in Ashburn. Choose from 2 high performing configs, both with 100TB of bandwidth. Higher redundancy.Lower latency.Increased capacity.Completely compliant. http://p.sf.net/sfu/gigenet _______________________________________________ Faudiostream-devel mailing list Faudiostream-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-devel