Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Chebyshev waveshaping
No permission to create posts
May 21, 2015
6:20 pm
Forum Posts: 4
Member Since:
April 26, 2015
sp_UserOfflineSmall Offline


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?

May 23, 2015
7:03 pm
W Pirkle
Forum Posts: 187
Member Since:
January 29, 2017
sp_UserOfflineSmall Offline

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).

- Will

May 27, 2015
11:54 am
Forum Posts: 4
Member Since:
April 26, 2015
sp_UserOfflineSmall Offline

Hi Will,

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...

Thank you!

Forum Timezone: America/New_York

Most Users Ever Online: 36

Currently Online:
3 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 48

Derek: 41

Peter: 41

Frodson: 40

clau_ste: 39

Gwen: 32

EZB: 24

lppier: 23

Msaldaña: 18

JimmyM: 17

Member Stats:

Guest Posters: 1

Members: 495

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 31

Topics: 511

Posts: 1966

Newest Members:

CoraDias, Edoardo, knooierd, daniel, Merril Bradshaw, BillPlunkett, Pajczur, michaelwayneharwood, RickM, rainbow wind

Moderators: W Pirkle: 187

Administrators: Tom: 66, JD Young: 80, Will Pirkle: 0, W Pirkle: 187