# DTMF detection with Goertzel

Started by July 13, 2005
```Hello,

I am wondering what would be the smallest number of sample that one can
use with Goertzel  algorithm to detect DTFM. Assuming 8Ksps. Can I use 40
samples? Can I use 160 samples?  Should it be an even number? What is the
restriction on this matter?

Best regards

```
```"ma" <ma@nowhere.com> wrote in message
news:kKbBe.133436\$Vo6.105603@fe3.news.blueyonder.co.uk...
> Hello,
>
>    I am wondering what would be the smallest number of sample that one can
> use with Goertzel  algorithm to detect DTFM. Assuming 8Ksps. Can I use 40
> samples? Can I use 160 samples?  Should it be an even number? What is the
> restriction on this matter?
>
>
>
> Best regards
>
>

If you recall, the Goertzel algo is just a recursive way to evaluate a DFT
at a single frequency. So having said that, think about how the selection of
N affects the bin frequencies of the DFT. The number 205 for DTMF was chosen
to place the DTMF frequencies near the centers of a DFT's bins - assuming a
sampling rate of 8kHz. Recall the DFT's bin frequencies are arithmetically
spaced and DTMF's frequencies are geometrically spaced. (MF and MFC use
arithmetically spaced frequencies.) And of course the bigger the N, the
narrower the bandpass of each detector becomes. So if you use real short
blocks - small N, your bandwidth is too great. The standard Goertzel
approach works pretty well for DTMF detection, but it will have a problem
meeting Bell specs. Does this matter to you? Now if you implement sliding
Goertzels, then the situation is much improved. Trying to decide if a tone
is present using discrete data blocks is tough, since a tone burst may just
span 2 or 3 blocks. But with the sliding method, this issue goes away. Also
you will want to implement a sliding energy detector, so then an adroit
application of Parseval's theorem, will allow you to have a simple and
effective algo for talk off immunity. I.e., you can simply test to see if
the energy in the two tones is the majority of the total energy. You can add
a dial tone and hum removal filter before the energy detector. This purity
measurement is much more efficient than using detectors for the 2nd
harmonics.

Clay

```
```"Clay S. Turner" <Physics@Bellsouth.net> wrote in message
news:ylhBe.69770\$Tt.50786@bignews3.bellsouth.net...
>
> "ma" <ma@nowhere.com> wrote in message
> news:kKbBe.133436\$Vo6.105603@fe3.news.blueyonder.co.uk...
>> Hello,
>>
>>    I am wondering what would be the smallest number of sample that one can
>> use with Goertzel  algorithm to detect DTFM. Assuming 8Ksps. Can I use 40
>> samples? Can I use 160 samples?  Should it be an even number? What is the
>> restriction on this matter?
>>
>>
> If you recall, the Goertzel algo is just a recursive way to evaluate a DFT at
> a single frequency. So having said that, think about how the selection of N
> affects the bin frequencies of the DFT. The number 205 for DTMF was chosen to
> place the DTMF frequencies near the centers of a DFT's bins - assuming a
> sampling rate of 8kHz. Recall the DFT's bin frequencies are arithmetically
> spaced and DTMF's frequencies are geometrically spaced. (MF and MFC use
> arithmetically spaced frequencies.) And of course the bigger the N, the
> narrower the bandpass of each detector becomes. So if you use real short
> blocks - small N, your bandwidth is too great. The standard Goertzel approach
> works pretty well for DTMF detection, but it will have a problem meeting Bell
> specs. Does this matter to you? Now if you implement sliding Goertzels, then
> the situation is much improved. Trying to decide if a tone is present using
> discrete data blocks is tough, since a tone burst may just span 2 or 3 blocks.
> But with the sliding method, this issue goes away. Also you will want to
> implement a sliding energy detector, so then an adroit application of
> Parseval's theorem, will allow you to have a simple and effective algo for
> talk off immunity. I.e., you can simply test to see if the energy in the two
> tones is the majority of the total energy. You can add a dial tone and hum
> removal filter before the energy detector. This purity measurement is much
> more efficient than using detectors for the 2nd harmonics.

Great post, Clay!  That's one of the best succinct descriptions of problems and
solutions for DTMF detection I've seen.  (I've played around in this area a
little, but so far had only discovered the problems!  :-)

--
Jon Harris
SPAM blocker in place:
Remove 99 (but leave 7) to reply

```
```Hello Clay:

Thanks Very informative and professional:

So would you please spare some time and explain some information to me:

> If you recall, the Goertzel algo is just a recursive way to evaluate a DFT
> at a single frequency. So having said that, think about how the selection
> of N affects the bin frequencies of the DFT. The number 205 for DTMF was
> chosen to place the DTMF frequencies near the centers of a DFT's bins -
> assuming a sampling rate of 8kHz. Recall the DFT's bin frequencies are
> arithmetically spaced and DTMF's frequencies are geometrically spaced. (MF
> and MFC use arithmetically spaced frequencies.) And of course the bigger
> the N, the

Does this means that 205 is an optimum value for block size in DTFM
detection?

What is MF and MFC?

> narrower the bandpass of each detector becomes. So if you use real short
> blocks - small N, your bandwidth is too great. The standard Goertzel
> approach works pretty well for DTMF detection, but it will have a problem
> meeting Bell specs.

What are Bell specs? Any reference to it?

Does this matter to you? Now if you implement sliding
> Goertzels, then the situation is much improved.

What is sliding Goertzel? Does it mean overlapped buffers? What would be the
optimum value for overlap?

Trying to decide if a tone
> is present using discrete data blocks is tough, since a tone burst may
> just span 2 or 3 blocks. But with the sliding method, this issue goes
> away. Also you will want to implement a sliding energy detector, so then
> an adroit application of Parseval's theorem, will allow you to have a
> simple and effective algo for talk off immunity.

I.e., you can simply test to see if
> the energy in the two tones is the majority of the total energy. You can
> add a dial tone and hum removal filter before the energy detector.

Any information on how to implement such hum filter?

This purity
> measurement is much more efficient than using detectors for the 2nd
> harmonics.
>
> Clay

Thanks a lot. Now it not only become a programming exercise for me, but also
it will update my DSP knowledge as well.

```
```Hello Ma,

I'm posing from Google, so I'll put all of the answers together here.

The number 205 is a good compromise for the application of non
overlapping blocks. Patrick Mock of TI wrote a app note that used the
Goertzel algo to decode DTMF. But he did this at a time when DSPs
weren't nearly as fast as they are now. But his article was an
excellant starting point.

DTMF - Dual Tone Multifrequency - used for inband signally between
users and the central office. Total set of 8 tones is subdivided into
two groups of four where a 'digit" is comprised of two tones one from
each group. This was never intended to be used as it is being used now.
I.e. overdailing into voice response systems.

MF - Multifrequency. Used for inband signally between some forms of
central office equipment. It uses a 2 of 5 code where the tone
frequencies are 700, 900, 1100, 1300, and 1500 Hz.

MFC - Multifrequency Compelled. Also used for in band signally between
telephone switches where tone handshaking is use. The sender emits a
tone, the the receiver emits an ack tone, then the sender removes his
tone, and then the receiver removes his ack tone. This process is
repeated for each of the sent digits. It also uses a 2 of 5 code. But
there are several variations on the frequencies being used. One example
is MFC-R2. Different parts of the world use different frequencies.
However the frequency spacing is usually 200 Hz. I programmed a machine
that went into China during the early 90s, that used E1 trunks with
A-law companding and used MFC-R2 inband signaling. I recall I was
interfacing to a Fujitsu switch that used a "rural trunk" version of
MFC-R2.

Bell specs - refer to the specifications that DTMF tone decoders must
meet in order to be acceptable to the Bell Telephone company - pretty
much the standard in North America. Most of the rest of the world uses
ITU and CCITT specs. And in some cases these groups use each other's
specs. For talk off immunity, there used to be a test tape from Mitel
that you would play into your decoders. You would count the number of
falses and hope your detector had an acceptable numer. I don't think
that tape is availible anymore - so I'm not sure what standard is being
used currently for this. Bell did not have a spec for talk off immunity
as this was not how Bell intended DTMF to be used.

Sliding Goertzel is a neat way of having the Goertel output on a sample
by sample basis. It is like having blocks where all but one sample
overlap. Hower this algo is very efficient for computing this. Think
about a DTMF dailer's digits being on for 65mSec and off for 35mSec.
You will need to be able to clearly see the off times in between
digits. What is the time for 205 samples at 8000Hz? Compare this with
35mSec. There was an article about Sliding Goertzels in Digital Signal
Processing Magazine a year or two ago.

The standard problem in DTMF is detection in the presence of noise. If
you recall standard telephone sets would disable the microphone when a
digit is pressed. So during the time the digit is produced, the tones
are quite pure. However with voice response systems, you are
"overdialing' into the far end device which is likely to be playing
audio back. Overdial refers to your digits now going to the called
device as opposed to only going to the central office. This has
ramifications on allowed twist. Standard DTMF assumes user to central
office with a twist allowance of -4 to 8 dB. This means the high group
tone's level when compared to the low group tone's level can be up to
4dB louder and down to 8 dB quieter. But with a two hop link - user to
central office to central office to called party, more twist must be
allowed for. Also the DTMF decoder in the far end device hears both its
own output and the incomming audio. So proper echo cancelling and line
balancing is needed. Sometimes an early detect (predetect with loose
specs) of DTMF will temporarily mute the outbound audio, so now the

Using Parseval's for tone purity in DTMF reception is something I
devised and implemented back in 1990. Parseval's theorem relates the
time domain and frequency domain energies associated with Fourier
transforms. So you compute the time domain energy for a block of data -
i.e., it is the sum of squares of the samples, and then you compare it
with the energies in the two tones. If the agreement is good, then you
have pure tones and not some wideband source triggering all of your
detectors. Mock's and everybody else's implementations I saw afterwards
would use another set of Goertzel detectors at the 2nd Harmonic
frequencies. The idea is voice is wideband and it would trigger the
harmonic detectors pretty much anytime it triggered the fundamental
detectors. I cut the processing effort in half by using Parseval's
theorem and diposing of the second set of detectors.

Dial tone and other supervisory tones in North America are dual tones
made from 350, 440, 480, 680?? Hz. The exceptions I know of are the ROH
(receiver of hook - 4 freqs in the 2kHz region mixed together) and the
intercept tones. A lot of the rest of the world uses a single frequency
with various cadences while others use dual tones.  An office quality
DTMF decoder needs to be immune to supervisory tones and hum due to
mains - 50 or 60 Hz. Simple notch filters will handle this. A lot of
DTMF decoders would use two band filters. One to pass the high group
and the other to pass the low group. If done properly this rejects the
supervisory tones and hum.

IHTH,

Clay

```
```Clay wrote:
> Hello Ma,
>
> I'm posing from Google, so I'll put all of the answers together here.
>
> The number 205 is a good compromise for the application of non
> overlapping blocks. Patrick Mock of TI wrote a app note that used the
> Goertzel algo to decode DTMF. But he did this at a time when DSPs
> weren't nearly as fast as they are now. But his article was an
> excellant starting point.
>
> DTMF - Dual Tone Multifrequency - used for inband signally between
> users and the central office. Total set of 8 tones is subdivided into
> two groups of four where a 'digit" is comprised of two tones one from
> each group. This was never intended to be used as it is being used now.
> I.e. overdailing into voice response systems.
>
> MF - Multifrequency. Used for inband signally between some forms of
> central office equipment. It uses a 2 of 5 code where the tone
> frequencies are 700, 900, 1100, 1300, and 1500 Hz.

Its 2 of 6 tones. You missed 1700Hz.

> MFC - Multifrequency Compelled. Also used for in band signally between
> telephone switches where tone handshaking is use. The sender emits a
> tone, the the receiver emits an ack tone, then the sender removes his
> tone, and then the receiver removes his ack tone. This process is
> repeated for each of the sent digits. It also uses a 2 of 5 code. But

This is also 2 of 6.

> there are several variations on the frequencies being used. One example

Most systems use a set of frequencies spaced at 120Hz intervals, rather
than Bell's 200Hz. A few use the Bell MF frequencies.

> is MFC-R2. Different parts of the world use different frequencies.
> However the frequency spacing is usually 200 Hz. I programmed a machine
> that went into China during the early 90s, that used E1 trunks with
> A-law companding and used MFC-R2 inband signaling. I recall I was
> interfacing to a Fujitsu switch that used a "rural trunk" version of
> MFC-R2.

Every country which uses R2 (which is still many, despite its very
obsolete nature) has their own variation.

> Bell specs - refer to the specifications that DTMF tone decoders must
> meet in order to be acceptable to the Bell Telephone company - pretty
> much the standard in North America. Most of the rest of the world uses
> ITU and CCITT specs. And in some cases these groups use each other's
> specs. For talk off immunity, there used to be a test tape from Mitel
> that you would play into your decoders. You would count the number of
> falses and hope your detector had an acceptable numer. I don't think
> that tape is availible anymore - so I'm not sure what standard is being
> used currently for this. Bell did not have a spec for talk off immunity
> as this was not how Bell intended DTMF to be used.

Sadly you cannot buy either the Mitel or Bell test tapes any more.

> Sliding Goertzel is a neat way of having the Goertel output on a sample
> by sample basis. It is like having blocks where all but one sample
> overlap. Hower this algo is very efficient for computing this. Think
> about a DTMF dailer's digits being on for 65mSec and off for 35mSec.
> You will need to be able to clearly see the off times in between
> digits. What is the time for 205 samples at 8000Hz? Compare this with
> 35mSec. There was an article about Sliding Goertzels in Digital Signal
> Processing Magazine a year or two ago.

You don't really need to determine the timing with that much accuracy.
Running a set of sliding Goertzels continuously is inefficient. It is
more efficient to use TKEO to determine that narrow band energy exists,
and then use something to analyse it. Goertzel is a candidate for that
analysis. I've never actually implemented that, but it seems like the
right approach for shared resource systems where the mean as well as the

> The standard problem in DTMF is detection in the presence of noise. If
> you recall standard telephone sets would disable the microphone when a
> digit is pressed. So during the time the digit is produced, the tones
> are quite pure. However with voice response systems, you are
> "overdialing' into the far end device which is likely to be playing
> audio back. Overdial refers to your digits now going to the called
> device as opposed to only going to the central office. This has
> ramifications on allowed twist. Standard DTMF assumes user to central
> office with a twist allowance of -4 to 8 dB. This means the high group
> tone's level when compared to the low group tone's level can be up to
> 4dB louder and down to 8 dB quieter. But with a two hop link - user to
> central office to central office to called party, more twist must be
> allowed for. Also the DTMF decoder in the far end device hears both its
> own output and the incomming audio. So proper echo cancelling and line
> balancing is needed. Sometimes an early detect (predetect with loose
> specs) of DTMF will temporarily mute the outbound audio, so now the
>
> Using Parseval's for tone purity in DTMF reception is something I
> devised and implemented back in 1990. Parseval's theorem relates the
> time domain and frequency domain energies associated with Fourier
> transforms. So you compute the time domain energy for a block of data -
> i.e., it is the sum of squares of the samples, and then you compare it
> with the energies in the two tones. If the agreement is good, then you
> have pure tones and not some wideband source triggering all of your

I did this in the 80s, and I think many others have. I don't think you
can get down to 20 hits on the Bellcore tests with other approaches,
like the 2nd harmonic test one. I have implemented and met several
decoders which can do that. Getting below 20 is more of a challenge. :-)

> detectors. Mock's and everybody else's implementations I saw afterwards
> would use another set of Goertzel detectors at the 2nd Harmonic
> frequencies. The idea is voice is wideband and it would trigger the
> harmonic detectors pretty much anytime it triggered the fundamental
> detectors. I cut the processing effort in half by using Parseval's
> theorem and diposing of the second set of detectors.

The 2nd harmonic test gives trouble at times. I've experienced channel
distortions which resulted in enough 2nd harmonic to fool those tests.

> Dial tone and other supervisory tones in North America are dual tones
> made from 350, 440, 480, 680?? Hz. The exceptions I know of are the ROH
> (receiver of hook - 4 freqs in the 2kHz region mixed together) and the
> intercept tones. A lot of the rest of the world uses a single frequency
> with various cadences while others use dual tones.  An office quality
> DTMF decoder needs to be immune to supervisory tones and hum due to
> mains - 50 or 60 Hz. Simple notch filters will handle this. A lot of
> DTMF decoders would use two band filters. One to pass the high group
> and the other to pass the low group. If done properly this rejects the
> supervisory tones and hum.

Most countries have at least a couple of different frequencies for the
tones. Notches for those, plus notches at 50, 60, 150 and 180Hz seems a
pain. PBXes tend to add a few tones of their own, too. A blanket HPF
seems like a more sensible solution.

Regards,
Steve
```
```"Steve Underwood" <steveu@dis.org> wrote in message
news:db66g6\$10h\$1@nnews.pacific.net.hk...
> Clay wrote:
>> Hello Ma,
>>
>> I'm posing from Google, so I'll put all of the answers together here.
>>
>> The number 205 is a good compromise for the application of non
>> overlapping blocks. Patrick Mock of TI wrote a app note that used the
>> Goertzel algo to decode DTMF. But he did this at a time when DSPs
>> weren't nearly as fast as they are now. But his article was an
>> excellant starting point.
>>
>> DTMF - Dual Tone Multifrequency - used for inband signally between
>> users and the central office. Total set of 8 tones is subdivided into
>> two groups of four where a 'digit" is comprised of two tones one from
>> each group. This was never intended to be used as it is being used now.
>> I.e. overdailing into voice response systems.
>>
>> MF - Multifrequency. Used for inband signally between some forms of
>> central office equipment. It uses a 2 of 5 code where the tone
>> frequencies are 700, 900, 1100, 1300, and 1500 Hz.
>
> Its 2 of 6 tones. You missed 1700Hz.

Yes that's what happens when I work to 3:00AM and then get up and be back at
work by 9:00AM. It been 11 years since I did anything DTMF-MF related. And I
was recalling everything from memory. And of course 5 choose 2 is only 10,
and MF has 15 symbols which needs 6 choose 2.

>
>> MFC - Multifrequency Compelled. Also used for in band signally between
>> telephone switches where tone handshaking is use. The sender emits a
>> tone, the the receiver emits an ack tone, then the sender removes his
>> tone, and then the receiver removes his ack tone. This process is
>> repeated for each of the sent digits. It also uses a 2 of 5 code. But
>
> This is also 2 of 6.
>
>> there are several variations on the frequencies being used. One example
>
> Most systems use a set of frequencies spaced at 120Hz intervals, rather
> than Bell's 200Hz. A few use the Bell MF frequencies.

Now that I'm back at my house, I pulled up my old code and found these
frequencies for MFC-R2 (China)

Fwd 1380,1500,1620,1740,1860,and 1980
Rev  1140,1020,900,780,660,and 540

>
>> is MFC-R2. Different parts of the world use different frequencies.
>> However the frequency spacing is usually 200 Hz. I programmed a machine
>> that went into China during the early 90s, that used E1 trunks with
>> A-law companding and used MFC-R2 inband signaling. I recall I was
>> interfacing to a Fujitsu switch that used a "rural trunk" version of
>> MFC-R2.
>
> Every country which uses R2 (which is still many, despite its very
> obsolete nature) has their own variation.

This I believe.

>
>> Bell specs - refer to the specifications that DTMF tone decoders must
>> meet in order to be acceptable to the Bell Telephone company - pretty
>> much the standard in North America. Most of the rest of the world uses
>> ITU and CCITT specs. And in some cases these groups use each other's
>> specs. For talk off immunity, there used to be a test tape from Mitel
>> that you would play into your decoders. You would count the number of
>> falses and hope your detector had an acceptable numer. I don't think
>> that tape is availible anymore - so I'm not sure what standard is being
>> used currently for this. Bell did not have a spec for talk off immunity
>> as this was not how Bell intended DTMF to be used.
>
> Sadly you cannot buy either the Mitel or Bell test tapes any more.

I saw one go on ebay a couple of years back - one finds just about anything
there.

>
>> Sliding Goertzel is a neat way of having the Goertel output on a sample
>> by sample basis. It is like having blocks where all but one sample
>> overlap. Hower this algo is very efficient for computing this. Think
>> about a DTMF dailer's digits being on for 65mSec and off for 35mSec.
>> You will need to be able to clearly see the off times in between
>> digits. What is the time for 205 samples at 8000Hz? Compare this with
>> 35mSec. There was an article about Sliding Goertzels in Digital Signal
>> Processing Magazine a year or two ago.
>
> You don't really need to determine the timing with that much accuracy.
> Running a set of sliding Goertzels continuously is inefficient. It is more
> efficient to use TKEO to determine that narrow band energy exists, and
> then use something to analyse it. Goertzel is a candidate for that
> analysis. I've never actually implemented that, but it seems like the
> right approach for shared resource systems where the mean as well as the
> peak compute load is important.

One of the coolest approaches to DTMF decoding is one in a Bell Labs patent
that uses two - three term auto correlations. One each after the high-low
group splitting. A simple LPC analysis is performed - trivial for two term
recursive systems and the pole's angle and magnitude tell you the frequency
and an equivalent of purity. It is quite computationally efficient. IIRC
this is in a DSP32 appnote. Ironic that the appnote shows something that is
patented!

>
>> The standard problem in DTMF is detection in the presence of noise. If
>> you recall standard telephone sets would disable the microphone when a
>> digit is pressed. So during the time the digit is produced, the tones
>> are quite pure. However with voice response systems, you are
>> "overdialing' into the far end device which is likely to be playing
>> audio back. Overdial refers to your digits now going to the called
>> device as opposed to only going to the central office. This has
>> ramifications on allowed twist. Standard DTMF assumes user to central
>> office with a twist allowance of -4 to 8 dB. This means the high group
>> tone's level when compared to the low group tone's level can be up to
>> 4dB louder and down to 8 dB quieter. But with a two hop link - user to
>> central office to central office to called party, more twist must be
>> allowed for. Also the DTMF decoder in the far end device hears both its
>> own output and the incomming audio. So proper echo cancelling and line
>> balancing is needed. Sometimes an early detect (predetect with loose
>> specs) of DTMF will temporarily mute the outbound audio, so now the
>>
>> Using Parseval's for tone purity in DTMF reception is something I
>> devised and implemented back in 1990. Parseval's theorem relates the
>> time domain and frequency domain energies associated with Fourier
>> transforms. So you compute the time domain energy for a block of data -
>> i.e., it is the sum of squares of the samples, and then you compare it
>> with the energies in the two tones. If the agreement is good, then you
>> have pure tones and not some wideband source triggering all of your
>
> I did this in the 80s, and I think many others have. I don't think you can
> get down to 20 hits on the Bellcore tests with other approaches, like the
> 2nd harmonic test one. I have implemented and met several decoders which
> can do that. Getting below 20 is more of a challenge. :-)

If others used the Parseval approach, then they kept it close to their chest
at the time. I have a lot of app notes on DTMF decoders from that time and
not a one of them mentioned this trick.

>
>> detectors. Mock's and everybody else's implementations I saw afterwards
>> would use another set of Goertzel detectors at the 2nd Harmonic
>> frequencies. The idea is voice is wideband and it would trigger the
>> harmonic detectors pretty much anytime it triggered the fundamental
>> detectors. I cut the processing effort in half by using Parseval's
>> theorem and diposing of the second set of detectors.
>
> The 2nd harmonic test gives trouble at times. I've experienced channel
> distortions which resulted in enough 2nd harmonic to fool those tests.
>
>> Dial tone and other supervisory tones in North America are dual tones
>> made from 350, 440, 480, 680?? Hz. The exceptions I know of are the ROH
>> (receiver of hook - 4 freqs in the 2kHz region mixed together) and the
>> intercept tones. A lot of the rest of the world uses a single frequency
>> with various cadences while others use dual tones.  An office quality
>> DTMF decoder needs to be immune to supervisory tones and hum due to
>> mains - 50 or 60 Hz. Simple notch filters will handle this. A lot of
>> DTMF decoders would use two band filters. One to pass the high group
>> and the other to pass the low group. If done properly this rejects the
>> supervisory tones and hum.
>
> Most countries have at least a couple of different frequencies for the
> tones. Notches for those, plus notches at 50, 60, 150 and 180Hz seems a
> pain. PBXes tend to add a few tones of their own, too. A blanket HPF seems
> like a more sensible solution.

Bell wanted the filters as part of the design for office grade decoders.
Lucent put us through the paces for certifying the decoders. They were
repping our product, and they won't rep it unless they have thoroughly
tested it.

Clay

>
> Regards,
> Steve

```
```Thanks a lot. Where can fine the whitepapers and App note that you mentioned
here? Where can I find some documents on implimentation issue related to
DTFM?

My search in Google returned several data but they are not so deep
discussion, just introducing DTFM and FFT or Geortzel algorithem to
impliment it.

Best regards

"Clay S. Turner" <Physics@Bellsouth.net> wrote in message
news:7gCBe.74209\$ho.26737@bignews6.bellsouth.net...
>
> "Steve Underwood" <steveu@dis.org> wrote in message
> news:db66g6\$10h\$1@nnews.pacific.net.hk...
>> Clay wrote:
>>> Hello Ma,
>>>
>>> I'm posing from Google, so I'll put all of the answers together here.
>>>
>>> The number 205 is a good compromise for the application of non
>>> overlapping blocks. Patrick Mock of TI wrote a app note that used the
>>> Goertzel algo to decode DTMF. But he did this at a time when DSPs
>>> weren't nearly as fast as they are now. But his article was an
>>> excellant starting point.
>>>
>>> DTMF - Dual Tone Multifrequency - used for inband signally between
>>> users and the central office. Total set of 8 tones is subdivided into
>>> two groups of four where a 'digit" is comprised of two tones one from
>>> each group. This was never intended to be used as it is being used now.
>>> I.e. overdailing into voice response systems.
>>>
>>> MF - Multifrequency. Used for inband signally between some forms of
>>> central office equipment. It uses a 2 of 5 code where the tone
>>> frequencies are 700, 900, 1100, 1300, and 1500 Hz.
>>
>> Its 2 of 6 tones. You missed 1700Hz.
>
> Yes that's what happens when I work to 3:00AM and then get up and be back
> at work by 9:00AM. It been 11 years since I did anything DTMF-MF related.
> And I was recalling everything from memory. And of course 5 choose 2 is
> only 10, and MF has 15 symbols which needs 6 choose 2.
>
>>
>>> MFC - Multifrequency Compelled. Also used for in band signally between
>>> telephone switches where tone handshaking is use. The sender emits a
>>> tone, the the receiver emits an ack tone, then the sender removes his
>>> tone, and then the receiver removes his ack tone. This process is
>>> repeated for each of the sent digits. It also uses a 2 of 5 code. But
>>
>> This is also 2 of 6.
>>
>>> there are several variations on the frequencies being used. One example
>>
>> Most systems use a set of frequencies spaced at 120Hz intervals, rather
>> than Bell's 200Hz. A few use the Bell MF frequencies.
>
> Now that I'm back at my house, I pulled up my old code and found these
> frequencies for MFC-R2 (China)
>
> Fwd 1380,1500,1620,1740,1860,and 1980
> Rev  1140,1020,900,780,660,and 540
>
>
>>
>>> is MFC-R2. Different parts of the world use different frequencies.
>>> However the frequency spacing is usually 200 Hz. I programmed a machine
>>> that went into China during the early 90s, that used E1 trunks with
>>> A-law companding and used MFC-R2 inband signaling. I recall I was
>>> interfacing to a Fujitsu switch that used a "rural trunk" version of
>>> MFC-R2.
>>
>> Every country which uses R2 (which is still many, despite its very
>> obsolete nature) has their own variation.
>
> This I believe.
>
>
>>
>>> Bell specs - refer to the specifications that DTMF tone decoders must
>>> meet in order to be acceptable to the Bell Telephone company - pretty
>>> much the standard in North America. Most of the rest of the world uses
>>> ITU and CCITT specs. And in some cases these groups use each other's
>>> specs. For talk off immunity, there used to be a test tape from Mitel
>>> that you would play into your decoders. You would count the number of
>>> falses and hope your detector had an acceptable numer. I don't think
>>> that tape is availible anymore - so I'm not sure what standard is being
>>> used currently for this. Bell did not have a spec for talk off immunity
>>> as this was not how Bell intended DTMF to be used.
>>
>> Sadly you cannot buy either the Mitel or Bell test tapes any more.
>
> I saw one go on ebay a couple of years back - one finds just about
> anything there.
>
>>
>>> Sliding Goertzel is a neat way of having the Goertel output on a sample
>>> by sample basis. It is like having blocks where all but one sample
>>> overlap. Hower this algo is very efficient for computing this. Think
>>> about a DTMF dailer's digits being on for 65mSec and off for 35mSec.
>>> You will need to be able to clearly see the off times in between
>>> digits. What is the time for 205 samples at 8000Hz? Compare this with
>>> 35mSec. There was an article about Sliding Goertzels in Digital Signal
>>> Processing Magazine a year or two ago.
>>
>> You don't really need to determine the timing with that much accuracy.
>> Running a set of sliding Goertzels continuously is inefficient. It is
>> more efficient to use TKEO to determine that narrow band energy exists,
>> and then use something to analyse it. Goertzel is a candidate for that
>> analysis. I've never actually implemented that, but it seems like the
>> right approach for shared resource systems where the mean as well as the
>> peak compute load is important.
>
> One of the coolest approaches to DTMF decoding is one in a Bell Labs
> patent that uses two - three term auto correlations. One each after the
> high-low group splitting. A simple LPC analysis is performed - trivial for
> two term recursive systems and the pole's angle and magnitude tell you the
> frequency and an equivalent of purity. It is quite computationally
> efficient. IIRC this is in a DSP32 appnote. Ironic that the appnote shows
> something that is patented!
>
>
>>
>>> The standard problem in DTMF is detection in the presence of noise. If
>>> you recall standard telephone sets would disable the microphone when a
>>> digit is pressed. So during the time the digit is produced, the tones
>>> are quite pure. However with voice response systems, you are
>>> "overdialing' into the far end device which is likely to be playing
>>> audio back. Overdial refers to your digits now going to the called
>>> device as opposed to only going to the central office. This has
>>> ramifications on allowed twist. Standard DTMF assumes user to central
>>> office with a twist allowance of -4 to 8 dB. This means the high group
>>> tone's level when compared to the low group tone's level can be up to
>>> 4dB louder and down to 8 dB quieter. But with a two hop link - user to
>>> central office to central office to called party, more twist must be
>>> allowed for. Also the DTMF decoder in the far end device hears both its
>>> own output and the incomming audio. So proper echo cancelling and line
>>> balancing is needed. Sometimes an early detect (predetect with loose
>>> specs) of DTMF will temporarily mute the outbound audio, so now the
>>>
>>> Using Parseval's for tone purity in DTMF reception is something I
>>> devised and implemented back in 1990. Parseval's theorem relates the
>>> time domain and frequency domain energies associated with Fourier
>>> transforms. So you compute the time domain energy for a block of data -
>>> i.e., it is the sum of squares of the samples, and then you compare it
>>> with the energies in the two tones. If the agreement is good, then you
>>> have pure tones and not some wideband source triggering all of your
>>
>> I did this in the 80s, and I think many others have. I don't think you
>> can get down to 20 hits on the Bellcore tests with other approaches, like
>> the 2nd harmonic test one. I have implemented and met several decoders
>> which can do that. Getting below 20 is more of a challenge. :-)
>
> If others used the Parseval approach, then they kept it close to their
> chest at the time. I have a lot of app notes on DTMF decoders from that
> time and not a one of them mentioned this trick.
>
>>
>>> detectors. Mock's and everybody else's implementations I saw afterwards
>>> would use another set of Goertzel detectors at the 2nd Harmonic
>>> frequencies. The idea is voice is wideband and it would trigger the
>>> harmonic detectors pretty much anytime it triggered the fundamental
>>> detectors. I cut the processing effort in half by using Parseval's
>>> theorem and diposing of the second set of detectors.
>>
>> The 2nd harmonic test gives trouble at times. I've experienced channel
>> distortions which resulted in enough 2nd harmonic to fool those tests.
>>
>>> Dial tone and other supervisory tones in North America are dual tones
>>> made from 350, 440, 480, 680?? Hz. The exceptions I know of are the ROH
>>> (receiver of hook - 4 freqs in the 2kHz region mixed together) and the
>>> intercept tones. A lot of the rest of the world uses a single frequency
>>> with various cadences while others use dual tones.  An office quality
>>> DTMF decoder needs to be immune to supervisory tones and hum due to
>>> mains - 50 or 60 Hz. Simple notch filters will handle this. A lot of
>>> DTMF decoders would use two band filters. One to pass the high group
>>> and the other to pass the low group. If done properly this rejects the
>>> supervisory tones and hum.
>>
>> Most countries have at least a couple of different frequencies for the
>> tones. Notches for those, plus notches at 50, 60, 150 and 180Hz seems a
>> pain. PBXes tend to add a few tones of their own, too. A blanket HPF
>> seems like a more sensible solution.
>
> Bell wanted the filters as part of the design for office grade decoders.
> Lucent put us through the paces for certifying the decoders. They were
> repping our product, and they won't rep it unless they have thoroughly
> tested it.
>
> Clay
>
>>
>> Regards,
>> Steve
>
>

```
```Clay S. Turner wrote:
> "Steve Underwood" <steveu@dis.org> wrote in message
> news:db66g6\$10h\$1@nnews.pacific.net.hk...
>

>>Sadly you cannot buy either the Mitel or Bell test tapes any more.
>
>
> I saw one go on ebay a couple of years back - one finds just about anything
> there.

Old ones tend to be stretched, and of limited use. I have files
transcribed with care from a pristine set of the Bellcore tapes,
purchased in their final days. I never managed to get a Mitel tape in
usable condition.

> One of the coolest approaches to DTMF decoding is one in a Bell Labs patent
> that uses two - three term auto correlations. One each after the high-low
> group splitting. A simple LPC analysis is performed - trivial for two term
> recursive systems and the pole's angle and magnitude tell you the frequency
> and an equivalent of purity. It is quite computationally efficient. IIRC
> this is in a DSP32 appnote. Ironic that the appnote shows something that is
> patented!

Lots of things in app notes are patented. Usually the deal is "use our
silicon, and the patent licence comes bundled". Its a good strategy for
getting silicon into sockets where it will not be trivially swapped out
at cost reduction time.

I've seen some variations on the idea you describe used for tone
detectors. I remember the DSP32 app note, but I didn't realise it was
patented. I guess that would be a US only patent. It sounds too "purely
algorithmic" to get through other people's patent systems.

> If others used the Parseval approach, then they kept it close to their chest
> at the time. I have a lot of app notes on DTMF decoders from that time and
> not a one of them mentioned this trick.

I think you are right about the application notes of the day. I just
assume some others did something like this, as their false hit rates
were too good for the 2nd harmonic approach.

There were quite a lot of application notes on DTMF, MF and supervisory
tone decoding a few years ago. I never found one that actually worked.
The text, flow charts, and code always seemed to implement slightly
different things. All were slightly wrong. :-) They were a good source
of ideas, though.

Regards,
Steve
```
```"Clay" <physics@bellsouth.net> wrote in message
>
> Using Parseval's for tone purity in DTMF reception is something I
> devised and implemented back in 1990. Parseval's theorem relates the
> time domain and frequency domain energies associated with Fourier
> transforms. So you compute the time domain energy for a block of data -
> i.e., it is the sum of squares of the samples, and then you compare it
> with the energies in the two tones. If the agreement is good, then you
> have pure tones and not some wideband source triggering all of your
> detectors. Mock's and everybody else's implementations I saw afterwards
> would use another set of Goertzel detectors at the 2nd Harmonic
> frequencies. The idea is voice is wideband and it would trigger the
> harmonic detectors pretty much anytime it triggered the fundamental
> detectors. I cut the processing effort in half by using Parseval's
> theorem and diposing of the second set of detectors.

FYI, a very similar approach (Parseval) is sometimes used in feedback (howling)
suppression devices.  In that application, you have the same basic problem of
needing to distinguish pure spectral tones from broadband noise, speech, music
(especially problematic!), and other desirable audio signals.  So the ideas of
2nd harmonic testing and comparing the level of one component to the total
energy (i.e. applying Parseval's theorem) come up there too.  You also have the
issue of exactly detecting the offending frequency over 3 decades, but that's
another matter!

```