Tim Goetze wrote on Tue, 23-Mar-2004:

 > pleased to announce the new DSP package 'pvoc'. at its core, it
 > features the CARL phase vocoder.
 > 
 > there are three LADSPA units in this package (Exaggerate, Transpose,
 > Accumulate) plus a commandline utility for time compression and
 > expansion of n-channel audio data streams.
 > 
 > compilation of this package will probably be an even rougher ride than
 > with the initial release of caps (pvoc depends on FFTW3 and sndfile)
 > but i'll be happy to help should you run into problems.

The stretch program was not properly clamping the output from
-1.0 -> 1.0 yielding to terrible cracks upon writing as 16bit
wave files when the output is clipped.  The fact that non-clipping
(but very close to) input yielded clipping output is another issue,
but not crucial.

I've attached a patch that fixes the problem.

Other than that, this sounds pretty darn good compared to soundtouch
(a time domain algorithm) at more extreme stretch factors.

jlc


 
--- 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_ */

Reply via email to