Forums

algorithms for location versus for frequency?

Started by Ron N. February 27, 2006
Ron N. wrote:
> Peter K. wrote: > > Ron N. wrote: > > > To which type of Goertzel algorithm were you refering > > > and how would you use it for this purpose? > > http://ptolemy.eecs.berkeley.edu/papers/96/dtmf_ict/www/node3.html#SECTION00030000000000000000 > > Why would this be any better than a low pass filter followed > by an average amplitude measurement of some sort?
Actually, I meant band-pass filter, followed by a rectify or square and the low-pass filter, or perhaps a running average, as one possible means for the amplitude estimation.
> Thanks. > -- > rhn A.T nicholson d.0.t C-o-M
"Ron N." <rhnlogic@yahoo.com> writes:

> Ron N. wrote: > > > > Why would this be any better than a low pass filter followed > > by an average amplitude measurement of some sort? > > Actually, I meant band-pass filter, followed by a rectify or square > and the low-pass filter, or perhaps a running average, as one > possible means for the amplitude estimation. >
If you know the frequency, it should be pretty much the same, unless I misunderstand. Ciao, Peter K. -- "And he sees the vision splendid of the sunlit plains extended And at night the wondrous glory of the everlasting stars."
Ron N. wrote:
> I suppose all characterization of signals inside some buffer > of samples is a form of statistical signal processing. > > When asking about the frequency of some signal in comp.dsp, > all sorts of algorithms are mentioned, forms of autocorrelation > (or squared difference, etc.), or fft/dft usage (windowed, zero > padded, phase differentiated, etc.). Also, there seem to be lots > of textbooks on these forms of analysis in the local libraries. > Very little mention of statistical techniques from old radar/sonar > textbooks.
If you are really interested in this sort of stuff, try van Trees' "detection Estimation and Modulation Theory", vols 1-4.
> However when asking about how to find the location of a signal > (start/stop/center position), I often get pointers to some signal > processing textbooks (of which I haven't found any in the local > library yet). > > Why this difference? Is location analysis less tractable, less > interesting, or less explainable in comp.dsp algorithms, than > is frequency?
No. But the methods to be used vary significantly from situation to situation. In a radar scenario, you have a fairly "easy" propagation medium, the atmosphere, between the tranceiver and the target. In air, the speed of light varies in the 6th or more significant digit. You usually have a large bandwidth, and you are free to design the emitted signals. At the other extreme is exploration seismics. You might have very little knowledge about the internal structure of the earth, let alone the detailed propagation velocities in the different parts and formations. In marine seismic the problem is to get a sound source that is powerful enough and still possible to handle, while giving fairly consistent signals between shots. Forget about any designing of the source signal; some times one is glad one gets a measurement at all. What method might work, depends entirely on the context of the measurement and what you try to achieve by that measurement.
> For instance, what means could be used to measure the precise > duration (within rise time uncertainty) of a DTMF tone, Morse > code dit, or saxaphone note from a buffer of sound samples?
For the first two cases, a naive attempt would be to design some filter that is centered around the transmitted frequencies of the various tones, and use some sort of energy detector at the output. This is possible because the signal sources are technical contraptions that are designed to emit signals that other technical contraptions will analyze. The specifications of the emitted signals are known. The latter case is a completely different problem. Does the signal contain sound only from the saxophone, or are other instruments involved? If there is only one instrument available, do you need to determine if it is a saxophone or, say, a trumpet or a clarinet? Is the musician technically proficient, or does he somehow "mess up" the tone he plays? These types of questions will come up at one time or another, We, as human beings, easily can hear the difference between a saxophone and something else, even when playing with a large orchestra. I don't know of anybody who have managed to do anything similar by means of computer analysis. The reason is that whatever distiguishes the sound of a saxophone from that of a trumpet or violin, are *qualitative* features, while the computer only can deal with *quantitative* features. Rune
Rune Allnor wrote:
> If you are really interested in this sort of stuff, try van Trees' > "detection Estimation and Modulation Theory", vols 1-4.
This is exactly the type of thing I've noted before, mentioning books instead of algorithms. In comp.dsp, the ratio of discussing algorithms versus books is far higher for questions about frequency measurement. Why this difference? Is frequency measurement somehow easier to explain?
> > For instance, what means could be used to measure the precise > > duration (within rise time uncertainty) of a DTMF tone, Morse > > code dit, or saxaphone note from a buffer of sound samples? > > For the first two cases, a naive attempt would be to design > some filter that is centered around the transmitted frequencies > of the various tones, and use some sort of energy detector > at the output.
This solution seems to produce far less resolution and more error than frequency measurements of the same signals by methods which have been extensively discussed in the group. What do the non-naive attempts look like?
> The latter case is a completely different problem. Does the > signal contain sound only from the saxophone, or are other > instruments involved? If there is only one instrument available, > do you need to determine if it is a saxophone or, say, a trumpet > or a clarinet?
That is a different question. My question is more about if one did already have some means (say a priori information) to detect that there was some saxophone note present, sufficient to measure the note's frequency content in the signal, how would the methods for an accurate measurement of the notes duration differ from those for the measurement of its frequency. Thanks. -- rhn A.T nicholson d.0.t C-o-M
Ron N. wrote:
> Rune Allnor wrote: > >>If you are really interested in this sort of stuff, try van Trees' >>"detection Estimation and Modulation Theory", vols 1-4. > > > This is exactly the type of thing I've noted before, mentioning > books instead of algorithms. In comp.dsp, the ratio of discussing > algorithms versus books is far higher for questions about frequency > measurement. Why this difference? Is frequency measurement > somehow easier to explain? > > >>>For instance, what means could be used to measure the precise >>>duration (within rise time uncertainty) of a DTMF tone, Morse >>>code dit, or saxaphone note from a buffer of sound samples? >> >>For the first two cases, a naive attempt would be to design >>some filter that is centered around the transmitted frequencies >>of the various tones, and use some sort of energy detector >>at the output. > > > This solution seems to produce far less resolution and more > error than frequency measurements of the same signals by > methods which have been extensively discussed in the group. > What do the non-naive attempts look like? > > >>The latter case is a completely different problem. Does the >>signal contain sound only from the saxophone, or are other >>instruments involved? If there is only one instrument available, >>do you need to determine if it is a saxophone or, say, a trumpet >>or a clarinet? > > > That is a different question. My question is more about if one did > already have some means (say a priori information) to detect that > there was some saxophone note present, sufficient to measure the > note's frequency content in the signal, how would the methods > for an accurate measurement of the notes duration differ from > those for the measurement of its frequency.
It seems to me that measurements of time are best made in the time domain. If the only available information is frequency, I would begin with an IFFT. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
Jerry Avins wrote:
> Ron N. wrote: > > Rune Allnor wrote: > >>If you are really interested in this sort of stuff, try van Trees' > >>"detection Estimation and Modulation Theory", vols 1-4. > > > > This is exactly the type of thing I've noted before, mentioning > > books instead of algorithms. In comp.dsp, the ratio of discussing > > algorithms versus books is far higher for questions about frequency > > measurement. Why this difference? Is frequency measurement > > somehow easier to explain? > > > >>>For instance, what means could be used to measure the precise > >>>duration (within rise time uncertainty) of a DTMF tone, Morse > >>>code dit, or saxaphone note from a buffer of sound samples? > >> > >>For the first two cases, a naive attempt would be to design > >>some filter that is centered around the transmitted frequencies > >>of the various tones, and use some sort of energy detector > >>at the output. > > > > This solution seems to produce far less resolution and more > > error than frequency measurements of the same signals by > > methods which have been extensively discussed in the group. > > What do the non-naive attempts look like? > > > >>The latter case is a completely different problem. Does the > >>signal contain sound only from the saxophone, or are other > >>instruments involved? If there is only one instrument available, > >>do you need to determine if it is a saxophone or, say, a trumpet > >>or a clarinet? > > > > That is a different question. My question is more about if one did > > already have some means (say a priori information) to detect that > > there was some saxophone note present, sufficient to measure the > > note's frequency content in the signal, how would the methods > > for an accurate measurement of the notes duration differ from > > those for the measurement of its frequency. > > It seems to me that measurements of time are best made in the time > domain. If the only available information is frequency, I would begin > with an IFFT.
OK. Say we have the information in the time domain. What does one do with this information to measure start/stop times of some tone? Analyzing a fixed amplitude signal in zero noise seems easy. But what to do if there is static, noise, a fading channel, and interfering CW signals a few dozens or hundreds of Hz above and below the tone(s) of interest. If I use a spectrum analyzer, I can clearly see my signal separate from all the interference, and perhaps measure the frequency to 1 Hz or better. How do I also measure the length of each dit or DTMF burst to the best possible accuracy? I hit the middle E# key on my piano and can measure the frequency to about 2 cents accuracy. How long did I hold down the key in mS? (assuming I'm not using the damper pedal, etc.) What algorithms are best for these types of measurements? IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
Ron N. wrote:

   ...

> But what to do if there is static, noise, a fading channel, > and interfering CW signals a few dozens or hundreds of Hz > above and below the tone(s) of interest.
The world is an imperfect place.
> If I use a spectrum > analyzer, I can clearly see my signal separate from all > the interference, and perhaps measure the frequency to 1 Hz > or better.
The spectrogram lets you discover the note and isolate it. A filter tuned to it will let you time it. You already rejected the idea, but I think it has worth.
> How do I also measure the length of each dit or > DTMF burst to the best possible accuracy? I hit the middle > E# key on my piano and can measure the frequency to about > 2 cents accuracy. How long did I hold down the key in mS? > (assuming I'm not using the damper pedal, etc.)
With a sharp filter tuned to E#.
> What algorithms are best for these types of measurements?
I don't know about best, but time measurements are good. You might even count zero crossings. That will establish the duration within a cycle. The trouble with sharp filters is that the sharper they are, the more sluggish their response. Like an FFT, the more accurately you pin down the frequency, the less you know about timing. (No surprise.) If noise forces you to too narrow a filter in order to isolate the signal of interest, the game is up. If you can tolerate a bandwidth of B, then you can measure time to the order of 1/B. The "no free lunch" principle is at work. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
Jerry Avins wrote:
> Ron N. wrote: > > But what to do if there is static, noise, a fading channel, > > and interfering CW signals a few dozens or hundreds of Hz > > above and below the tone(s) of interest.
...
> > If I use a spectrum > > analyzer, I can clearly see my signal separate from all > > the interference, and perhaps measure the frequency to 1 Hz > > or better. > > The spectrogram lets you discover the note and isolate it. A filter > tuned to it will let you time it. You already rejected the idea, but I > think it has worth.
A filter does not produce time information. It produces yet another waveform with somewhat less interference. So even if I use a filter (which I am) I am still left with the original problem. How does one extract the signal envelope duration with accuracy? Is the digital equivalent of a rectifier, low-pass and comparator the best one can do compared to the theoretical bounds? If so, how might one optimize the low-pass filter and comparator threshold?
> > How do I also measure the length of each dit or > > DTMF burst to the best possible accuracy? I hit the middle > > E# key on my piano and can measure the frequency to about > > 2 cents accuracy. How long did I hold down the key in mS? > > (assuming I'm not using the damper pedal, etc.) > > With a sharp filter tuned to E#. > > > What algorithms are best for these types of measurements? > > I don't know about best, but time measurements are good. You might > even > count zero crossings. That will establish the duration within a cycle.
I assume you meant to say measure zero crossings, not just to count them. But I suppose one could count the zero crossings, and assume that when the number becomes very different from two per period that the signal has disappeared, and any zero crossings remaining are likely from noise or interference. This method seems very different from trying to estimate the amplitude and/or threshold of a filtered waveform. I'll give it a try.
> The trouble with sharp filters is that the sharper they are, the more > sluggish their response. Like an FFT, the more accurately you pin down > the frequency, the less you know about timing. (No surprise.) If noise > forces you to too narrow a filter in order to isolate the signal of > interest, the game is up. If you can tolerate a bandwidth of B, then you > can measure time to the order of 1/B. The "no free lunch" principle is > at work.
Agreed. The question is what practical (or impractical) methods get closest to the theoretical bounds of 1/B. There already seems to have been a lot of discussion here on how to measure frequency accurately given a fixed time window. Thanks. -- rhn A.T nicholson d.0.t C-o-M
> A filter does not produce time information. It produces yet another > waveform with somewhat less interference. So even if I use a filter > (which I am) I am still left with the original problem. How does one > extract the signal envelope duration with accuracy?
Like it has already been suggested to you, I think a sliding Goertzel would be a good way to start. Sure a sliding window will always have a low pass response, but the rise and fall time of this type of algorithm remains constant, resulting in a fairly accurate measure of your "signal envelope" duration. But without knowing the exact dynamics of your measurement ie. sample rate, bit resolution, S/N ratio, BW of interest etc.. it is impossible to tell how accurate it will be. Thomas
Ron N. wrote:
> Jerry Avins wrote:
...
>>I don't know about best, but time measurements are good. You might even >>count zero crossings. That will establish the duration within a cycle. > > > I assume you meant to say measure zero crossings, not just to > count them. But I suppose one could count the zero crossings, > and assume that when the number becomes very different from two > per period that the signal has disappeared, and any zero crossings > remaining are likely from noise or interference. This method > seems very different from trying to estimate the amplitude > and/or threshold of a filtered waveform. I'll give it a try.
No, I meant count. After the signal is filtered well enough so that an octave above it is well attenuated and there's not much noise below it, there'll be only one zero crossing per cycle. The signal being buried in noise means it's hard to know that it's there. If you can't tell with reasonable certainty whether it's there or not, deciding when it starts and stops is a fool's errand.
>>The trouble with sharp filters is that the sharper they are, the more >>sluggish their response. Like an FFT, the more accurately you pin down >>the frequency, the less you know about timing. (No surprise.) If noise >>forces you to too narrow a filter in order to isolate the signal of >>interest, the game is up. If you can tolerate a bandwidth of B, then you >>can measure time to the order of 1/B. The "no free lunch" principle is >>at work. > > > Agreed. The question is what practical (or impractical) methods get > closest to the theoretical bounds of 1/B. There already seems to > have been a lot of discussion here on how to measure frequency > accurately given a fixed time window.
That depends on B. A bandpass filter of 100 Hz allows discrimination of about 10 ms, and is pretty narrow band even of middle C. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;