April 26, 2015
I tried to implement a Chebyshev waveshaper according to the description on the bottom post here:
The algorithm looks similar to this one here:
The results is that with any odd order setting it sounds good, the higher the order the louder and more distorted.
But with the even order settings the results sound strange, some thin filtered sound, a ringing sound lying over everything and the output meter shows complete overdrive.
Any idea what the problem is?
January 28, 2017
Chebychev waveshaping is tricky. The Chebychev polynomials can create harmonic components, but only when processed on a pure sinusoid of unit amplitude (range of [-1,+1]). When the sinusoid is not unit amplitude, the harmonics are not properly produced, and you almost always wind up with horrible DC offsets. As you increase the order, the problem usually gets worse and of course the aliasing becomes horrendous. I only use Chebychev waveshaping for synthesis to produce a desired harmonic envelope using a unit amplitude sinusoid as the stimulus. I've never gotten acceptable results using Chebychev waveshaping on non-sinusoidal signals such as audio or speech. The DC offsets in particular are evil.
Instead, I prefer the waveshapers in my Synth book, Arraya, tanh(), arctan() and sigmoid but using two separate shapers, one for the + part and one for the - part of the incoming waveform. This allows you to distort the signal symmetrically or asymmetrically, and can produce even, odd, or a mix of harmonics. For example, using tanh, you could do the following:
y(n) = tanh(kx(n))/tanh(k)
The "k" value is what I call "saturation" as it amplifies the signal prior to the shaping (the tanh(k) in the denominator normalizes the transfer function as per the synth book). Setup a plugin and allow the user to change k from 0.2 to 5 using a slider (you can play with the range too, but above 5 tends to be too distorted for me).
First, allow the user to control the k value and look at what this does in the RackAFX spectrum analyzer.
Next, setup two sliders with two separate k values, such as k1 and k2. Then, test the polarity of the signal x(n) and waveshape each half with its own k value.
if(xn >= 0)
yn = tanh(k1*xn)/tanh(k1);
yn = tanh(k2*xn)/tanh(k2);
Use the oscillator in RackAFX and apply a sinusoid, then manipulate the two k values to obtain odd, even or mixed harmonics.
Once you have that working, then you can cascade waveshapers in much the same way a tube preamp works, where you will attenuate the signal in between the cascaded shapers. I'm currently working on a plugin to emulate the Boss Metal Zone pedal using this technique with excellent results.
You will also need to deal with aliasing, either using oversampling as in my App Note, or bandsplitting the signal and only shaping the lower frequency components (which is what I am doing in my Metal Zone plugin).
April 26, 2015
thank you for your detailed answer..
I already realized I had DC in the result and I had to add the original signal to the polynomials when working with even orders to keep the fundamenal wave shape. I calculated the DC off and halved the result and now it's ok.
However I don't know how good the results are in terms of harmonic content. I still have to analyze it.
I will definitely try your waveshapers. I already tried your waveshaper plugin some days ago, but I haven't understood it yet. I have to get into it deeper later when time allows...
Most Users Ever Online: 36
Currently Browsing this Page:
Guest Posters: 1
Newest Members:sam, annaharris, Marie Weaver, kev, Steven, Mr Anderson, mguy, omelc
Moderators: W Pirkle: 143
Administrators: Tom: 65, JD Young: 80, Will Pirkle: 0, W Pirkle: 143