Forums

spandsp tone_detect.c goertzel perodogram

Started by Kamanashis October 24, 2007
Hi,

  Let me explain the situation, I am trying to differ beep from
different answering machine.
The information about the answering machine beep frequency is given
below.

[T-Mobile]
frequency=1250 ; frequency in Hz
energy=-30 ; energy in db
duration=250 ; duration in milisecond

[Verizon]
frequency=1500 ; frequency in Hz
energy=-20 ; energy in db
duration=550 ; duration in milisecond


[Sprint/Nextel]
frequency=1400 ; frequency in Hz
energy=-30 ; energy in db
;duration=600 ; duration in milisecond
duration=120 ; duration in milisecond

[AT&T/Cingular]
frequency=1700 ; frequency in Hz
energy=-20 ; energy in db
duration=300 ; duration in milisecond

  I tried with goertzel algorithm (I used the implementation from
spandsp library).
It gave me farely close values of energy [T-Mobile], [Verizon] and
[Sprint/Nextel].
It was the [Sprint/Nextel] that I was testing. Then I tested Verizon.
I did not find a
way to detect the amds.

  Now I have a few questions,

  1. what does they mean by -20db and what is its relation with
goertzel energy.

  2. how can I use the periodogram functions of spandsp library, is
there any chance
that it may work for me ?

  3. Is there any relation of duration of samples and goertzel
algorithm. (I get frames
of 20ms each, with 160 samples).

  And please suggest me what to do to succeed this project.

-- Thanks
Kamanashis Roy

On Wed, 24 Oct 2007 12:00:33 +0000, Kamanashis wrote:

> Hi, > > Let me explain the situation, I am trying to differ beep from > different answering machine. > The information about the answering machine beep frequency is given > below. > > [T-Mobile] > frequency=1250 ; frequency in Hz > energy=-30 ; energy in db > duration=250 ; duration in milisecond > > [Verizon] > frequency=1500 ; frequency in Hz > energy=-20 ; energy in db > duration=550 ; duration in milisecond > > > [Sprint/Nextel] > frequency=1400 ; frequency in Hz > energy=-30 ; energy in db > ;duration=600 ; duration in milisecond > duration=120 ; duration in milisecond > > [AT&T/Cingular] > frequency=1700 ; frequency in Hz > energy=-20 ; energy in db > duration=300 ; duration in milisecond > > I tried with goertzel algorithm (I used the implementation from > spandsp library). > It gave me farely close values of energy [T-Mobile], [Verizon] and > [Sprint/Nextel]. > It was the [Sprint/Nextel] that I was testing. Then I tested Verizon. > I did not find a > way to detect the amds. > > Now I have a few questions, > > 1. what does they mean by -20db and what is its relation with > goertzel energy.
The measure of energy (power, actually) is in relation to some reference, so it should be dB(something). It's been a long time since I've done phone stuff, so I couldn't tell if if it is dBV (volt), dBW (watt), dBm (milliwatt), or some peculiar phone thing.
> 2. how can I use the periodogram functions of spandsp library, is > there any chance > that it may work for me ?
Dunno -- I'm not familiar with that library.
> 3. Is there any relation of duration of samples and goertzel > algorithm. (I get frames > of 20ms each, with 160 samples).
I'm not sure what you mean. Taking frames of 20ms each will spread the spectrum of your signal, so it'll be difficult to tell what's going on to an accuracy of more than 50Hz or so. It looks like your frequencies are spaced widely enough that this won't be a big issue. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
Kamanashis wrote:
> Hi, > > Let me explain the situation, I am trying to differ beep from > different answering machine. > The information about the answering machine beep frequency is given > below. > > [T-Mobile] > frequency=1250 ; frequency in Hz > energy=-30 ; energy in db > duration=250 ; duration in milisecond > > [Verizon] > frequency=1500 ; frequency in Hz > energy=-20 ; energy in db > duration=550 ; duration in milisecond > > > [Sprint/Nextel] > frequency=1400 ; frequency in Hz > energy=-30 ; energy in db > ;duration=600 ; duration in milisecond > duration=120 ; duration in milisecond > > [AT&T/Cingular] > frequency=1700 ; frequency in Hz > energy=-20 ; energy in db > duration=300 ; duration in milisecond > > I tried with goertzel algorithm (I used the implementation from > spandsp library). > It gave me farely close values of energy [T-Mobile], [Verizon] and > [Sprint/Nextel]. > It was the [Sprint/Nextel] that I was testing. Then I tested Verizon. > I did not find a > way to detect the amds. > > Now I have a few questions, > > 1. what does they mean by -20db and what is its relation with > goertzel energy.
It means they send the tone at -20dB, but the energy at the receiver will depend on the losses between the transmitter and receiver.
> 2. how can I use the periodogram functions of spandsp library, is > there any chance > that it may work for me ?
It could, if you add some more bits and pieces to what is there. The periodogram code in spandsp is a work in progress for a full supervisory tone detection scheme.
> 3. Is there any relation of duration of samples and goertzel > algorithm. (I get frames > of 20ms each, with 160 samples).
The Goertzel algorithm just evaluates a single output bin of a discrete Fourier Transform. No more, and no less. It, therefore, behaves just like any other kind of Fourier transform. Basically, the narrower you want the frequency window of the detector to be, the more samples you need to put through the Goertzel algorithm. If you are trying to use the detector for a single tone, and reject voice, you will probably need to apply windowing to the data, and use a narrow detection range. Don't make the range too narrow, through, as there will be some tolerance on the tone's frequency.
> And please suggest me what to do to succeed this project.
I don't understand what you are trying to achieve. Are you trying to build a generalised answering machine detector? Are you trying to discriminate which of the above services you have connected to? Detecting telephony tones is trivial. The tricky part is avoiding false detections of voice as tone. Discriminating which of the services you have attached to should be easy, as their tones appear distinctive. Trying to reliably determine if you have connected to an answering service is much harder. Regards, Steve
On Oct 25, 10:35 am, Steve Underwood <ste...@dis.org> wrote:
> Kamanashis wrote: > > Hi, > > > Let me explain the situation, I am trying to differ beep from > > different answering machine. > > The information about the answering machine beep frequency is given > > below. > > > [T-Mobile] > > frequency=1250 ; frequency in Hz > > energy=-30 ; energy in db > > duration=250 ; duration in milisecond > > > [Verizon] > > frequency=1500 ; frequency in Hz > > energy=-20 ; energy in db > > duration=550 ; duration in milisecond > > > [Sprint/Nextel] > > frequency=1400 ; frequency in Hz > > energy=-30 ; energy in db > > ;duration=600 ; duration in milisecond > > duration=120 ; duration in milisecond > > > [AT&T/Cingular] > > frequency=1700 ; frequency in Hz > > energy=-20 ; energy in db > > duration=300 ; duration in milisecond > > > I tried with goertzel algorithm (I used the implementation from > > spandsp library). > > It gave me farely close values of energy [T-Mobile], [Verizon] and > > [Sprint/Nextel]. > > It was the [Sprint/Nextel] that I was testing. Then I tested Verizon. > > I did not find a > > way to detect the amds. > > > Now I have a few questions, > > > 1. what does they mean by -20db and what is its relation with > > goertzel energy. > > It means they send the tone at -20dB, but the energy at the receiver > will depend on the losses between the transmitter and receiver. > > > 2. how can I use the periodogram functions of spandsp library, is > > there any chance > > that it may work for me ? > > It could, if you add some more bits and pieces to what is there. The > periodogram code in spandsp is a work in progress for a full supervisory > tone detection scheme. > > > 3. Is there any relation of duration of samples and goertzel > > algorithm. (I get frames > > of 20ms each, with 160 samples). > > The Goertzel algorithm just evaluates a single output bin of a discrete > Fourier Transform. No more, and no less. It, therefore, behaves just > like any other kind of Fourier transform. Basically, the narrower you > want the frequency window of the detector to be, the more samples you > need to put through the Goertzel algorithm. If you are trying to use the > detector for a single tone, and reject voice, you will probably need to > apply windowing to the data, and use a narrow detection range. Don't > make the range too narrow, through, as there will be some tolerance on > the tone's frequency. > > > And please suggest me what to do to succeed this project. > > I don't understand what you are trying to achieve. Are you trying to > build a generalised answering machine detector? Are you trying to > discriminate which of the above services you have connected to? > > Detecting telephony tones is trivial. The tricky part is avoiding false > detections of voice as tone. Discriminating which of the services you > have attached to should be easy, as their tones appear distinctive. > Trying to reliably determine if you have connected to an answering > service is much harder. > > Regards, > Steve
Thank you for your reply. I am currently in a project to modify the asterisk amd application that detects answering machine depending on the silence period. I have noted that amd machines say something like "If you want to leave a message, please say your message after the beep" and then they produce a beep. The silence before the beep is greater than 700ms most of the times which is greater than silence between words. Now that I can predict that it is beep, I get the goertzel energy of the given machines and try to identify a specific machine. As the specifications are read from a configuration file(not hard coded) so, it should work for other answering machines too. Now the specification, like frequency and power, is not verified. And I have tried a lot with this specification. Let me share you a little. I was testing the following, [Sprint/Nextel] frequency=1400 ; frequency in Hz energy=-30 ; energy in db duration=600 ; duration in milisecond And I got a statistics as follows(it tells about 20ms, other frames of 20ms gives almost the same result) tone :goertzel energy 50 :98675440.000000 100 :36266448.000000 150 :14138939.000000 200 :277978.187500 250 :20917570.000000 300 :93951144.000000 350 :221786384.000000 400 :306548128.000000 450 :677073088.000000 500 :1453333888.000000 550 :2423981056.000000 600 :5636514304.000000 650 :9835254784.000000 700 :58524889088.000000 750 :247646289920.000000 800 :5774915072.000000 850 :1130472576.000000 900 :118388688.000000 950 :26353552.000000 1000 :28255540.000000 1050 :127593568.000000 1100 :149558512.000000 1150 :216797728.000000 1200 :217243552.000000 1250 :289937792.000000 1300 :318662848.000000 1350 :297567552.000000 1400 :296347712.000000 1450 :266078320.000000 1500 :230130080.000000 1550 :167810704.000000 1600 :165656928.000000 1650 :95268592.000000 1700 :52679632.000000 Now, the question is, is there any mistake appearent ? I mean it seems that the peak is in 750 frequency all the time whereas I am expecting it to be in 1400. Is there any possible mistake in my calculation ? I am confused with the data I get. I tried with beep of, [Verizon] frequency=1500 ; frequency in Hz energy=-20 ; energy in db duration=550 ; duration in milisecond It gave me almost the same result(750Hz got the highest energy). -- Thanks Kamanashis Roy