Skip to content

MATLAB project to detect DTMF tones from audio signals using FFT analysis and dynamic skipping.

License

Notifications You must be signed in to change notification settings

kubojion/dtmf-tone-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DTMF Tone Detection using FFT and Dynamic Skipping

Author: Jion Kubo Date: 26.04.2025 GitHub: https://github.com/kubojion Contact: kubojion@gmail.com License: MIT License

Description

This project implements a simple and effective DTMF (Dual-Tone Multi-Frequency) tone decoder. It detects the sequence of keypad tones from an input audio file using FFT analysis and dynamic threshold skipping to avoid repeated detections.

The algorithm is designed to work on clean or moderately noisy audio signals and can handle standard telephone DTMF tones.

Project Structure

The project consists of two MATLAB files:

  • run_dtmf.m: Main demo script to load an audio file, call the decoder, and display results.

  • decode_dtmf.m: Function that performs DTMF tone detection from the given audio signal.

Dependencies

  • MATLAB (any version supporting basic functions like fft, audioread, inputParser)
  • No toolboxes required

How It Works

  1. Reads a .wav audio file (mono recommended).
  2. Selects only the first channel if stereo.
  3. Analyzes short overlapping frames using FFT.
  4. Identifies peaks at known DTMF frequencies.
  5. Applies thresholding to decide if a button is pressed.
  6. Dynamically skips frames while the tone remains active to avoid double-counting.
  7. Outputs the detected sequence of keys.

Usage

  1. Place your .wav file (recorded DTMF tones) in the same folder.
  2. Open run_dtmf_demo.m and modify the audioFile variable to your file name.
  3. Run run_dtmf_demo.m in MATLAB.
  4. The console will display detected keypad sequence.

Example

Audio file: output_audio.wav Sampling rate: 44100 Hz Window length: 2048 samples Detected keys: 1234567890#

Customization

Optional parameters in decode_dtmf.m:

  • 'AmplitudeThreshold' (default 1e-3) Minimum spectral amplitude for detecting a tone.

  • 'SkipFraction' (default 0.8) Fraction of detected peak magnitude used for dynamic skipping.

You can also manually change the FFT window length (Nw) by editing the helper function chooseWindowLength(fs).

Choosing Window Size (Nw)

  • If fs > 44100 Hz, window size = 8192 samples (for higher frequency resolution)
  • Otherwise, window size = 2048 samples (better time resolution)

Feel free to adjust Nw if you encounter very fast or very slow tone sequences.

Notes

  • Mono audio is recommended. Stereo files will use only the first channel.
  • Works best with sampling rates around 44100 Hz or 48000 Hz.

License

MIT License

Acknowledgements

This project was initially developed for a university project in DFT signal analysis and was extended for general DTMF detection.

About

MATLAB project to detect DTMF tones from audio signals using FFT analysis and dynamic skipping.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages