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).
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).
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?
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!
Most Users Ever Online: 152
Currently Browsing this Page:
Guest Posters: 1
Newest Members:Jas, Rowan, sojourn, fabhenr, rg1, Niklas, Wutru, Tim Campbell, Danny Jonel, Valentin
Moderators: W Pirkle: 573
Administrators: Tom: 74, JD Young: 80, Will Pirkle: 0, W Pirkle: 573, VariableCook: 3