# digital contents

Tom May ftom at netcom.com
Thu Sep 19 19:02:40 CEST 1996

Haible_Juergen#Tel2743 <HJ2743 at denbgm3xm.scnn1.msmgate.m30x.nbg.scn.de> writes:

> Hmm, this is not AH, and you *can* build digital filters yourself,
> nowadays, so I would have no problems with this.
> Though I cannot contribute much to this DSP stuff myself,
> I find it very interesting to see you talk about it. I'd appreciate
> it if you go on with this nonlinearities/aliasing stuff.

Ok, take the square law thing Don mentioned, say out = in + in^2.  For
a sine input, the output will contain the original frequency, the
second harmonic, and a DC component.  With more than one frequency in
the input signal, the output will also contain all the f1+/-f2 cross
terms (actually the DC and second harmonic is just a special case for
f1=f2).  So like Don said, it is bandlimited because the highest
output frequency will be no greater than twice the highest input
frequency.  But, if that frequency exceeds half the sampling rate, it
will be aliased and you will hear nastiness.

Here's an example: take a 120Hz sine sampled at 400Hz.  The second
harmonic would be 240Hz, but that exceeds half the sample rate (200Hz)
by 40Hz, so it will be aliased to 200Hz - 40Hz = 160Hz and that is
what you will hear: 120Hz and 160Hz.  The result will not be at all
like the analog case where harmonics that exceed the bandwidth are
merely attenuated; in the digital case they are aliased into the
audible range and you hear them loud and clear.

Here's another example: suppose you implement a distortion by gently
squashing the top and bottom of the wave.  This mostly amounts to
adding in some third harmonic.  No problem in the analog case, you can
draw some nice smooth waves, squash their tops, and you will get a
periodic 100Hz output of some shape or other.  But in the digital
case, it could be that the third harmonic exceeds half the sampling
frequency.  In my example, the 360Hz third harmonic would be aliased
to 40Hz.  That means that although you can get the squashed effect by
adding 360Hz third harmonic, you can get exactly the same effect by
adding a 40Hz signal, and that is exactly what it will sound like.
Your output wave is no longer periodic at 100Hz.

It helps to draw some smooth analog waves, then figure out where the
sample points are and how this all looks digitally.  Sampled waves
don't look like connect-the-dots analog waves at all once they reach a
certain frequency, and that is why analog-based gut feelings don't
count for much.

Tom.