\documentclass[12pt]{article}
\usepackage{times}
\usepackage{latexsym}
\usepackage{xspace}
\usepackage{amssymb,amsmath}
\usepackage{times}
\usepackage{epsfig}
\usepackage{html}
\setlength {\topmargin} {0 mm}
\setlength {\headsep} {0 mm}
\setlength {\headheight} {0 in}
\setlength {\voffset} {0 mm}
\setlength {\oddsidemargin} {0 mm}
\setlength {\evensidemargin} {0 mm}
\setlength {\hoffset} {0 mm}
\setlength {\textwidth} {6.5 in}
\setlength {\textheight} {9 in}
\newcommand{\IIR}[0]{IIR }
\newcommand{\FIR}[0]{FIR }
\newcommand{\DTMF}[0]{DTMF }
\newcommand{\FFT}[0]{FFT }

\begin{document}
  \title{Dual-Tone Multiple Frequency Detection and Estimation}
  \author{Nicholas Kottenstette}
  \maketitle
  \section{Derivation of \DTMF Generator}
  A dual-tone signal, \(x(n)\), consists of two sinusoidal signals,
  \(x_{\omega_{l}}(n)\) and \(x_{\omega_{h}}(n)\), representing the respective low and
  high frequency component of the signal.  Instead of resorting to
  solving a Taylor Series expansion of \(sin(\omega n)\) to generate the
  tones we can use a marginally stable \IIR filter.  The z-transform
  of \(sin(\omega n)\) is given in (\ref{Eq:1}).
  \begin{equation}\label{Eq:1}
    X_{\omega}(z) = \frac{z^{-1}sin(\omega)}{1 - 2z^{-1}\cos(\omega)+z^{-2}}
  \end{equation}
  The corresponding difference equation, will have the form given in
 (\ref{Eq:2}),
  \begin{equation}\label{Eq:2}
    x_{\omega}(n) = 2\cos(\omega) x_{\omega}(n-1) -  x_{\omega}(n-2);
    x_{\omega}(0) = 0, x_{\omega}(1) = \sin(\omega)
  \end{equation}
  Similar results have been cited in works such as those by
  \cite{proakis}.  With these results, a dual-tone signal can be
  generated using (\ref{Eq:3}), noting that \((f_{l},f_{h})\)
  represent the respective dual-tone frequency pairs on a touch-tone
  phone \cite{stevenson}.  
  \begin{equation}\label{Eq:3}
    x(n) =  x_{\omega_{l}}(n) + x_{\omega_{u}}(n); \omega_{l} =
    2\pi\frac{f_{l}}{Fs}, \omega_{h} =
    2\pi\frac{f_{h}}{Fs} 
  \end{equation}
  The low-tone frequencies, for this project were specifically taken
  from the corresponding set \(f_{l} = \{687, 770, 852, 941\}\) Hz.  
  The high-tone frequencies, for this project were specifically taken
  from the corresponding set \(f_{h} = \{1209, 1336, 1447, 1633\}\)
  Hz.  Before, concluding this derivation, we would like to emphasize
  that the difference equation given in (\ref{Eq:2}) lends itself for
  various parametric algorithms for PSD estimation of sinusoids in
  additive white noise, see \cite{proakis2} for additional details.
  \section{Derivation of \DTMF Detector}
  The \DTMF detector analyzes the input data in the following steps:
\begin{enumerate}
\item Filter input data, \(x(n)\), with a band-bass filter with pass-bands
centered at \DTMF-tones frequencies.  The output of the filtered tone
data will be referred to as \(xf(n)\).
\item After applying filter, scale outputs to have \(+/- 1.0\)
peak-to-peak range.
\item Calculate PSD of \(xf(n)\) using the Welch Method specifying the
\FFT length, \(fftlen\), the data-segment step size, \(D\), the
data-window size, \(M\), the segment averaging data length, \(L\), and
the window, \(w(n)\).  See \cite{proakis3} for additional details.
The resulting output, \(E(k,i)\) corresponds to the resulting Welch
PSD estimate at index \(k\) and \(i\).  The \(k\) index corresponds to
the frequency, \(F_{k} = \frac{Fs \times k}{fftlen}\).  The \(i\)
index corresponds to the Welch PSD estimate of the windowed data
starting at \(xf(iD+m), m \in {0,1,...,M}\).  N.B. the exact indexing
of i is slightly modified, there is an abuse in notation, in
the software implementation.  Since we are sliding a Welch PSD
estimate along our sampled data.  The Welch calculation will actually
be the average of the \(Nw\) samples centered at index \(i\).  Refer
to the code to fill in any missing details, specifically:
\begin{verbatim}calc_psd_welch(x,D,M,w,fft_len,Nw) in dtmf_det.m \end{verbatim}
\item Remove unnecessary PSD information, the powers at frequencies we
are not interested in.  Then determine the peak power within the
frequency-bands of interest.  This is to account for the variance in
the \DTMF tones.  Refer to: \begin{verbatim}freq_peaks(E,fmin,fmax,Fs) in dtmf_det.m\end{verbatim}
\item Apply maximum-likelihood detection, by eliminating possible
tones, through a threshold-detection scheme.  In which tones are only
valid if a pair of low and high frequency tones exceed a given
threshold level, \(Thresh\), for \(Nt\) consecutive tones relative to
index \(i\).  Refer to: \begin{verbatim}tone_detect(E,Nt,...,f_name) in dtmf_det.m\end{verbatim}
\end{enumerate}

The differential scheme is the same as the above, except that a second
band-pass filter is applied to detect voice disturbances in the
harmonics of the tones we are trying to detect, \(xhf(n)\).  We apply
the same processing to \(xhf(n)\) to generate a
decimated-frequency-peak estimate of the harmonic tones.  We then
subtract the tone estimate, \(Ep\), from the harmonic estimate,
\(Eph\), resulting in a differential estimate, \(Edif\).  Which we
then apply at point 5 in the above algorithm.  Refer to:
\begin{verbatim}
%dtmf_det.m
if en_di
  Edif = Ep - Eph;
else
  Edif = Ep;
end
\end{verbatim} 
The bandpass-filter was a linear-phase \FIR filter, in order to keep a
constant group delay of the data.  The implementation is a slight
modification of the audio equalizer developed and discussed by
\cite{Kottenstette}.
\begin{thebibliography}{4}
\bibitem{proakis} John G. Proakis, Dimitris G. Manolakis, {\it Digital
  Signal Processing Principles, Algorithms, and
  Applications}. Prentice-Hall, Inc., 1996. (pp. 352--354)
\bibitem{stevenson} Robert L. Stevenson,
\htmladdnormallink{EE598D -- Project \#2}
{http://www.nd.edu/~rls/EE598D/proj2.html}
\bibitem{proakis2} John G. Proakis, Dimitris G. Manolakis, {\it Digital
  Signal Processing Principles, Algorithms, and
  Applications}. Prentice-Hall, Inc., 1996. (pp. 948--956)
\bibitem{proakis3} John G. Proakis, Dimitris G. Manolakis, {\it Digital
  Signal Processing Principles, Algorithms, and
  Applications}. Prentice-Hall, Inc., 1996. (pp. 911--913)
\bibitem{Kottenstette} Nicholas E. Kottenstette,
\htmladdnormallink{EE598D  -- Project \#1 Report}{http://www.nd.edu/~nkottens/ee598D/project1/index.html}
\end{thebibliography}
\end{document}
