Hi,

Forgive me if this is a silly question, but I am working on a distortion plugin and want to keep the output signal the same as I increase the distortion amount. E.g. so the tone of the sound changes, but the volume remains constant.

I am using y[n] = tanh(k * x[n]) / tanh(k) as the distortion formula.

I there a way to do this? I'm not quite sure if this falls into compression category?

I have a feeling like I am missing something easy like multiplying by the inverse of k (which it isn't, as I have tried).

Cheers

Equalizing the amplitude alone won't work. You need to equalize the **power** of the signal. For example, listen to a sine wave and square wave with identical peak-to-peak amplitudes. The square wave will sound louder because of its power, not its amplitude.

The equation to use is called the "2-norm" and is from basic Signals and Systems theory. You can also find it as a discrete power calculation. When dealing with known signals like sine and square, calculating the attenuation factor to normalize the power is pretty easy so that the square and sine sound the same.

The waveshaper you are using looks like it is from the Synth book. BTW: dividing the equation by tanh(k) is my own thing - it ensures that the output will always be bounded on [-1.0, +1.0] and I have not seen anyone else do that kind of normalization.

However, even with that bounding, the area under the curve will produce RMS power levels greater than unity.

So what you are trying to accomplish turns out to be a lot more involved than simple scaling factors. With that said, since the waveshaper equation is known a-priori, then you should be able to theoretically calculate its power amplification factor.

If you google '2-norm signals and systems' you'll get a bunch of hits describing it. Note that there are two versions: one for analog (involving integrals) and one for discrete time (involving simple summations - much easier).

- Will

Hi Will,

Thanks for pointing me in the right direction, I will look into 2-norm signals and systems.

You are right, I am referencing the synth book - its great! I picked it up recently, however rather than implementing the projects in RackAFX I aim to work with ASPiK. Starting with a Wave shaping plugin.

I'm looking forward to your new book as i'm sure it will make my life much easier in that regard.

Will you have distortion projects in the new book by any chance?

cheers

The new book does have a chapter dedicated to non-linear processing for distortion and other stuff. There is also a section on vacuum tubes.

In the original manuscript, the vacuum tube chapter was 3x as long as the others (80 pages, just for one chapter), so I had to chop a bunch of stuff out regarding vacuum tube theory (and the equations). The resulting tube-projects are very VERY basic (to be honest, a whole other book could be written just on that).

However, I am planning on having online chapter addendums for several sections that I had to chop down for the page count to remain sane.

There will be a fairly substantial addendum posted to accompany that Chapter (in fact, I am working on that this weekend).

Glad to hear you are refactoring the projects for ASPiK. If you would like to share them I am sure you would have plenty of interested parties!

- Will

Most Users Ever Online: 55

Currently Online:

10 Guest(s)

Currently Browsing this Page:

1 Guest(s)

Top Posters:

Skyler: 48

Derek: 46

Frodson: 45

Peter: 41

clau_ste: 39

TheSmile: 37

JimmyM: 33

Gwen: 32

EZB: 24

lppier: 23

Member Stats:

Guest Posters: 1

Members: 565

Moderators: 1

Admins: 4

Forum Stats:

Groups: 12

Forums: 36

Topics: 581

Posts: 2326

Newest Members:

frankthetank, dhodgson, Wanderer, mister1234, Evan Galvanek, Rowan Fraser, patrickbarr1984, Ray C., Jon R., PatModerators: W Pirkle: 344

Administrators: Tom: 69, JD Young: 80, Will Pirkle: 0, W Pirkle: 344