That's the kind of answer I was looking for. Could you elaborate how it is derived? I couldn't understand how 64Khz is found and the source of the -6dB/octave fall-off assumption. Thanks.Fortunately, since it's massively distorting, you kind of don't care about the aliasing, but you can run the numbers anyway. Say your input has significant content at 10KHz (but not much above that), and you want audible aliases down 36dB. 6 octaves of falloff gets you that, so 8x oversampling should do you. (10K + 6 octaves is 640KHz, reflections start at 8 x 44K = 352K, 640K reflected at 352K -> 64KHz is the -36dB point).
Antialias for waveshaping - needed?
-
- KVRAF
- 2256 posts since 29 May, 2012
OK now that we have clarified the misunderstandings about the infinite gain formula, ... perhaps we can return to the subject.
~stratum~
- KVRAF
- 3426 posts since 15 Nov, 2006 from Pacific NW
I think you will find that there is more than a trace of soft clipping in any physical guitar amp. Tubes and semiconductors obey the laws of physics, and have soft saturation. Slamming a soft saturating circuit or function will still result in a smoothed transition between the "linear" part of the output signal and near-infinite clipping, and this smooth transition makes a big difference in the digital implementation, even if it barely shows up on a scope.stratum wrote:That's not the actual function that I use, but actual guitar amps have lots of gain, so the end result will be something like that even though I guess an aliasing free software implementation will be a bit tricky. A softclipping function hit by a strong signal is not supposed to be very different from the formula above I guess, regardless of the actual shape of the clipping function. That's what actual guitar amp circuits roughly do, frankly. So there isn't even a trace of soft clipping in an actual tube amp of the "modern" variety (as long as you use the modern sounding highgain channel and max the gain knob, that is). Some of them even have a pair of diodes as the clipping circuit to achieve the same result with less complex circuitry.AdmiralQuality wrote:Hard clipping with infinite gain? All the oversampling in the world won't hide the aliasing you'll get from that!stratum wrote: y = x>0 ? 1 : -1
A lot of the estimates of "what order polynomial + how many times oversampling" are needed to avoid aliasing don't take into account the sheer gain of guitar amp emulations. A polynomial approximation of a sigmoid function is usually bounded by hard clipping, and a high gain guitar circuit will spend the majority of its time in the hard clipping zone. Nevertheless, the smoothness of the transition makes a big difference when it comes to aliasing and the overall sound.
The pair of diodes you mention in some modern guitar amps can be modeled by tanh(). Don't let the smoothness of tanh() fool you. If you have an input signal with a range of (-100, 100) feeding into tanh(), you'll still get something really close to hard clipping. It will just be a better behaved "hard clipping" for digital models.
Sean Costello
-
- KVRAF
- 2256 posts since 29 May, 2012
Yeah, I was thinking about the overall circuit, individual circuit components do of course behave that way. But the overall circuit has so much gain that it looks like an hardclipping function (+ some pre&post distortion EQ) if you consider it as a black box, even though that's a very crude approximation.I think you will find that there is more than a trace of soft clipping in any physical guitar amp. Tubes and semiconductors obey the laws of physics, and have soft saturation.
I guess you mean it makes a difference in the amount of aliasing that occurs, right?Slamming a soft saturating circuit or function will still result in a smoothed transition between the "linear" part of the output signal and near-infinite clipping, and this smooth transition makes a big difference in the digital implementation, even if it barely shows up on a scope.
Finally someone understands what I mean:) Yes basically that's the issue, because that's exactly what's happening in actual circuits.The pair of diodes you mention in some modern guitar amps can be modeled by tanh(). Don't let the smoothness of tanh() fool you. If you have an input signal with a range of (-100, 100) feeding into tanh(), you'll still get something really close to hard clipping.
I dont know much about the math of these polynomials & aliasing, but the result still isn't difficult to guess. Yes there is aliasing, but how much?
~stratum~
-
- KVRAF
- 2460 posts since 3 Oct, 2002 from SF CA USA NA Earth
I derived it by trial and error rather than by algebra, because that's how I roll, but:stratum wrote:OK now that we have clarified the misunderstandings about the infinite gain formula, ... perhaps we can return to the subject.
That's the kind of answer I was looking for. Could you elaborate how it is derived? I couldn't understand how 64Khz is found and the source of the -6dB/octave fall-off assumption. Thanks.Fortunately, since it's massively distorting, you kind of don't care about the aliasing, but you can run the numbers anyway. Say your input has significant content at 10KHz (but not much above that), and you want audible aliases down 36dB. 6 octaves of falloff gets you that, so 8x oversampling should do you. (10K + 6 octaves is 640KHz, reflections start at 8 x 44K = 352K, 640K reflected at 352K -> 64KHz is the -36dB point).
Pretend your input signal is a single pure sine tone at frequency F. Your infinite-gain hard-clip turns that into a non-bandlimited (aliasing) square wave with fundamental frequency F. Square wave contains harmonics which fall off at 6dB per octave. A real input signal is more complex than this, of course, but for discussion purposes I think it's reasonably safe to analyze it using just the highest frequency component you care about.
I mixed up sampling rate and Nyquist rate in my earlier post, so pretend I said 16x oversampling rather than 8x.
6 octaves above 10KHz is 640KHz, so at 640KHz the signal is 36dB down from the fundamental. 16x oversampling in a system with a basic sampling rate of 44KHz puts the effective Nyquist limit at 22KHz * 16 = 352KHz. Your 640KHz alias is above that, so it "reflects" at 352KHz. Subtract the 352K from the 640K and you're left with 288K worth of partials coming back down from the 352K; 352K-288K is 64KHz.
So you know any frequencies lower than 64KHz (i.e. aliases of frequencies *above* 640KHz), including the audible range below 20KHz, are therefore more than 36dB down.
Note that changing your assumptions can change the answer drastically. If you want 4KHz components to alias less than -24dB, 2x oversampling might be enough. If you need your 15KHz components to go through with less than -60dB aliasing, you need like 350x oversampling.
-
- KVRAF
- 2256 posts since 29 May, 2012
Thanks, now it makes sense. As far as the assumptions are concerned I think the input signal bandwidth can be limited to 5-6Khz without losing much content that actually matters. For lower gained amp models where the player can control the transition between clean-overdriven tones by picking lighly or hitting strings hard, a little more bandwidth may be desirable.Borogove wrote:stratum wrote:OK now that we have clarified the I derived it by trial and error rather than by algebra, because that's how I roll, but:
Pretend your input signal is a single pure sine tone at frequency F. Your infinite-gain hard-clip turns that into a non-bandlimited (aliasing) square wave with fundamental frequency F. Square wave contains harmonics which fall off at 6dB per octave. A real input signal is more complex than this, of course, but for discussion purposes I think it's reasonably safe to analyze it using just the highest frequency component you care about.
I mixed up sampling rate and Nyquist rate in my earlier post, so pretend I said 16x oversampling rather than 8x.
6 octaves above 10KHz is 640KHz, so at 640KHz the signal is 36dB down from the fundamental. 16x oversampling in a system with a basic sampling rate of 44KHz puts the effective Nyquist limit at 22KHz * 16 = 352KHz. Your 640KHz alias is above that, so it "reflects" at 352KHz. Subtract the 352K from the 640K and you're left with 288K worth of partials coming back down from the 352K; 352K-288K is 64KHz.
So you know any frequencies lower than 64KHz (i.e. aliases of frequencies *above* 640KHz), including the audible range below 20KHz, are therefore more than 36dB down.
Note that changing your assumptions can change the answer drastically. If you want 4KHz components to alias less than -24dB, 2x oversampling might be enough. If you need your 15KHz components to go through with less than -60dB aliasing, you need like 350x oversampling.
~stratum~

