Diode module?

Is there a module than can act just like a diode…keeping positive or negative only?

Thank you in advance…

I don’t know. But you can emulate it with a comparator and VCA

1 Like

There are several rectifiers.

2 Likes

If you just want the rectification Count Modula Rectifier, If you want the realistic sound of a physical diode there is something in the airwindows suite for that.

1 Like

the surge xt wave shaper has half wave rectifiers which have some tricks to do alias suppression too.

2 Likes

The Venom WinComp Min and Max outputs can also do half wave rectification, with an option for alias suppression via oversampling/band limiting. Actually pretty much all rectification variations are available with the option of oversampling

1 Like

I’m not sure that “diode” quite the right device. :thinking: Ideal diodes block electrical current in one direction, and pass it in the other. There isn’t any “current” metaphor in Rack, as far as I can recall.

Or is there?

Skew limiters and accumulators (and envelope followers?) exhibit behaviours like some diode+capacitor+resistor circuits.

2 Likes

Thank you all for solutions…I will try them :+1:

In this case I took diode to mean “pass positive voltages and block negative voltages” even though a circuit with that behavior would require a resistive load in addition to a diode to turn voltage into current - which is why I think a few of us thought of rectifiers

The surge rectifier doesn’t simulate the leakage you would get from a real diode but the diode model in the surge ring modulator effect does. I guess I could make that curve a standalone wave shaper one day but I don’t think it is that useful in the wave shaper context

The Squinky Labs “Shaper” has been around forever, and it does full and half wave rectification, almost no aliasing, AC/DC coupled.

Several of you have mentioned aliasing.

Why does rectification cause aliasing? Is it because it distorts the signal or is it (also?) something specific about rectification itself?

This post is going to hand wave a lot and make approximations to build intuition. The math is trickier. If you also know the math and disagree with the handwaving please be nice :slight_smile:

so intuitively you get aliasing when your discrete representation and your underlying continuous one have mismatches that create non-harmonic artifacts. This happens mostly when you mistake the samples to exactly represent the continuous signal. The classic example is not using enough points to represent a sin wave but there are plenty others.

So if you think about half wave rectification as signal = (signal > 0 ? signal : 0) and think about what happens when your signal crosses zero in between samples. Take the case of a simple exact digital triangle for instance which crosses 1/4 of the way through the sample.

So the prior sample is -0.05 and the next sample is 0.15, roughly.

If you approximate that prior sample as 0 and the current one as 0.15 you get, at the onset, the “true” signal plus that little weird ramp to make it match the line segment.

So what do you do? Well lots you can do. You can instead of just outputting samples you can use impulses which are band limited (so rather than output 0.15 you output a sinc). Or you can use other smoothing - surge uses a first order ADAA in the wave shapers (second in the modern osc) - or you can upsample and downsample. All these amount to forms of filtering to make the output signal, given the constraints of discretization, match the intended signal more closely.

Rectifcation is particularly tricky because that "corner’ at 0 is very sharp. Those sharp corners are one source of aliasing. This is why a naive saw (phase < 0.5 ? 1 : -1) sounds so terrible. Those little missing samples when the representation contains factors from both the up and down state are super important.

Rectification is like that too.

1 Like

Many thanks, but I’m not quite there yet. I don’t know what this means?

If the signal is greater than zero use the signal value, otherwise use zero.

3 Likes

Thanks both. So, full wave rectification produces even more of a problem than half wave rectification due to that sharp angle?

Also, ADAA took some finding (I assumed analog and digital at first) - antiderivative anti-aliasing? As in here? (maths is beyond me):

https://ccrma.stanford.edu/~jatin/Notebooks/adaa.html

Yes sorry exactly that. Basically to generate a signal take the nth numerical derivative of its nth analytic integral. That has some rather nice Alias suppression techniques

The surge wave shapers are all simd code so hard to read but if you want I can point you at it

1 Like

If I could be a bit less correct, maybe it would be easier to understand.

Any processing of a signal that is “non linear” (which I won’t define) will generate a series of harmonics up to infinity. This can not be captured digitally, so instead the harmonics reflect back into the audio range with weird pitches that are no longer harmonics.

Where does this tend to crop up in a synth module? Well, any thing that “clips” a signal, like any “distortion”, especially clipping and rectification, but including any kind of distortion, overdrive, etc…

Also, any naïve processing of a waveform inside a VCO, including infinite ramp to saw (done internally in many/most VCOs), saw to pulse, FM, “sync”, “arbitrary waveform generation”.

The result is that either the author knows what they are doing and reduces this (and greatly increases the complexity), or they make modules that are full of clearly audible aliasing.

While far from a masterpiece, I have a very old paper on this that is also not particularly technical (or accurate). https://github.com/squinkylabs/Demo/blob/main/docs/aliasing2.md

1 Like

Useful document

Interesting you think of non linearities (which you don’t define). I always think of the discretization (which I don’t define :slight_smile: ) as causing it. Basically when you make up stuff to approximate what happens between the samples you have to realize they have a spectrum. But you do indeed do that with discontinuous signals, signals near Nyquist, sharp corners etc and the broad class of transforms which are not linear.

Thanks Bruce. Pitched very much at my level! However, I appreciate the working out provided by Paul, which challenged me to go and search for stuff too!

1 Like

Yeah, maybe it depends if you make more clippers, or more vcos? Maybe they are both non linearities? But (now that I know your lingo) it’s probably useful to have both concepts in your brain? Of course the reality is that “you just know” when it will rear its ugly head.