X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=c%2Fgoertzel%2Fdtmf.sh;h=e01571ed3050d484248dbf5a546058f399b2dfa2;hb=cdfd4745d68315dcefbe2ab2f77bb3a1438dd3f3;hp=6c7798e956ce113417a02e114e1738a06065dae9;hpb=59934436c41da5c999a065638d2e951a34110b03;p=mirrors%2FPrograms.git diff --git a/c/goertzel/dtmf.sh b/c/goertzel/dtmf.sh index 6c7798e..e01571e 100755 --- a/c/goertzel/dtmf.sh +++ b/c/goertzel/dtmf.sh @@ -1,11 +1,14 @@ #!/bin/bash #This is sample implementation of DTMF decoder using my C implementation of Goertzel Algorithm #This is not very efficient or precise, it's just proof of concept +#Note that it's also quite tricky (but not imposible) to detect DTMF using microphone +#You will probably need to tune treshold and mixer settings a bit... +#I've had best results using dtmfdial (Linux software) and two soundcards connected directly using cable #Usage example: arecord 2>/dev/null | ./dtmf.sh -tresh=3 +tresh=10 last=''; -./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 +./goertzel -n B -q -l c -r 8000 -d 20 -t $tresh -f 697 -f 770 -f 852 -f 941 -f 1209 -f 1336 -f 1477 -f 1633 $@ | while read line; do #echo "$line"; #Get time @@ -21,16 +24,6 @@ last=''; g="$(echo "$line" | cut -f 8)"; h="$(echo "$line" | cut -f 9)"; - #Compare values to treshold - test $a -gt $tresh && a=true || a=false - test $b -gt $tresh && b=true || b=false - test $c -gt $tresh && c=true || c=false - test $d -gt $tresh && d=true || d=false - test $e -gt $tresh && e=true || e=false - test $f -gt $tresh && f=true || f=false - test $g -gt $tresh && g=true || g=false - test $h -gt $tresh && h=true || h=false - #echo "$pos: $a $b $c $d $e $f $g $h"; state="$a$b$c$d$e$f$g$h";