# reduce harmonics produced by microcontroller

I'm generating an 18kHz sine signal using a dsPIC microcontroller at 44100kHz (I'm not sure I can call it sampling rate, maybe generation rate, although the concept is the same). The dsPIC's DAC then feeds an LM386 amplifier and then an 8-ohm speaker.

Since the generation method is digital, I get harmonics (36kHz) which get aliased, and I hear the parasitic low frequency (8.1kHz) which is something I wish to get rid off.

I was told that I should put an LPF with a sharp cutoff just above 18kHz at the output of the microcontroller so that those high frequency harmonics don't get amplified, but my intuition tells me that I should put an HPF, since by the time the signal is out of the microcontroller it already contains those low frequencies and an LPF will not help.

Am I correct? Thanks!

-
Another possibility is a analog hi-Q narrow-band filter (essentially a damped oscillator) centered at exactly 18 kHz to get rid of both the harmonics and any aliases. –  hotpaw2 Jan 27 '13 at 22:15
I was talking about an analog filter...not a digital one. I'm not sure Paul's answer applies in this case. –  Daniel Jan 28 '13 at 8:04