Last active
August 6, 2021 11:25
-
-
Save jpcima/eb4d36a3e77096919688dd22ecc18d20 to your computer and use it in GitHub Desktop.
Linear smoother
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import("stdfaust.lib"); | |
// a linear smoother | |
lfsmooth(tau, flush, tgt) = | |
((+:(_,tgt):select2(flush))~_)~((tgt-_)<:(abs,(/(tau*ma.SR):(select2(sc)~_):abs),_):(min,_):copysign) | |
with { | |
sc = (tgt!=tgt')|(tau!=tau'); | |
copysign(x,s) = abs(x)*select2(s<0.0,1.0,-1.0); | |
//copysign = ffunction(float copysignf|copysign|copysignl(float,float),<math.h>,""); | |
}; | |
lsmooth(tau) = lfsmooth(tau, 0); | |
process = lsmooth(t,x) with { | |
x = hslider("[1] target",0.0,-1.0,1.0,0.001); | |
t = hslider("[2] time",0.1,0.0,1.0,0.001); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment