Search code examples
javaandroidaudiodtmf

Generation and detection of tones


I am looking for a successful method to identify self-generated sounds.

My idea is to spend even two different sounds over stereo. The two tones differ in their frequency. The tones I turn then back on a self-made cables for the microphone. The cable has two switches, which switches between the left or the right channel.

I want to note which of the two frequencies arrived at the microphone input, and then count them.

I've tried many things, but nothing brought the desired success. Well, I came across DTMF, but the implementation in Android is insufficient.

Does anyone have any idea what I can try next?


Solution

  • You need to take the Fast Fourier Transform (FFT) of the input audio. What you would need to do is capture a short window of audio, run an FFT, and then analyze the result. FFTs are a bit a complicated if you're not familiar with them, but it's possible to count and measure tones, provided that they're sufficiently separated in frequency.