Take the 2-minute tour ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

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!

share|improve this question
    
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
add comment

1 Answer 1

up vote 1 down vote accepted

No, you need a low pass filter aka reconstruction filter.

In the general case your filter needs to reject everything at or above Nyquist = Fs/2 = 22.05 kHz. Typically it might have have a roll-off from say -3 dB at 20kHz to -80 dB at 22 kHz. This would be quite a demanding filter to implement with analogue components however, so if you are really only interested in generating a single tone at 18 kHz then you can use a less aggressive LPF which has a -3 dB point at say 20 kHz and a stop-band which begins at 35 kHz.

share|improve this answer
    
Just to clarify, I was talking about an ANALOG LPF! not a digital LPF inside the dsPIC, does your answer still apply? –  Daniel Jan 28 '13 at 8:03
    
The A-D lowpass filter is the anti-aliasing filter. On the output side, the LPF is a reconstruction filter that can be thought of as interpolating between samples or as recovering the baseband content of the sampled output (which happens to be a form of PAM). If you have aliasing prior to the D-A, it is too late to get rid of it using a lowpass filter. An analog narrow band, bandpass filter works because it will capture the base band frequency and eliminate aliasing components which may be below the cutoff of the reconstruction LPF. –  user2718 Jan 29 '13 at 13:56
    
@Bruce: thanks for the correction - terminology updated in answer above. I'll delete my comment above though as that can't be edited. –  Paul R Jan 29 '13 at 15:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.