This article explains how to implement a 1D FFT -
How to implement the FFT algorithm[
^]
For simplicity, I would suggest you try with a DFT first. The processing may be slow, but its much simpler to implement. This page contains both a description and a code listing of both FFT and DFT:
http://paulbourke.net/miscellaneous/dft/[
^]
The simplest peak detection method is finding values above the mean of all samples and looking for changes in slope. Copying this from another
post:
Between any two points in your data, (x(0),y(0)) and (x(n),y(n)), add up y(i+1)-y(i) for 0 <= i < n and call this T ("travel") and set R ("rise") to y(n)- y(0) + k for suitably small k. T/R > 1 indicates a peak. This works OK if large travel due to noise is unlikely or if noise distributes symmetrically around a base curve shape. For your application, accept the earliest peak with a score above a given threshold, or analyze the curve of travel per rise values for more interesting properties.
----
For simplicity I would recommend using a ready-made library over trying to write the whole algorithm. I would stick to C# over C++.
Try this:
http://www.tapiex.com/ToneDecoder.Net.htm[
^]
It can easily decode DTMF from an Audio file or a stream, which is what I assume you are after.
They have some help files here:
http://www.tapiex.com/TDNet_Help/[
^]
From their manual:
PhoneToneDecoder decode variant of tone signals such as DTMF, Caller-ID, TTY, SAME etc.
There are three ways to feed the audio data to this component.
From the file (.wav, .mp3, .raw etc).
Stream data capture by WaveEx control
Stream data feed by manually via WaveStreamInput method.
-----
What you can also do is record the WAV file then decode it. I have had good success using the
NAudio library with C# earlier. The library also has functions to compute the FFT.
Consider this tutorial series:
http://www.youtube.com/watch?v=6XvWRzWzgNI[
^]
You can also try this:
http://msdn.microsoft.com/en-us/library/ff827802.aspx[
^]