# How can I detect known frequencies using most efficient algorithm

I have a set of ultrasonic frequency that I am playing and I want to detect these particular set of known frequencies.

I have already used fft but it is quite processing intensive and I am facing problem when I implemented it in real-time. Then I used Goertzel algorithm with threshold values which worked fine in real-time when the fundamental frequencies where the known frequencies but once these frequencies were played alongside other frequencies (noise), which were sometimes more prominent than the ultrasonic ones, the ultrasonic ones expectedly did not cross the threshold and did not get detected.

Is there any other algorithm which I can try for my requirement given that I just want to detect known set of frequencies and is not that computation intensive like fft?

• Taking a FFT is too computationally intensive? Really? May 1 '15 at 22:56
• The presence of other frequencies should not diminish the output of a Goertzel filter for a known signal. Does your system have an AGC that turns down the overall gain when there is more noise? If so, can you turn it off? May 2 '15 at 3:12
• @hotpaw2 Yes. The system supposedly runs on TV channels where there is a cutoff for db level, because of already existing audio track there is not much scope of my audio layer being played at good db level. May 2 '15 at 7:28
• @Batman Yes, in my case yes. I have been trying to run this system on smartphones and somehow it seems most of the phone's mic work only when the buffer size is 4096 or 8192, this increases complexity for performing this task in realtime via FFT. May 2 '15 at 7:30
• does this method (MUSIC algorithm) work for your use-case? May 2 '15 at 7:54

A better way to use a Goertzel filter, than with a fixed threshold, is to compare a narrow-band Goertzel filter output with the energy of the total signal or a wider bandwidth Goertzel filter. Look for a peak statistically above a level corresponding to the wider noise energy level.

• I am not using fixed threshold for Goertzel but using property of my signal to set itself up. Although I haven't used your strategy, let me see how it works out. May 2 '15 at 10:00