jDTMF – real-time, event based DTMF detection in pure java
jDTMF provides an event based DTMF tone detection library that is implemented in pure java. The library can be used to detect DTMF tones from several sources including in real-time from a sound card. It can also detect DTMF digits from a PCM audio file.
What is DTMF?
DTMF tones are also commonly known as “touch-tones”. Most people know these sounds as the tones that a phone makes when you press a button on the keypad.
DTMF tone encodings are defined by the presence of two simultaneous tones.
1209 Hz |
1336 Hz |
1477 Hz |
1633 Hz |
|
697 Hz |
1 | 2 | 3 | A |
770 Hz |
4 | 5 | 6 | B |
852 Hz |
7 | 8 | 9 | C |
941 Hz |
* | 0 | # | D |
For instance, the ‘3’ code is said to be present when 697Hz and 1477Hz are found to exist at the same time, above a given noise threshold and last for a duration of at least 45 milli-seconds. If only one of the frequencies is present, then the ‘3’ code has not been signaled.
In addition to the DTMF keypad tones, the DTMF specification also includes what are known as “event” frequencies.
440 Hz |
480 Hz |
620 Hz |
|
350 Hz |
Dial tone |
||
440 Hz |
Ringback (US only) |
||
480 Hz |
Busy Signal |
A Graphical DTMF Detector
This application detects DTMF “touch” tones and presents the relative magnitude of the component frequencies.
The Goertzel algorithm
The Goertzel algorithm is particularly suited to detection of specific, pre-defined frequencies within a signal using a minimal number of memory and computation resources. In particular, the Goertzel algorithm has seen a lot of use detecting DTMF frequencies within audio signals. In addition to DTMF tones, the algorithm is also well suited to the detection of CTCSS (squelch tones) used by mobile two-way radio systems. This algorithm is frequently implemented in microcontroller devices where both processing power and RAM limitations prevent the use of other algorithms such as the FFT.
WikiPedia provides a well done introductory article on the Goertzel algorithm and an example implementation in C.
Embedded System Design has a fantastic article about the Goertzel algorithm. This article provides a C
implementation of the algorithm , from which I ported the java version included in the source below…
jDTMF Library
2/25/2010: The library is currently re-written and will be made available under a commercial license.
Goals of the rewrite include:
- Increased performance
- Modular design
- Event/callback based interaction
- More detection configuration to increase accuracy
- JUnit test suite with audio test files for input
Copyright 2004-2010 Henry Ranch LLC.