2003-01-07 18:59:48

by Thomas Tonino

[permalink] [raw]
Subject: Re: [Asterisk] DTMF noise

Mark Spencer wrote:

> The DTMF detector in the linux kernel is fairly simplistic and doesn't do
> many relative energy tests. The Zapata library has a much better tone
> detector, but it is FP, and so would have to be made fixed point. If
> nothing else, it may provide some lessons for the ISDN folks.

I remember that a good DTMF decoder can be very simplistic: DTMF was designed
for that.

The idea is:

- separate the high tones from the low tones.
- amplify clip the high band and the low band separately
- run the tone decoders on the clipped signals

The clipping stage would make sure that only relatively pure tones will trigger
the detector.

See also http://groups.google.com/groups?selm=7462%40accuvax.nwu.edu


Thomas


2003-01-07 22:37:49

by Roy Sigurd Karlsbakk

[permalink] [raw]
Subject: Re: [Asterisk] DTMF noise

>> The DTMF detector in the linux kernel is fairly simplistic and
>> doesn't do
>> many relative energy tests. The Zapata library has a much better tone
>> detector, but it is FP, and so would have to be made fixed point. If
>> nothing else, it may provide some lessons for the ISDN folks.
>
> I remember that a good DTMF decoder can be very simplistic: DTMF was
> designed for that.
>
> The idea is:
>
> - separate the high tones from the low tones.
> - amplify clip the high band and the low band separately
> - run the tone decoders on the clipped signals
>
> The clipping stage would make sure that only relatively pure tones
> will trigger the detector.
>
> See also http://groups.google.com/groups?selm=7462%40accuvax.nwu.edu

but the problem here, is just what you're describing.

The DTMF decoder is finding DTMF signals in normal speech, so talking
with someone with Asterisk (dot org) using isdn4linux is a true
nightmare. Linux's DTMF detector finds DTMF signals all the time,
making asterisk signal them as sounds.

so - we DO NOT need a 'simplistic' DTMF decoder. not for this purpose,
that is

roy

2003-01-08 07:43:05

by Thomas Tonino

[permalink] [raw]
Subject: Re: [Asterisk] DTMF noise

Roy Sigurd Karlsbakk wrote:

> so - we DO NOT need a 'simplistic' DTMF decoder.

You need a good one. But good can be simplistic, is what I'm saying.

DTMF was designed to be easy to decode reliably. Complex doesn't automatically
mean better.

I remember reading a more specific version of the message I pointed a pointer
to, but couldn't find it back. But it came down to the devil being in the details.

It probably pays to have someone look at this with old hardware experience in
this. Telco newsgroup perhaps.


Thomas

2003-01-08 12:34:46

by David D. Hagood

[permalink] [raw]
Subject: Re: [Asterisk] DTMF noise

Thomas Tonino wrote:
> Roy Sigurd Karlsbakk wrote:
>
>> so - we DO NOT need a 'simplistic' DTMF decoder.
>
>
> You need a good one. But good can be simplistic, is what I'm saying.
>
> DTMF was designed to be easy to decode reliably. Complex doesn't
> automatically mean better.
>

I haven't looked at the code, but I'd recommend using a bank of Goertzel
filters -


http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=Goertzel+filter+DTMF&btnG=Google+Search

The basic idea is that you have 8 filters (for the 4 row and 4 column
frequencies), as well as 8 filters looking at the first harmonic of the
8 frequencies. You then compare the energies in each frequency - if you
see significant energy in the harmonic filter bank, discard the signal.
That prevents you from detecting speech as DTMF, since speech will
usually have harmonics that a good DTMF signal won't.

Since the Goertzel filters are simple, they can be implemented in fixed
point math rather than floating point. At work, we've done this on a
Motorola 56301 DSP, which is a fixed-point DSP. I think there's an app
note from Moto on this - I'll check when I get into work today.

2003-01-08 12:56:03

by Matti Aarnio

[permalink] [raw]
Subject: Re: [Asterisk] DTMF noise

On Wed, Jan 08, 2003 at 06:43:10AM -0600, David D. Hagood wrote:
> Thomas Tonino wrote:
> >Roy Sigurd Karlsbakk wrote:
> >>so - we DO NOT need a 'simplistic' DTMF decoder.
> >
> >You need a good one. But good can be simplistic, is what I'm saying.
> >
> >DTMF was designed to be easy to decode reliably. Complex doesn't
> >automatically mean better.
>
> I haven't looked at the code, but I'd recommend using a bank of Goertzel
> filters -

Do look into drivers/isdn/isdn_audio.c That does use G?rtzel
filter, but does not do complete energy comparisons -> false detections.

/Matti Aarnio

2003-01-08 20:14:57

by Thomas Tonino

[permalink] [raw]
Subject: Re: [Asterisk] DTMF noise

David D. Hagood wrote:

> The basic idea is that you have 8 filters (for the 4 row and 4 column
> frequencies), as well as 8 filters looking at the first harmonic of the
> 8 frequencies. You then compare the energies in each frequency - if you
> see significant energy in the harmonic filter bank, discard the signal.
> That prevents you from detecting speech as DTMF, since speech will
> usually have harmonics that a good DTMF signal won't.

The original idea does one better by splitting high and low bands first. If that
is combined with Goertzel it might be even better: by looking at how much low
band energy there is total versus the low detected tone, and the same for the
high band total versus the high band detected tone. Only if the detected tone is
sufficiently strong compared to the total band it is in should the tone be
triggered.

But it may be more expensive computationally than doing twice the number of
Goertzel filters.

Harmonics seem like a bad idea. In between frequencies are better, but using the
total band energy must be the most sure way to detect interference.


Thomas

2003-01-09 12:34:53

by David D. Hagood

[permalink] [raw]
Subject: Re: [Asterisk] DTMF noise

Thomas Tonino wrote:

> The original idea does one better by splitting high and low bands first.

<snip>

> But it may be more expensive computationally than doing twice the number
> of Goertzel filters.

Not really - the Goertzel filter is a fairly cheap filter. A filter to
split the low band frequencies off from the high band, then doing the 8
Goertzel filters for tone detection burns more MIPS than just doing the
8 Goertzel filters. Furthurmore, the result is the same - you get the
energies in the 8 tones.


> Harmonics seem like a bad idea. In between frequencies are better, but
> using the total band energy must be the most sure way to detect
> interference.
>

Not really. The problem with the total energy approach is that the least
amount of real noise will prevent tone detection, and if you set the
threshold high enough that white noise does not prevent tone detection
then you get falsing in voice.

If you have 1mW/Hz of white noise, then that is 2700 mW of noise power
across the band. With voice, you get one of two types of "noise" -
either voiced signals with lots of energy at harmonicly related
frequencies, or unvoiced fricatives ("s", "f") that are basically white
noise. A voiced signal with a total power of 2000 mW of power and a
fundemental at one of the tone frequencies might have 1000 mW of power
at the tone energy, and the remaining 1000 mW on the harmonics. Yet, if
your noise threshold is set to not be blocked by the white noise case
(2700 mW of power), then it would accept the voice case (1000 mW of power).

The 16 filter algorithm is the one we use in radio - it lets us pick a
tone out of a staticy signal without falsing on voice.

It helps to think of looking at the signal on an audio spectrum analyzer
- a DTMF tone looks like 2 peaks. If the signal in question has more
than 2 peaks, it isn't DTMF.