在Python中解析(提取)DTMF
如果我有一个录制的音频文件(MP3),有什么方法可以找出用纯Python录制的DTMF音吗?
(如果纯Python不可用,那么Java也可以。重点是它应该能够在Google Appengine中运行)
If I have a recorded audio file (MP3), is there any way to get the figure out the DTMF tones that were recorded in pure Python?
(If pure python is not available, then Java is okay too. The point being that it should be able to run in Google Appengine)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,您需要以给定的位深度和采样率将 MP3 解码为原始样本的未压缩格式。然后查找构成每个 DTMF 音调的频率。虽然 FFT 可用于此目的,但规范的算法是 Goertzel 算法,它利用了这样一个事实:在进行转换之前您知道自己关心的频率:http://en.wikipedia.org/wiki/Goertzel_algorithm
确实存在一些使用 Goertzel 检测 DTMF 的免费 python 代码,尽管我自己还没有尝试过,看一下:
http://johnetherton.com/projects/pys60-dtmf-detector
First you will need to decode the MP3 into an uncompressed format of raw samples at a given bit depth and sampling rate. Then you look for the frequencies that make up each DTMF tone. Though FFT can be used for this, the cannonical algorithm is The Goertzel Algorithm, which makes use of the fact that you know what frequencies you care about before doing the transformation: http://en.wikipedia.org/wiki/Goertzel_algorithm
There does exist some free python code for detecting DTMF using a Goertzel, though I haven't tried it myself, take a look at:
http://johnetherton.com/projects/pys60-dtmf-detector
对数据进行 FFT。您应该在两个音调的频率处得到尖峰。
Do an FFT on the data. You should get spikes at the frequencies of the two tones.