Description

Guitar and Audio technology blog

Saturday 11 December 2010

Chebyshev polynomial soft clipper

After an intial set up with the VST template, the max/msp chebyshev experiment has been repeated adding the harmonics with the polynomials using the VST sdk.  The code from the previous experiment has been modified to give each chebyshev polynomial its own variable which is calculated separately and then mixed (added) together at output.  This seems to produce stronger harmonic content and reduces clipping.  The nature of the chebsyhev polynomials are to scale the output values between 1 and -1.  The first five (including the initial frequency) harmonics are produced and from the waveform the frequency difference can clearly be seen.  The image below contains the effected output waveform above and the original source below.





Code:



void Laneycub10::processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames)
{
       float* in = inputs[0];
       float* out1 = outputs[0];
       float* out2 = outputs[1];

       while (--sampleFrames >= 0)
       {
              float x = *in++;


              float y = ((2 * (x*x)) -1);
              float y2 = ((4*(x*x*x))-(3*x));
              float y3 = (8 * (x*x*x*x)) - (8 *(x*x)) + 1;
              float y4 = ((16 * (x*x*x*x*x)) - (20 * (x*x*x)) + (5*x));
              *out1++ = y + y2 + y3 + y4 + x;
              *out2++ = y + y2 + y3 + y4 + x;

              }

No comments:

Post a Comment