The present invention relates to a new algorithm for DTMF detection, and more particularly to an algorithm for reducing calculation by utilizing optimal phase or gain.
DTMF (Dual-Tone Multi-Frequency) signals are broadly used in PSTN (Public Switched Telecommunication Network) for telephone dialing, data input, voice mail and remote control of consumer products. DTMF signals are used for transmitting numbers. Table 1 shows the combination of DTMF high frequency and low frequency for each telephone key, for example, push the key “1” means two signals of frequency 697 Hz and 1209 Hz are outputted, and so on.
In accordance with the ITU (International Telecommunication Union) standard, the acceptable tolerance for DTMF frequency is ±1.5%; if the frequency deviation exceeds ±3.5%, then it is unaccepatable; for frequency deviation between ±1.5%˜±3.5%, the user decides it is acceptable or unaccepatable. The reason that ITU specifies the acceptable tolerance for DTMF frequency is because a signal transmitting or converting between devices may induce frequency shift. A DTMF signal is composed of a high frequency signal and a low frequency signal.
In prior art, DFT (Discrete Fourier Transform) method is used for detecting DTMF signals, the signals in time domain is converted into a spectrum in frequency domain, as shown in
The acceptable tolerance for DTMF frequency is ±2.5% according to the present invention.
As the above setting, 512 samplings are taken each time, and the frequencies contained in the 512 samplings are analyzed, with frequency range 0 Hz˜8000 Hz. The acceptable range of k around 1477 Hz and 697 Hz are calculated as below:
f: 1477 Hz
upper limit
lower limit
The upper limit and the lower limit above are the acceptable range specified by ITU.
upper limit
lower limit
The upper limit and the lower limit above are the acceptable range specified by the present invention.
f: 697 Hz
upper limit
lower limit
The upper limit and the lower limit above are the acceptable range specified by ITU.
upper limit
lower limit
The upper limit and the lower limit above are the acceptable range specified by the present invention.
All of the above k values must be integer, since the index values in memory array of communication hardware device or computer system are integers. In judging if DTMF is “3”, five points of K=96˜92 (frequency tolerance range ±2.5% of 1477 Hz) and three points of K=45˜43 (frequency tolerance range ±2.5% of 697 Hz) have to be checked to see if a minimum value exists for each of the 8 points.
In prior art, the calculation formula of DFT is as below:
in which N is 512, n is 0˜512, k is also 0˜512. X[k] is the height of spectrum for frequency k, x[n] is the height of the n point in time domain. From the above formula, in order to calculate each X[k], 512×2 mutiplications and 512×2-2 additions are needed, the calculation is really too much.
The table below are concluded from the above formula to describe the calculation required for different K range in prior art DFT.
As shown in the above table of calculation required for DFT, the more the K range is increased, the calculation will be increased by multiples, the required calculation will grow up dramatically.
The object of the present invention is to provide an algorithm for DTMF detection. In detecting DTMF signals, the signals x[n] in time domain is converted into a spectrum in frequency domain. Let the sampling length is N, and perform calculation on M points of the spectrum,
in which x[k] is the signal value at the k point of the spectrum, X[k] is the calculation result on M points of the spectrum,
In order to avoid trembling wave in pass-band of the frequency domain or to reduce the trembling degree, so as to make it work as a square wave filter like Butterworth or Chebyshev, a θ degree or A gain is added to the above formula to control the wave shape, as shown below:
Since the calculation for DFT is too much in prior art, the present invention therefore provides a new algorithm DMFT (Discrete Multi-Frequency Transform).
In prior art of DFT, in order to judge a DTMF signal “3”, five points of K=96˜92 (frequency tolerance range ±2.5% of 1477 Hz) and three points of K=45˜43 (frequency tolerance range ±2.5% of 697 Hz) have to be calculated, i.e. the value of X[k] must be calculated 8 times consecutively. But in the present invention the value of X[k] is only calculated once for each frequency. To detect a DTMF signal “3”, a high frequency and a low frequency are required for calculation of X[k], the mathematical formula is as below:
M is the length of k. If k=96˜92, then M is 5; if k=45˜43, then M=3. The cosine value and the sine value can be added individually, and then multiplied with x[n] so as to save a lot of calculation.
However, when the cosine value and the sine value are added individually, elimination or superposition of the phase will occur to make a smooth wave become a continuous trembling wave. Therefore the present invention adds a θ degree to control the wave shape, so that there is no trembling wave in the Pass-band of the frequency domain, or to reduce the trembling degree thereof, and make it work as a square wave filter like Butterworth or Chebyshev. Renew the formula as below:
The scope of the present invention depends upon the following claims, and is not limited by the above embodiments.