Avatar

Please consider registering
Guest

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
Avatar
tomkin
Member
Members
Forum Posts: 4
Member Since:
April 26, 2015
sp_UserOfflineSmall Offline

Hi,

I tried to implement a Chebyshev waveshaper according to the description on the bottom post here:
http://dsp.stackexchange.com/q.....-to-signal

The algorithm looks similar to this one here:
http://www.juce.com/forum/topi.....ger-plugin

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
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 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);
else
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
Avatar
tomkin
Member
Members
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!
Thomas

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: 47

Peter: 41

Derek: 41

clau_ste: 39

Frodson: 38

Gwen: 32

EZB: 24

lppier: 23

Msaldaña: 18

Jorge: 17

Member Stats:

Guest Posters: 1

Members: 476

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 30

Topics: 482

Posts: 1876

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