Author Topic: Diodes hate it  (Read 1474 times)

aron


niektb

Re: Diodes hate it
« Reply #1 on: December 23, 2022, 03:26:50 PM »
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

Re: Diodes hate it
« Reply #2 on: December 23, 2022, 04:39:29 PM »
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

« Last Edit: December 23, 2022, 04:58:41 PM by FSFX »

potul

Re: Diodes hate it
« Reply #3 on: December 29, 2022, 03:33:11 AM »
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

Re: Diodes hate it
« Reply #4 on: January 19, 2023, 02:39:42 PM »
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

Re: Diodes hate it
« Reply #5 on: January 20, 2023, 10:24:42 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

Re: Diodes hate it
« Reply #6 on: January 20, 2023, 01:19:50 PM »
There are zillionbytes of sound streaming across the internetS and it all sounds great.    ;)

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

</grumpy old man>

Dormammu

Re: Diodes hate it
« Reply #7 on: January 20, 2023, 08:03:27 PM »
Well, not *all* of it!! ;)
If we are talking about a well-made product all sounds great.
(Leaving artistic value aside)   ;)

Digital Larry

Re: Diodes hate it
« Reply #8 on: January 21, 2023, 11:01:15 AM »
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

Re: Diodes hate it
« Reply #9 on: January 21, 2023, 11:14:30 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
« Last Edit: January 21, 2023, 11:30:24 AM by FSFX »

Digital Larry

Re: Diodes hate it
« Reply #10 on: January 21, 2023, 11:57:45 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

Re: Diodes hate it
« Reply #11 on: January 21, 2023, 04:50:24 PM »
Quote
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".

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.

« Last Edit: January 21, 2023, 05:12:11 PM by Rob Strand »
Send:     . .- .-. - .... / - --- / --. --- .-. -