如何检测DTMF声音? [英] How to detect a DTMF sound?

查看:269
本文介绍了如何检测DTMF声音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我尝试在C / C ++或C#中找到一种方法来检测Windows中麦克风的声音(DTMF代码)。目前,我找不到简单的方法(FFT关闭和声学指纹)来了解什么是DTMF声音。你知道是否有图书馆(有例子可以理解)或有效的方法去那里。我看看微软TAPI看不知道如何使用它。



使用C#,我在MSDN上找到了DTMFrecognitionEngine,但我没有找到实例来了解它是如何工作的。



我现在想要一个简单的方法来实现这么简单的演示。



如果有人有个主意,我感兴趣



亲切地

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

推荐答案

看到这些?:

http://sourceforge.net/projects/dtmf/ [ ^ ]

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en536955 [ ^ ](这个用于PIC处理器,但算法可能在C中可用)



发现另一个Java实施:

http://henryranch.net/software/java-dtmf-detector/ [ ^ ]
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/[^]


本文介绍如何实现一维FFT - 如何实现FFT算法 [ ^ ]



为简单起见,我建议您先尝试使用DFT。处理可能很慢,但实现起来要简单得多。此页面包含FFT和DFT的描述和代码清单: http://paulbourke.net/miscellaneous/dft/ [ ^ ]



最简单的峰值检测方法是找到高于所有样本平均值的值并寻找斜率的变化。从另一个帖子中复制此内容:



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.





----



为简单起见,我建议使用现成的库而不是尝试编写整个算法。我会坚持C#而不是C ++。



试试这个: http ://www.tapiex.com/ToneDecoder.Net.htm [ ^ ]

它可以轻松地从音频文件或流中解码DTMF,这是我认为你所追求的。



他们在这里有一些帮助文件: http://www.tapiex.com/TDNet_Help/ [ ^ ]



来自他们的手册:



----

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.





---- -



您还可以记录WAV文件然后对其进行解码。我之前使用C#使用 NAudio 库取得了很大的成功。该库还具有计算FFT的功能。

考虑本教程系列: http:// www .youtube.com / watch?v = 6XvWRzWzgNI [ ^ ]



你也可以试试这个: http://msdn.microsoft.com/en-us/library/ff827802.aspx [ ^ ]



-----

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


Of course, because of the Shannon-Nyquist theorem, you'd have to compare at least two detected frequencies next to each other and only leave the one with the loudest tone in.
Maybe run an iteration over it beforehand and erase the more silent tones next to each other.
You could probably even better only detect the exact frequencies of the 4x4 matrice and don't run a complete detection over the spectrum.
I know that it was sloppy.
But two tests showed that it still worked. At least with no disturbing noise around it.
I'll explain it: if you let echo a tone with the amplitude of the slope on every signal position ( next value versus previous is the amplitude of the sinus wave echoed on that position) and repeat that over several signal positions, if the echoed tone is in the signal, there will be an amplification. Otherwise, other tones will not be amplified but blocked. Ever noticed that when you sing along with the pitch in which a string is tuned, that it will start to ring? Also, besides octaves, fifths, fourths and after that major thirds upwards will also be activated, but less loud. Because of that fact, you could accelerate the detection recursively if you started some octaves higher and only hangled down if the amplitude was over a threshold.


这篇关于如何检测DTMF声音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