Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C C# Windows audio
Hello,
 
I try to find a method in C/C++ or C# to detect a sound (DTMF code) from a microphone in Windows. Currently, I can not find a simple method (FFT off and acoustic fingerprint) to know what is a DTMF sound. Would you know if there are libraries (with examples to understand) or an effective method to get there. I look with Microsoft TAPI to see without knowing how to use it.
 
With C#, I found the DTMFrecognitionEngine on MSDN but I did not find examples to understand how it works.
 
I want a simple method for now in order to realize such a simple demonstration.
 
If someone has an idea, I am interested
 
cordially
Posted 18-Jul-12 5:20am
Edited 18-Jul-12 5:29am
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

See these?:
http://sourceforge.net/projects/dtmf/[^]
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en536955[^] (this one is for PIC processors but the algorithms might be available in C)
 
Found another Java implementation:
http://henryranch.net/software/java-dtmf-detector/[^]
  Permalink  
Comments
RandSirpi at 18-Jul-12 12:18pm
   
Hello,
 
thank you for these addresses,
 
I knew that of sourceforge (there is a version in C # and another in Java in addition to the C++) but I did not understand how a sound, he could convert DTMF code.
 
For jDTMF, I had used to understand the theory but I have not been unable to find the code to understand and offer a version in C# or C+.
 
Sincerely,
Albert Holguin at 18-Jul-12 12:55pm
   
So what you're asking is how the whole technology works?
RandSirpi at 19-Jul-12 6:14am
   
hello,
 
yes, I try to understand how even a pseudo-code how to make a recognition code of the DTMF key telephone keypad. I understand the theory but do not how to achieve. I thought to play a sound, try to break a two-frequency sound to know its high frequency and low frequency but I do not know how.
 
Sincerely,
Albert Holguin at 19-Jul-12 10:38am
   
Well, the gist of it is that you have to take the audio samples (PCM) and do an FFT on them. The FFT will give you a frequency domain representation of the signal, from there, you need some sort of "detection" algorithm that will identify the peaks within the audible tone range (just under 4kHz range). There's various ways of doing the detection portion and that's up to the implementation.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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[^]
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 369
1 Sergey Alexandrovich Kryukov 294
2 Maciej Los 270
3 George Jonsson 185
4 PIEBALDconsult 175
0 Sergey Alexandrovich Kryukov 10,934
1 Maciej Los 5,614
2 OriginalGriff 5,603
3 CPallini 3,879
4 BillWoodruff 3,579


Advertise | Privacy | Mobile
Web02 | 2.8.141030.1 | Last Updated 27 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100