Please consider registering
guest

Log In 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

Topic RSS
How to attenuate output as an inverse of gain?
Keesh
Member
Members
April 19, 2019 - 9:41 am
Member Since: April 19, 2019
Forum Posts: 7
Offline

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

W Pirkle
Admin
April 19, 2019 - 10:00 am
Member Since: January 29, 2017
Forum Posts: 445
Offline

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

Keesh
Member
Members
April 19, 2019 - 10:19 am
Member Since: April 19, 2019
Forum Posts: 7
Offline

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

W Pirkle
Admin
April 19, 2019 - 10:53 am
Member Since: January 29, 2017
Forum Posts: 445
Offline

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

Forum Timezone: America/New_York

Most Users Ever Online: 152

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 48

Derek: 46

Frodson: 45

Peter: 43

TheSmile: 43

clau_ste: 39

JimmyM: 33

Gwen: 32

EZB: 24

lppier: 23

Member Stats:

Guest Posters: 1

Members: 617

Moderators: 1

Admins: 4

Forum Stats:

Groups: 12

Forums: 39

Topics: 652

Posts: 2559

Newest Members:

TheJonDoe, DoubleLiines.com, jmf11, dan, Luke Bilodeau, Carlos_1, ant, marclingk, TheCammen, Hubbert

Moderators: W Pirkle: 445

Administrators: Tom: 74, JD Young: 80, Will Pirkle: 0, W Pirkle: 445