2 #This is sample implementation of DTMF decoder using my C implementation of Goertzel Algorithm
3 #This is not very efficient or precise, it's just proof of concept
4 #Note that it's also quite tricky (but not imposible) to detect DTMF using microphone
5 #You will probably need to tune treshold and mixer settings a bit...
6 #I've had best results using dtmfdial (Linux software) and two soundcards connected directly using cable
7 #Usage example: arecord 2>/dev/null | ./dtmf.sh
11 .
/goertzel
-i -q -a -r 8000 -s 400 -t $tresh -f 697 -f 770 -f 852 -f 941 -f 1209 -f 1336 -f 1477 -f 1633 $@ |
while read line
; do
15 pos
="$(echo "$line" | cut -f 1)";
17 #Get values for each tone
18 a
="$(echo "$line" | cut -f 2)";
19 b
="$(echo "$line" | cut -f 3)";
20 c
="$(echo "$line" | cut -f 4)";
21 d
="$(echo "$line" | cut -f 5)";
22 e
="$(echo "$line" | cut -f 6)";
23 f
="$(echo "$line" | cut -f 7)";
24 g
="$(echo "$line" | cut -f 8)";
25 h
="$(echo "$line" | cut -f 9)";
27 #Compare values to treshold
28 test $a -gt $tresh && a
=true || a
=false
29 test $b -gt $tresh && b
=true || b
=false
30 test $c -gt $tresh && c
=true || c
=false
31 test $d -gt $tresh && d
=true || d
=false
32 test $e -gt $tresh && e
=true || e
=false
33 test $f -gt $tresh && f
=true || f
=false
34 test $g -gt $tresh && g
=true || g
=false
35 test $h -gt $tresh && h
=true || h
=false
37 #echo "$pos: $a $b $c $d $e $f $g $h";
38 state
="$a$b$c$d$e$f$g$h";
40 #Test if tones changed since last time
41 #echo test "$state" != "$last"
42 test "$state" != "$last" && {
This page took 0.287243 seconds and 4 git commands to generate.