Hi all. I�m trying to implement the goertzel algorithm in C#, but without good results. The steps I'm trying are: 1) I perform a goertzel for each of the frequencies in the table (lows and highs). For Low ones I use N=212 and 106 for High ones. 2) Save the highest ones (Low and High) 3) Then I perform 4 more goertzel for Low Freq (+/-)1.5%(+/-)2Hz and the same for High ones, to verify 2nd Harmonics 4) I search in the table the corresponding number and show it I'm using a sample rate of 8000 and a buffer size of 8K The program show me numbers without any logic, I mean. When there are no DTMF, the system, tell me they are. Which is the minimum value to compare to, I mean. Is there a minimum threshold to know if the magnitude for this freq are valids?. Thanks in advance

# DTMF Detection

Started by ●January 3, 2006

Reply by ●January 4, 20062006-01-04

dkurman wrote:> Hi all. I�m trying to implement the goertzel algorithm in C#, but without > good results. > > The steps I'm trying are: > > 1) I perform a goertzel for each of the frequencies in the table (lows and > highs). For Low ones I use N=212 and 106 for High ones. > 2) Save the highest ones (Low and High) > 3) Then I perform 4 more goertzel for Low Freq (+/-)1.5%(+/-)2Hz and the > same for High ones, to verify 2nd HarmonicsIf you're going to use the second harmonic test, you only need to test two frequencies. If you get one and only one hit on the row freqs, and one and only one hit on the column freqs, then (and only then) should you bother with the second harmonic test, and it should be the 2nd harmonic of the two freqs that were "hot." But even with this improvement, there's a better way (see below).> 4) I search in the table the corresponding number and show it > > I'm using a sample rate of 8000 and a buffer size of 8K > > The program show me numbers without any logic, I mean. When there are no > DTMF, the system, tell me they are. > > Which is the minimum value to compare to, I mean. Is there a minimum > threshold to know if the magnitude for this freq are valids?. >Yes. A better approach than the second harmonic test is a Parseval's relation test. If the two DTMF frequencies contain ~80%-90% of the signal's total energy, it's DTMF (assuming twist tests pass). -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 Today is the last day of your life so far.

Reply by ●January 7, 20062006-01-07

Thanks for the response. I�m going to try this. By the way, you said if the two DTMF frequencies contain ~80%-90% of the signal's total energy is DTMF, but how can I find out this total energy?, I mean, I only have the energy corresponding to the low freq and High freq, but not the total one. Thanks again>dkurman wrote: >> Hi all. I�m trying to implement the goertzel algorithm in C#, butwithout>> good results. >> >> The steps I'm trying are: >> >> 1) I perform a goertzel for each of the frequencies in the table (lowsand>> highs). For Low ones I use N=212 and 106 for High ones. >> 2) Save the highest ones (Low and High) >> 3) Then I perform 4 more goertzel for Low Freq (+/-)1.5%(+/-)2Hz andthe>> same for High ones, to verify 2nd Harmonics > >If you're going to use the second harmonic test, you only need to test >two frequencies. If you get one and only one hit on the row freqs, and >one and only one hit on the column freqs, then (and only then) should >you bother with the second harmonic test, and it should be the 2nd >harmonic of the two freqs that were "hot." > >But even with this improvement, there's a better way (see below). > >> 4) I search in the table the corresponding number and show it >> >> I'm using a sample rate of 8000 and a buffer size of 8K >> >> The program show me numbers without any logic, I mean. When there areno>> DTMF, the system, tell me they are. >> >> Which is the minimum value to compare to, I mean. Is there a minimum >> threshold to know if the magnitude for this freq are valids?. >> > >Yes. A better approach than the second harmonic test is a Parseval's >relation test. If the two DTMF frequencies contain ~80%-90% of the >signal's total energy, it's DTMF (assuming twist tests pass). > >-- >Jim Thomas Principal Applications Engineer Bittware, Inc >jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 >Today is the last day of your life so far. >

Reply by ●January 9, 20062006-01-09

