6c7798e956ce113417a02e114e1738a06065dae9
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 #Usage example: arecord 2>/dev/null | ./dtmf.sh
8 .
/goertzel
-i -q -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
12 pos
="$(echo "$line" | cut -f 1)";
14 #Get values for each tone
15 a
="$(echo "$line" | cut -f 2)";
16 b
="$(echo "$line" | cut -f 3)";
17 c
="$(echo "$line" | cut -f 4)";
18 d
="$(echo "$line" | cut -f 5)";
19 e
="$(echo "$line" | cut -f 6)";
20 f
="$(echo "$line" | cut -f 7)";
21 g
="$(echo "$line" | cut -f 8)";
22 h
="$(echo "$line" | cut -f 9)";
24 #Compare values to treshold
25 test $a -gt $tresh && a
=true || a
=false
26 test $b -gt $tresh && b
=true || b
=false
27 test $c -gt $tresh && c
=true || c
=false
28 test $d -gt $tresh && d
=true || d
=false
29 test $e -gt $tresh && e
=true || e
=false
30 test $f -gt $tresh && f
=true || f
=false
31 test $g -gt $tresh && g
=true || g
=false
32 test $h -gt $tresh && h
=true || h
=false
34 #echo "$pos: $a $b $c $d $e $f $g $h";
35 state
="$a$b$c$d$e$f$g$h";
37 #Test if tones changed since last time
38 #echo test "$state" != "$last"
39 test "$state" != "$last" && {
This page took 0.311783 seconds and 3 git commands to generate.