--- pvoc-0.1.4/stretch.cc 2004-03-24 12:14:35.000000000 -0500 +++ pvoc-0.1.4.new/stretch.cc 2004-03-24 14:46:22.000000000 -0500 @@ -453,7 +453,7 @@ f = interleaved + i; for (int j = 0; j < decfac.out; ++j, f += channels) - *f = buffer[j]; + *f = f_clamp (buffer[j], -1.0f, 1.0f); } if (write) --- pvoc-0.1.4/basics.h 2004-03-24 12:12:00.000000000 -0500 +++ pvoc-0.1.4.new/basics.h 2004-03-24 14:52:58.000000000 -0500 @@ -133,4 +133,18 @@ return (float) random() / (float) RAND_MAX; } +static inline float f_clamp(float x, float a, float b) +{ + const float x1 = fabs(x - a); + const float x2 = fabs(x - b); + + x = x1 + a + b; + x -= x2; + x *= 0.5; + + return x; +} + + + #endif /* _BASICS_H_ */