# How to filter out everything but a single frequency in the time domain?

I'm new to signal processing and would like some insights about the best way to filter simple data without being too computationally intensive.

I have an audio signal and I want to extract a single frequency (21khz) from it.
This frequency represents whether something is on or off.
I figured a simple amplitude threshold would do the trick to guess the on or off state but I can't think of a good way to single it out so I can threshold it.

I thought about doing it in the frequency domain but using the FFT seems a bit overkill.

I'm sorry if this is obvious but I'm not familiar with signal processing.

• Hi! What's your sampling frequency? Since you do not want the DFT domain, have you tried anything in the time domain yet? – Fat32 Aug 24 '17 at 17:29

Depending on the exact characteristics of the signal and implementation requirements (if any) I can think of a number of approaches to extract content at a "single" frequency. The most common:

• Apply an FFT to calculate the spectrum of the signal and extract the frequency of interest.
• Apply Goertzel's algorithm to effectively extract signal content at a single spectral line.
• Apply a bandpass filter around the frequency of interest.
• Apply an inverted notch filter around the frequency of interest.

Depending on the amplitude and frequency content of the signal, the additional noise present and other implementation requirements (e.g. should the signal be processed in real time or offline, should the implementation be digital or analog, etc.) a specific approach might be preferred.

If you truncate or switch on and off a single frequency, you will have a modulated signal which is no longer a single frequency signal and this signal will have spectrum with 1/f distribution around your original frequency (or 1/(f-f0)). So to obtain what you want you have to filter your signal with a notch pass filter which has 1/f distribution. Filters with very sharp roll off will give you a single sinusoidal with constant amplitude.

To detect the presence of your symbol in the signal the easier way is to find the correlation of your signal with a truncated single frequency and then threshold the correlation (it's called matched filter).

I think you can do a dft for a single frequency fine.

Just sum over your window of a whole compression and rarefaction multiplied by the sine of the frequency your looking for, then do it for the cosine, then the amplitude is the hypotenuse if they were graphed on xy axis, and the phase is the angle.