0
$\begingroup$

Thanks a lot to whoever downvoted my question for no good reason.

I wrote an implementation of the Goertzel algorithm in JavaScript and made a demo that detects DTMF dial-tones.

You can find the code here: http://github.com/ravenstine/goertzeljs

The demo is below, and you can try it out if you have a web browser that supports WebRTC(newer versions of Chrome and Firefox do).

http://goertzel.herokuapp.com

I have an issue where I need help:

  • I need a way to effectively filter out background noise.

There wasn't much information that I could find on the subject that didn't already assume that I knew a lot about DSP. I heard about using a window function and while I could find some algorithms, implementing them didn't seem to make any significant difference(Goertzel.js uses Exact Blackman).

As a result, I came up with my own filter where if an energy peak is not distinct enough from the energies of other frequencies, the information from that sample isn't used. This was actually tremendously effective when using a buffer size of 2048.

However, I want my DTMF detector to be as close to meeting ITU specifications as possible; the minimum duration of a DTMF tone to be detected is specified by ITU as 40ms, but my detector doesn't consistently detect tones unless they are around 110ms.

To deal with this, I want to make the buffer size even smaller, but if I do this then my method of removing noise becomes unmanageable(meaning it seems to either discriminate too-little or too-much).

At the moment, my detector works pretty well but background noise occasionally creates erroneous detections.

What are some other methods that I can implement to filter out noise with my DTMF detector? Also, am I correctly employing the window function?

$\endgroup$
  • 1
    $\begingroup$ Do you mind elaborating? Why shouldn't I use Goertzel, and what should I use instead? From what I've read, Goertzel is most often used for DTMF detection. How am I supposed to detect tones without framing the audio? I'm pretty sure even a FFT would require framing the audio to some extent. $\endgroup$ – Ravenstine Apr 13 '14 at 19:45
  • 1
    $\begingroup$ of course FFT requires framing. don't use it for such a simple operation that is interested in (or focused on) so few frequencies. the least expensive method is to run 8 simultaneous resonant filters (like BPF biquads with a high Q) tuned to the 8 different DTMF frequencies (if you want to detect dial-tone, called phone ringing, busy, etc, you will need a couple more resonant filters). then the output of each of these filters are squared and low-pass filtered and you have an envelope for each filtered output. also square and LPF the raw signal for scale. the rest is thresholds and logic. $\endgroup$ – robert bristow-johnson Apr 13 '14 at 21:08
  • 1
    $\begingroup$ I didn't say I was using FFT... Do you know where I can find more information on how to produce a resonant filter? I can't find much literature on the subject. I seem to even find information that treats the terms band-pass(what Goertzel basically is) and "resonant filter" interchangeably. Also, while I appreciate your input, this really doesn't answer my question at all. I would prefer some suggestions on how to improve my use of the algorithm I already implemented. $\endgroup$ – Ravenstine Apr 13 '14 at 22:02
  • 1
    $\begingroup$ You were suggesting that I refrain from using FFT just because I mentioned it once. I'm not going to get into an argument of who said what, though. "but there are other, better and cheaper, resonant filters for your application." ... like what? The gist I'm getting from what you're saying is that Goertzel is incapable of discerning tones that are only present for 40 milliseconds. Not that I don't believe you, but I just find it hard to believe since I've found no literature suggesting the use of different algorithms to meet ITU standards. $\endgroup$ – Ravenstine Apr 14 '14 at 6:16
  • 1
    $\begingroup$ I was not disrespectful at any point, nor did I intentionally misrepresent anything you said. All I asked for was specifics and clarification; that's not unreasonable. I already said that I don't want an argument. Besides, your comments are misplaced because they are only tangentially related to my original questions. But I appreciate your help. $\endgroup$ – Ravenstine Apr 14 '14 at 18:05
3
$\begingroup$

One technique to reject noise is to use the ratio of the Goertzel filter output power to the total signal power over the same 40 mS sliding time windows, as well as ratio of the absolute Goertzel power to some threshold, as part of your decision criteria.

You can adjust your buffer size to match this minimum DTMF signal time (2048 may be too long if the sample rate is well below 44.1kHz). Using a non-rectangular window may require using a longer Goertzel filter than 40 mS. Adjusting the Goertzel filter length to be close to an integer number of periods of the filter's center frequency will also help reject DC.

Added: Using a sliding Goertzel (and sliding RMS power) will reduce the effects of framing.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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