Main Archive Specials Wiki | FAQ Links Submit Forum

fold back distortion

Type : distortion
References : Posted by hellfire[AT]upb[DOT]de

Notes :
a simple fold-back distortion filter.
if the signal exceeds the given threshold-level, it mirrors at the positive/negative threshold-border as long as the singal lies in the legal range (-threshold..+threshold).
there is no range limit, so inputs doesn't need to be in -1..+1 scale.
threshold should be >0
depending on use (low thresholds) it makes sense to rescale the input to full amplitude

performs approximately the following code
(just without the loop)

while (in>threshold || in<-threshold)
// mirror at positive threshold
if (in>threshold) in= threshold - (in-threshold);
// mirror at negative threshold
if (in<-threshold) in= -threshold + (-threshold-in);

Code :
float foldback(float in, float threshold)
if (in>threshold || in<-threshold)
in= fabs(fabs(fmod(in - threshold, threshold*4)) - threshold*2) - threshold;
return in;


Added on : 17/06/11 by nikolatesla20[ AT ]yahoo[ DOT ]com
Comment :
Sounds really good              

Add your own comment
Comments are displayed in fixed width, no HTML code allowed!


Are you human?

Site created and maintained by Bram
Graphic design by line.out | Server sponsered by fxpansion