4 ms·
Hey there, no aliasing in this case. As for the clipping, this is effectively just hard clipping like you'd see from two alternating diodes in series on an anal
by razerbeans 4y ago
Hey there, no aliasing in this case. As for the clipping, this is effectively just hard clipping like you'd see from two alternating diodes in series on an analog gain circuit.
Admittedly, I'm early into moving from analog circuits to digital signal processing, so I could be off the mark on my answer. :) Hope it helps, though.
- valdiorn 4y agoI'm sorry, but waveshaping absolutely introduces aliasing - and I was a bit disappointed to not see a section in that in the post.
- razerbeans 4y agoInteresting, I was under the impression that aliasing was something on the presentation layer (e.g. plotting on an oscilloscope). Have some breadcrumbs/links to share that would be a good resource on understanding aliasing in your context? Would be excited to learn more!
- raphlinus 4y agoHere's a fairly recent paper on techniques to reduce the aliasing: https://www.dafx.de/paper-archive/2016/dafxpapers/20-DAFx-16_paper_41-PN.pdf https://www.dafx.de/paper-archive/2016/dafxpapers/20-DAFx-16...
- TreeRingCounter 4y agoTake a sine wave below your system's Nyquist frequency. Chop off the top. Take the continuous Fourier transform. You will notice that there are now frequency components above the Nyquist limit of your system. Those will now be aliased down to lower frequencies. One trick for doing nonlinear waveshaping without introducing too much aliasing is to perform the wave shaping at a higher sample rate than the rest of your system and then downsampling with a low pass filter. Thankfully, the high frequency components introduced by nonlinearity tend to decrease in magnitude reasonably quickly.
- fluoridation 4y agoHow would simple hard clipping cause aliasing?
- bigbillheck 4y agoClipping adds high-frequency components.
- deleted 4y ago[deleted]
- TreeRingCounter 4y agoTake the fourier transform of a clipped signal - it will have high frequency components. In general, the more pointy edges you introduce to a waveform, the more high frequency artifacts you get. This aspect of pontryagin duality (narrow in one domain means wide in the other) is also what underlies the heisenberg uncertainty principle. If you "hard clip" a photon's position (with a slit) you get a lot of frequency domain (momentum) noise, leading to a spread-out beam.
- Gordonjcp 4y agoIn the analogue realm - or more correctly, in the continuous-time realm, because an analogue sample-and-hold will show the same issues, it doesn't. It just introduces more harmonics at high frequencies. In the digital (or again more correctly discrete-time, you have a sample rate) realm it totally makes a difference, because many of the harmonics you generate will extend above the Nyquist frequency, half the sample rate, and "reflect" back down.
- fluoridation 4y agoWhat I don't get is, isn't that an inevitability of working with a digital signal? That is, if you were to sample a signal that was clipped in continuous time, wouldn't you get the same pattern of samples than if had clipped the signal after sampling?
- diydsp 4y ago
- duped 4y agoWhen you clip in continuous time you're pushing additional energy into the harmonics of the baseband signal being clipped. Since spectra in continuous time is infinite, you don't get any aliasing (a better way to say it is that "aliasing" isn't as meaningful in continuous time) When you clip in discrete time, the spectra is finite (more technically, it's periodic with a period of the sample rate frequency). That means the energy that would go into harmonics past nyquist gets "wrapped" around. This is the big difference between analog and digital distortion. In analog, it's really quite difficult to create energy at non-harmonic frequencies of the signal. In digital clippers like you have here, it's trivial, and the design problem is figuring out how to deal with it. Most products will use some kind of anti-aliasing strategy (usually oversampling before clipping) to handle it.
- TheOtherHobbes 4y agoOversampling won't help with the brickwall clipping being attempted here. This circuit is not a diode emulator, it's a comparator. It's the worst-sounding of all distortions. It sounds even worse in digital because of the aliasing. And it will always alias, no matter how much you oversample it, because a vertical edge - aka "Heaviside Step Function" - has an infinite harmonic series. If you oversample it enough it won't alias much because the series terms become smaller. But they never disappear. A better way to do this kind of clipping is with a tanh (logistic/s-curve) approximation. That can give you a variety of valve-like [1] smooth clipping curves. Unfortunately tanh is pretty expensive computationally, so a more practical alternative is a piecewise curve, perhaps with some interpolation. Although if you only have 8-bit or 16-bit resolution you may as well just use a lookup table. OP might want to consider learning a little more about signal theory and practical DSP before posting more how-tos. [1] Not really because real valves are more complicated. But it will do for a first approximation.
- razerbeans 4y agoI appreciate your feedback and sharing your knowledge! I'll definitely be digging more into some of the things your mentioned to get a better understanding. The topic is a super deep one–though my goal (at least at this point) is to stay high level enough so that anyone could get started in making their own sounds/effects. The lower the barrier of entry, the more cool things that people can come up with! I'm hoping that more without a math/EE/audio background like myself can get started and explore some more of these deeper topics :)
- Gordonjcp 4y agoWhy isn't there any aliasing? You're flattening off the peaks of the signal which absolutely must generate more harmonics, and at some point those are going to extend far beyond Nyquist. I don't see you doing anything in particular to bandlimit your waveshaping, but I might well have missed it.