简体   繁体   English

Android中的DTMF接收

[英]DTMF receiving in Android

my main goal is to get DTMF tones in my Android app and perform related actions.我的主要目标是在我的 Android 应用程序中获得 DTMF 音并执行相关操作。 I've seen that TelephonyManager can send DTMF but there is no method to receive them .我已经看到 TelephonyManager 可以发送 DTMF 但没有接收它们的方法 I came across many pages (most of them quite old) which suggest the use of FFT libraries through buffering the VOICE_DOWNLINK audio stream with AudioRecorder (setting proper permissions in the manifest).我遇到了许多页面(其中大部分都很旧),它们建议通过使用 AudioRecorder 缓冲VOICE_DOWNLINK音频 stream 来使用 FFT 库(在清单中设置适当的权限)。 I tried both with AudioRecorder and MediaRecorder (which is mainly intended for creating file) as well as "Visulizer" class which contains a proper getFft methos out of the box but none of them can access MediaRecorder.AudioSource.VOICE_DOWNLINK & co even if permissions are correctly managed and granted.我尝试使用 AudioRecorder 和 MediaRecorder(主要用于创建文件)以及“Visulizer”class,其中包含开箱即用的正确 getFft 方法,但即使权限是,它们都无法访问 MediaRecorder.AudioSource.VOICE_DOWNLINK & co正确管理和授予。

uses-permission android:name="android.permission.RECORD_AUDIO"使用权限 android:name="android.permission.RECORD_AUDIO"

None of the Visualizer/MediaRecorder/AudioRecorder get initialized and I'm getting frustrated by the fact that I'm chasing after record permissions in order to listen for DTMF tones. Visualizer/MediaRecorder/AudioRecorder 都没有被初始化,我对我正在追逐记录权限以收听 DTMF 音调感到沮丧。 Is there any other way I'm not considering?还有其他我不考虑的方法吗?

After many research it appears impossible since经过多次研究,这似乎是不可能的,因为

  1. There is no DTMF listen method (Google... why??)没有 DTMF 监听方法(谷歌...为什么??)
  2. There are limitation accessing other's phone audio to FFT. FFT 访问其他电话音频有限制。 Especially related to this last point I've seen that basically all app based on a common used Google/GitHub code ( https://github.com/pjasiun/dtmf-decoder ) crashes from a certain SDK during calls.特别是与最后一点相关,我看到基本上所有基于常用 Google/GitHub 代码( https://github.com/pjasiun/dtmf-decoder )的应用程序在通话期间从某个 SDK 崩溃。 They all work fine with phone mic which is useless for phonecalls他们都可以很好地使用电话麦克风,这对电话来说毫无用处

Leaving this post for other people.把这篇文章留给其他人。 For my purposes I resolved with an Arduino DTMF recognizer.出于我的目的,我使用 Arduino DTMF 识别器解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM