Antialias for waveshaping - needed?
-
- KVRer
- 25 posts since 8 Feb, 2011
On this forum and elsewhere I have read about aliasing caused by things like waveshapers, and about countering it with oversampling, filters, or both.
I'm not clear on why any alias is happening, though I am still learning this stuff. Waveshaping is what I am working on, more in the area of guitar tone than a static synth wave.
In the interesting of understanding it better can someone provide me with an example I can implement or some way I can hear that kind of aliasing so I can get an idea of what it is like.
Or is aliasing not an issue for general waveshapers and I'm just misunderstanding?
I'm not clear on why any alias is happening, though I am still learning this stuff. Waveshaping is what I am working on, more in the area of guitar tone than a static synth wave.
In the interesting of understanding it better can someone provide me with an example I can implement or some way I can hear that kind of aliasing so I can get an idea of what it is like.
Or is aliasing not an issue for general waveshapers and I'm just misunderstanding?
Last edited by rootbear on Mon Apr 23, 2012 1:21 am, edited 1 time in total.
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
All sounds can be broken down into harmonics, right? A pure sine wave has only one harmonic, its fundamental frequency. But as soon as we distort its shape in any way, we end up adding harmonics above the fundamental. Because that new shape now needs many sine waves to describe it, where originally it was one.
So for any sound, however complex, when we distort it with some kind of non-linearity we end up creating new, higher-pitched frequencies that are harmonics OF the harmonics that were originally present in the sound. (This is why the sound gets "thicker" with distortion, there's more harmonic content!)
And, some of those new, higher harmonics are probably going to be above Nyquist (half the sample rate). As soon as you do that, pow! Aliasing.
What does aliasing sound like? It sounds like unrelated crap. A particularly good way to hear it is a slowly modulating, siren-like sound. Going up and down in pitch. You'd expect all the harmonics to stay in the same relation to each other, but half of the aliases will actually be shifting pitch in the opposite direction. So to make a good aliasing test-tone, try a very high pitched sine wave that's modulating slowly and widely in pitch (like up and down at least an octave, over several seconds). You'll hear aliasing clearly then if you apply non-linear distortion (waveshaping) of any kind.
Make sense?
So for any sound, however complex, when we distort it with some kind of non-linearity we end up creating new, higher-pitched frequencies that are harmonics OF the harmonics that were originally present in the sound. (This is why the sound gets "thicker" with distortion, there's more harmonic content!)
And, some of those new, higher harmonics are probably going to be above Nyquist (half the sample rate). As soon as you do that, pow! Aliasing.
What does aliasing sound like? It sounds like unrelated crap. A particularly good way to hear it is a slowly modulating, siren-like sound. Going up and down in pitch. You'd expect all the harmonics to stay in the same relation to each other, but half of the aliases will actually be shifting pitch in the opposite direction. So to make a good aliasing test-tone, try a very high pitched sine wave that's modulating slowly and widely in pitch (like up and down at least an octave, over several seconds). You'll hear aliasing clearly then if you apply non-linear distortion (waveshaping) of any kind.
Make sense?
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
rootbear wrote:yeah it is pretty clear with the high pitched sine wave. Thanks.
-
- KVRist
- 231 posts since 15 Apr, 2012 from Toronto, ON
I always liked the wagon wheel analogy. If the rotation period of the wheel exceeds half the cirumference (2pi), we can't tell which way the wheel is rotating, so the "data" gets corrupted in a sense making it look like it's rotating backwards. And this has particular relevance to sound waves as a roating wheel essential generates a sinusoidal wave. So to represent frequencies above half of the sampling rate (Nyquist), would require those frequencies' wheels to rotate faster than 2pi in which case the sound data gets misrepresented in the audio file.
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
Yep. Or just imagine the wheels going backwards on wagons in the old movies. Same reason.LemonLime wrote:I always liked the wagon wheel analogy. If the rotation period of the wheel exceeds half the cirumference (2pi), we can't tell which way the wheel is rotating, so the "data" gets corrupted in a sense making it look like it's rotating backwards. And this has particular relevance to sound waves as a roating wheel essential generates a sinusoidal wave. So to represent frequencies above half of the sampling rate (Nyquist), would require those frequencies' wheels to rotate faster than 2pi in which case the sound data gets misrepresented in the audio file.
Of course, the aliases in the RIGHT direction are all in the wrong places too. But it's easiest to hear the ones going "the wrong way", hence the sine-siren as a great test tone for this kind of thing.
-
- KVRAF
- 8389 posts since 11 Apr, 2003 from back on the hillside again - but now with a garden!
-
- KVRAF
- 2256 posts since 29 May, 2012
So.. how much oversampling is needed? I'm not sure that I hear the difference between 4x and 8x uprsampling from 44.1khz. As sampling rate increases I start to mistrust recursive filters used for modelling preamp EQ's and windowed sinc filters used before downsampling. Using oversampling to avoid aliasing is fine but it seems like a compromise must be made to keep other things sane.
~stratum~
-
- KVRist
- 172 posts since 20 Aug, 2010
I became cautious with that analogy when I heard "what do you mean in movies? They always seem to move backwards when you look at them!" - twice!AdmiralQuality wrote:Yep. Or just imagine the wheels going backwards on wagons in the old movies. Same reason.
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- 4379 posts since 8 Mar, 2004 from Berlin, Germany
hmm - when the wagon starts, they move forward, then stop, move backward, stop again, move forward again, stop, etc. - or not? it's some time ago that i have seen that kind of movie.cheppner wrote:I became cautious with that analogy when I heard "what do you mean in movies? They always seem to move backwards when you look at them!" - twice!AdmiralQuality wrote:Yep. Or just imagine the wheels going backwards on wagons in the old movies. Same reason.
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
Are you guys serious?Robin from www.rs-met.com wrote:hmm - when the wagon starts, they move forward, then stop, move backward, stop again, move forward again, stop, etc. - or not? it's some time ago that i have seen that kind of movie.cheppner wrote:I became cautious with that analogy when I heard "what do you mean in movies? They always seem to move backwards when you look at them!" - twice!AdmiralQuality wrote:Yep. Or just imagine the wheels going backwards on wagons in the old movies. Same reason.
The same effect can happen under old style florescent lights, as they're really blinking on and off 120 times a second. (100 times a second for you 50 Hz power people.) But this effect does NOT happen under normal sunlight because you need a strobe -- i.e. a discreet sampling interval -- to see it with your own eyes. Film and video however have a discreet frame capture rate, just like audio has a discreet sample rate.
Here...
The wheel is obviously moving all the same way, and not suddenly changing direction. The appearance of changing direction, and of different directions for the different parts (the 5 bolts vs. 6 spokes) is aliasing.
(This is also why they used to shun florescent lighting in metal shops. Because it can make a fast spinning machine appear to be moving slowly or even stopped.)
-
- KVRist
- 205 posts since 12 Feb, 2009 from Perú
And why does the inner part of the wheel seems to be spinning independently of the outer part?
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
I already said why. Because the inner part with 5 evenly spaced bolts has a frequency of 5 * rotation speed. And the outer part with 6 evenly spaced spokes has a rotation speed of 6 * rotation speed. So they effectively have different frequencies. And JUST like with audio aliasing, different frequencies will be affected (or should I say, reflected?) in different ways. While some are going up, others are going down.Tzarls wrote:And why does the inner part of the wheel seems to be spinning independently of the outer part?
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- 4379 posts since 8 Mar, 2004 from Berlin, Germany
there are 6 spokes but only 5 screws.Tzarls wrote:And why does the inner part of the wheel seems to be spinning independently of the outer part?


