1

I need to detect the keys pressed in the wav file using the FFT. But I'm completely stuck with it, just don't know what to do. I have read that you can detect the tones with the help of Goertzel algorythm, but, again, I haven't found nor explanation for it nor any example of working code.

Can someone please share with me an algorithm how to solve this problem?

  • There are tons of questions about this here on SO already - search for dtmf or goertzel. (Forget about using FFT for this.) E.g. https://stackoverflow.com/questions/22189644/dtmf-detection-using-goertzel-algorithm – Paul R Mar 22 '20 at 21:33
  • I would like to but the task is to use the Discrete Fourier Transform. – Musorski Pavel Mar 22 '20 at 22:01
  • You said Goertzel in the question. There are questions re DTMF and FFT also, e.g. https://stackoverflow.com/questions/3743708/how-get-low-frequency-from-dtmf-tone – Paul R Mar 22 '20 at 22:43
  • I still don't understand how Goertzel is connected with the DTMF and John Etherton's module throws me errors when decoding one of my wav files – Musorski Pavel Mar 23 '20 at 12:16
  • Think of Goertzel as one bin of a DFT. You can use a DFT or FFT to get N evenly spaced frequency bins, or just implement one or more Goertzel algorithms for each frequency of interest (so you’d have 8 of these for DTMF decoding). – Paul R Mar 23 '20 at 12:20
  • @Paul R, I have written some code using the FFT. I sliced my data into segments and made a abs(fft) on each. HERE IS THE CODE: y = [dataS(:, 1)',dataS(:, 2)']; n = length(y); p = abs(fft(y)); f = (freq/n)*(0:n-1); plot(f,p); axis([500 1800 0 1000]) xlabel('f(Hz)') title('Power') FINALLY,I got a plot like this: https://imgur.com/tDiesFu Is there any function how to get the values of these two peaks? – Musorski Pavel Mar 23 '20 at 16:30
  • That’s a good start - now you just need to find the indices of these two peaks and convert the indices to frequency in Hz. See [this answer](https://stackoverflow.com/a/4371627/253056). – Paul R Mar 23 '20 at 17:40

0 Answers0