# Chebyshev waveshaping

I am trying to implement a Chebyshev waveshaper according to the description on the bottom post here:

Add odd/even harmonics to signal?

It looks similar to the algorithm here: http://www.juce.com/forum/topic/voice-changer-plugin

The results for any odd order setting sound good. But all even order results just end up in massive distortion. I also tried x * abs(x) instead of x², but the result is similar. How should I handle the even order terms? Or do I have to use a completely different method for producing even harmonics?

• Could you post the relevant section of your code? – JRE May 22 '15 at 7:37
• What is your input signal? Could overflow be a problem? – Matt L. May 22 '15 at 7:58
• For 2nd order it's simply: outputBuffer[i] = 2 * pow(inputBuffer[i], 2) - 1; – user2561735 May 22 '15 at 8:00
• 4th order: outputBuffer[i] = (8 * pow(inputBuffer[i], 4) - 8 * pow(inputBuffer[i], 2) + 1); – user2561735 May 22 '15 at 8:03
• There are two strange things I discovered in this calculation methods: For a 24bit recording I have 16777216 possible amplitude values. 8388608 negative values, 0 and 8388607 positive values. So the possible interval is [-1, 0.999999881] (1 / (2^24 / 2) * 8388607) ... – user2561735 May 22 '15 at 8:36