News:

SMF for DIYStompboxes.com!

Main Menu

Diodes hate it

Started by aron, December 22, 2022, 05:28:30 PM

Previous topic - Next topic

niektb

Easy to follow explanation but I feel one critical point is overlooked in the article and that's really something you should take into account: aliasing! Either do fancy waveshape techniques but easier is to increase the sample rate (if that's possible in the DSP)! Makes it sound much smoother!

FSFX

#2
I think that there is another poorly understood aspect of diode clipping that makes it virtually impossible to replicate simply with DSPs.

A lot of people just think of clipping as the slicing off of the top of a sinusoidal wave. Now that in itself is easy to replicate using a DSP, even taking account of the rounding that may occur at clipping. But a guitar signal is a complex waveform that is a combination of many harmonically related partials which decay over time as well as including some inharmonic partials that also decay over time.

The non-linear forward curve of the diode during and before clipping causes the multiplication of these to produce intermodulation products that are both harmonically related and inharmonically related to the fundamental frequency of the string.

Getting a DSP to produce these in a similar way to diodes in clipping is probably impossible to do.

These two chapters from the book 'The Physics of the Electric Guitar' describe what is really going on.

https://www.gitec-forum-eng.de/wp-content/uploads/2020/09/poteg-8-2-5-inharmonicity.pdf

https://www.gitec-forum-eng.de/wp-content/uploads/2019/02/poteg-10-08-05-distortion-devices.pdf


potul

Quote from: FSFX on December 23, 2022, 04:39:29 PM
The non-linear forward curve of the diode during and before clipping causes the multiplication of these to produce intermodulation products that are both harmonically related and inharmonically related to the fundamental frequency of the string.
I guess that if instead of cutting the signal at a certain threshold we could come up with a function that replicates this diode non-linearity we should be there. It doesn't seem like an "impossible" task for DSP.

Mark Hammer

I would also add that it is not so much the ability of DSP to emulate diode clipping, as much as the manner in which such clipping changes in response to the moment-to-moment changes in the signal and its own harmonic content, as well as amplitude, and "note density" (spaced vs clustered notes).  Conceivably, current technology is up to the task, or will be soon enough.  What lags is our understanding of how to translate what we hear and understanding into algorithms that can reproduce it.

Dormammu

Quote from: potul on December 29, 2022, 03:33:11 AM
I guess that if instead of cutting the signal at a certain threshold we could come up with a function that replicates this diode non-linearity we should be there. It doesn't seem like an "impossible" task for DSP.
Digital technologies provide unlimited possibilities. There are zillionbytes of sound streaming across the internetS and it all sounds great.    ;)

ElectricDruid

Quote from: Dormammu on January 20, 2023, 10:24:42 AM
There are zillionbytes of sound streaming across the internetS and it all sounds great.    ;)

Well, not *all* of it!! ;)

</grumpy old man>

Dormammu

Quote from: ElectricDruid on January 20, 2023, 01:19:50 PM
Well, not *all* of it!! ;)
If we are talking about a well-made product — all sounds great.
(Leaving artistic value aside)   ;)

Digital Larry

Start on page 43 of this document.  Everything is explained.  How clearly, I'm not so sure as it's mostly over my head.

https://ccrma.stanford.edu/~dtyeh/papers/wdftutorial.pdf
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

FSFX

#9
Quote from: Digital Larry on January 21, 2023, 11:01:15 AM
Start on page 43 of this document.  Everything is explained.

But Larry, from what I understand from that and what is usual with these things, it only seems to consider the case of clipping a single sinusoidal waveform rather than the complex waveform of a guitar that can contain many harmonically related and inharmonic components .

This is also an interesting thesis for those who are into this type of thing.

https://ccrma.stanford.edu/~dtyeh/papers/DavidYehThesissinglesided.pdf

Digital Larry

Quote from: FSFX on January 21, 2023, 11:14:30 AM
Quote from: Digital Larry on January 21, 2023, 11:01:15 AM
Start on page 43 of this document.  Everything is explained.

But Larry, from what I understand from that and what is usual with these things, it only seems to consider the case of clipping a single sinusoidal waveform rather than the complex waveform of a guitar that can contain many harmonically related and inharmonic components .
Not sure where you get that.  This is just talking about mathematically representing nonlinearities.  The word "sine" appears nowhere in that document.

Yes I do understand that engineering is full of references to sine waves, which is relevant to linear circuit analysis as the math is greatly simplified.  In this case they represented a dual diode nonlinearity by a "sinh".  Why?  Because we can solve that.  Is it really the way diodes work?  Maybe "close".
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

Rob Strand

#11
QuoteYes I do understand that engineering is full of references to sine waves, which is relevant to linear circuit analysis as the math is greatly simplified.  In this case they represented a dual diode nonlinearity by a "sinh".  Why?  Because we can solve that.  Is it really the way diodes work?  Maybe "close".

When you have a clipper one diode is forward biased and the other is reversed biased.

The forward diode characteristic is

              I(V) = I0*(exp(V/(n Vt)) - 1) ~ I0*exp(V/(n Vt))   ;where n = 1 to 2 and Vt is the 25.8mV thermal voltage.

For a clipper you need to handle the case where the voltage is positive or negative.

                  Ipos(V) =  I0*exp(V/(n Vt));  V > 0
                  Ineg(V) =  - I0*exp(-V/(n Vt));  V < 0

IF we plug in a negative voltage into Ipos(V) then we get a small number so instead of having a function which switches forms at V=0 we can add the two to get a total clipper current for a given applied voltage V:

               I(V) = Ipos(V) + Ineg(V) = I0*exp(V/(n Vt)) - I0*exp(-V/(n Vt))

The *hyperbolic* sine function is  sinh(x) = (exp(x) - exp(-x))/2
which has the same form.

https://www.mathsisfun.com/sets/function-hyperbolic.html

So all they are saying is the sinh(x) function is a good approximation for a clipper.

Notice that the *input* argument is the diode voltage and the result is the diode current - opposite to what people are used to thinking.

Quote
Start on page 43 of this document.  Everything is explained. 

So page 42 gives the sinh() form for the clipper.  Then all page 43 is doing is solving the currents and voltages in the circuit.  We need clipper voltage Vo for a given input voltage Vi, account for the fact the 2k2, 0.47u and 10n components are present.   The behaviour of the those linear parts are modeled with the rest of the equations - the picture to the left of page 43 breaks down "connections".    The maths effectively works out the voltages and currents in the circuit.

The maths doesn't assume anything about the waveform.   The whole idea is wedging a non-linear part like a clipper into a linear model.

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.