Ok. Now I have changed the way I get the results. First of all, I get the goertzel of all the freq (lows and highs) and then I find the highest two magnitude. This two freq, should be one from high and the other from low, in case we have a DTMF incoming. But here is the problem. When I press 1 I have these two freq as: 697 and 770 (both from low) and this should be 697 and 1209. Is this correct or I'm doing this in a wrong way?. Thanks>Thanks for the response. I�m going to try this. By the way, you said ifthe>two DTMF frequencies contain ~80%-90% of the signal's total energy isDTMF,>but how can I find out this total energy?, I mean, I only have theenergy>corresponding to the low freq and High freq, but not the total one. > >Thanks again > >>dkurman wrote: >>> Hi all. I�m trying to implement the goertzel algorithm in C#, but >without >>> good results. >>> >>> The steps I'm trying are: >>> >>> 1) I perform a goertzel for each of the frequencies in the table(lows>and >>> highs). For Low ones I use N=212 and 106 for High ones. >>> 2) Save the highest ones (Low and High) >>> 3) Then I perform 4 more goertzel for Low Freq (+/-)1.5%(+/-)2Hz and >the >>> same for High ones, to verify 2nd Harmonics >> >>If you're going to use the second harmonic test, you only need to test >>two frequencies. If you get one and only one hit on the row freqs, and>>one and only one hit on the column freqs, then (and only then) should >>you bother with the second harmonic test, and it should be the 2nd >>harmonic of the two freqs that were "hot." >> >>But even with this improvement, there's a better way (see below). >> >>> 4) I search in the table the corresponding number and show it >>> >>> I'm using a sample rate of 8000 and a buffer size of 8K >>> >>> The program show me numbers without any logic, I mean. When there are >no >>> DTMF, the system, tell me they are. >>> >>> Which is the minimum value to compare to, I mean. Is there a minimum >>> threshold to know if the magnitude for this freq are valids?. >>> >> >>Yes. A better approach than the second harmonic test is a Parseval's >>relation test. If the two DTMF frequencies contain ~80%-90% of the >>signal's total energy, it's DTMF (assuming twist tests pass). >> >>-- >>Jim Thomas Principal Applications Engineer Bittware, Inc >>jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 >>Today is the last day of your life so far. >> > > >

Reply by ●January 9, 20062006-01-09

dkurman wrote:> Thanks for the response. I�m going to try this. By the way, you said if the > two DTMF frequencies contain ~80%-90% of the signal's total energy is DTMF, > but how can I find out this total energy?, I mean, I only have the energy > corresponding to the low freq and High freq, but not the total one. >Sum the squares of the time-domain samples, then take the square root. -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 Dyslexics of the world, UNTIE!

Reply by ●January 9, 20062006-01-09

dkurman wrote:> Ok. Now I have changed the way I get the results. First of all, I get the > goertzel of all the freq (lows and highs) and then I find the highest two > magnitude. This two freq, should be one from high and the other from low, > in case we have a DTMF incoming. But here is the problem. When I press 1 I > have these two freq as: 697 and 770 (both from low) and this should be 697 > and 1209. > > Is this correct or I'm doing this in a wrong way?.A DTMF "1" should not produce two low frequencies. It should instead produce the lowest row freq and the lowest column freq (I don't remember their values). -- Jim Thomas Principal Applications Engineer Bittware, Inc jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 Dyslexics of the world, UNTIE!

Reply by ●January 9, 20062006-01-09

Thanks. I know this, but is what I get from sample. I think the error is in the method I implement. I choose N = 205 so for this I dispose a sound buffer of 820 (205*4) at a sample rate of 8000 Then I execute the goertzel for each of the 16 freq. I didn�t find any step by step source code, and I don�t know where the bug is.>dkurman wrote: >> Ok. Now I have changed the way I get the results. First of all, I getthe>> goertzel of all the freq (lows and highs) and then I find the highesttwo>> magnitude. This two freq, should be one from high and the other fromlow,>> in case we have a DTMF incoming. But here is the problem. When I press1 I>> have these two freq as: 697 and 770 (both from low) and this should be697>> and 1209. >> >> Is this correct or I'm doing this in a wrong way?. > >A DTMF "1" should not produce two low frequencies. It should instead >produce the lowest row freq and the lowest column freq (I don't remember>their values). > >-- >Jim Thomas Principal Applications Engineer Bittware, Inc >jthomas@bittware.com http://www.bittware.com (603) 226-0404 x536 >Dyslexics of the world, UNTIE! >