DTMF FAQ - Telephone Tone Dialing chips. DTMF means: Dual Tone Multi-Frequency...
I like to thank all of you who think this faq was usefull, especially the ones who wrote me e-mail . I was very suprised to see this faq appear in the most strange places on the Net :) Anyway...have fun with those di-du-dit-di-duh tones :)
11. DTMF in C (on a PC) by Kirk Hobart
#include #include #include #include #define #define #define #define #define #define #define
<stdio.h> <math.h> BITS 0xFF00 NOISE 0 /* enable noise shaper */ TON 0.100 /* tone duration */ TOFF 0.100 /* silence duration */ RAMP 0.002 /* tone rise and fall time */ RATE 11025.0 /* sample rate */ numberof(n) (sizeof(n)/sizeof(*n))
struct { char letter; double f1, f2; } button[] = { {'1', 697, 1209}, {'2', 697, 1336}, {'3', 697, 1477}, {'A', 697, 1633}, {'4', 770, 1209}, {'5', 770, 1336}, {'6', 770, 1477}, {'B', 770, 1633}, {'7', 852, 1209}, {'8', 852, 1336}, {'9', 852, 1477}, {'C', 852, 1633}, {'*', 941, 1209}, {'0', 941, 1336}, {'#', 941, 1477}, {'D', 941, 1633}, {'X', 20, 20}, {'Y', 100, 100}, {'Z', 500, 500}, }; int main(void) { double t, v=0; char c; int value=0, n; FILE *fout; puts("Press 123A456B789C*0#D to digitize DTMF-tones to file. Fs=11025.