# Estimating attenuation using sliding windows

I am looking for an algorithm to measure attenuation of a discrete signal $s[t]$. Starting at the beginning of the signal sequence, is it possible to compute either sliding DFT or Gabor transform windows and use the amplitude and phase information to compute an attenuation coefficient? Is a reference available for such an algorithm? I am wondering if similar algorithms have been applied in music DSP.

Is there a separate attenuation coefficient computed for both the real and complex parts of the frequency-domain signal?

Here are some further details:

1. For each window, I want to compute attenuation of the signal. So for every $\tau$, where $\tau$ is the center of the window, I get an estimate of attenuation over the width of the window. As the window moves over the signal $s[t]$, I get an estimate of attenuation $\alpha[\tau]$ as a function of the window center.
2. Sliding DFT is used for computational efficiency (link), and I think that there may also be other benefits to using the sliding DFT as well. Should I apply a Blackman/Hanning window in the time domain? Or perhaps the Gabor transform would suffice.
3. $s[t]$ is considered to contain a single signal of interest.
4. The attenuation coefficient can be expressed with a real part and a complex part, and can be reported in units of dB. Here is an equation:

$A = A_0 \exp[\frac{{ - \omega \tau }}{{2\alpha }}]$

$A$ is the amplitude and phase at a time $\tau_k$, and $A_0$ is some reference amplitude and phase, $\alpha$ is the attenuation coefficient, $\tau$ is the time at the window center, and $\omega$ is angular frequency.

How do I define the reference amplitude and phase $A_0$? Maybe $A_0$ would be defined at the beginning of the signal. Or maybe $A_0$ would be defined at the beginning of each window? In addition, how do I deal with spikes in the signal spectrum? Maybe some sort of smoothing algorithm would be beneficial here?

Moreover, maybe the attenuation could be determined using a signal envelope detector? How might I set this up?

UPDATE

I think this problem might be associated with separating two signals that have been added together. We don't know the reference amplitude $A_0$ and it might change over time. Take:

$A[\tau, \omega] = A_0[\tau, \omega]\exp[\frac{{ - \omega \tau }}{{2\alpha }}]$

$\log(A[\tau, \omega]) = \log(A_0[\tau, \omega]) + [\frac{{ - \omega \tau }}{{2\alpha }}]$

Here are some assumptions:

1. $A_0[\tau, \omega]$ is unknown, but it can be assumed as being uncorrelated with $[\frac{{ - \omega \tau }}{{2\alpha }}]$. The bandwidth of $A_0[\tau, \omega]$ is different than the bandwidth of $[\frac{{ - \omega \tau }}{{2\alpha }}]$. (I think this is reasonable.) The bandwidth of the $[\frac{{ - \omega \tau }}{{2\alpha }}]$ expression is known.
2. $\alpha$ is constant for each $\tau$.
3. $A[\tau, \omega]$ is computed using the Short Time Fourier Transform or Gabor transform.
4. The envelopes of $A[\tau, \omega]$ and $A_0[\tau, \omega]$ are not constant. However, $\exp[\frac{{ - \omega \tau }}{{2\alpha }}]$ is just an equation. So can I treat $A_0$ as simply being "noise" or something else?
5. $A_0[\tau, \omega]$ and $A[\tau, \omega]$ are complex. The attenuation $\alpha$ is a real number.

Can someone help me set up the math (i.e. matrix equation?) or point me in the right direction to a class of algorithms? I think this problem is very similar to separation of two signals.

Perhaps this can be done using a Kalman filter, where $\log(A_0[\tau, \omega])$ is treated as "noise" and the $[\frac{{ - \omega \tau }}{{2\alpha }}]$ term is treated as the signal. Is this reasonable, and is there a good reference available on the implementation of this filter? Perhaps another filter would be more appropriate?

The output of the operation would be a graph of attenuation with respect to time, as I have drawn below. I also show the Gabor transform operation with the addition of two signals.

UPDATE

To explore this problem more, I've selected a test signal and written a program to forward filter the test signal using a kernel that simulates the attenuation I want to determine. I work with sonar and acoustic sensing systems, so selecting this signal demonstrates what I am working with.

Here is a plot of the test signal in the time domain. This is a signal with no attenuation:

Here is the Gabor transform (spectrogram) of the signal with no attenuation:

Here is a plot of the test signal after I've applied a filter to simulate attenuation. This is a signal with constant attenuation, such that $\alpha(\tau) = 55$:

Here is the Gabor transform (spectrogram) of the signal with attenuation. Notice how there is an exponential decay in the spectrogram:

Looking at the absolute value of the forward filter kernel, the exponential decay is very apparent. Notice how some frequencies are decayed more than others. The forward filter kernel has a real and a complex part. The plot below is simply the absolute value of the forward filter kernel. The higher the numerical value of the filter kernel (approaching 1.0), the less attenuation. The lower the numerical value of the filter kernel (approaching 0), the more attenuation.

Here is the mathematical form of the filter kernel $k(\tau, \omega)$ that has been applied by multiplication with the original Gabor-transformed signal:

$k(\tau ,\omega ) = \frac{1}{{\Lambda (\tau ,\omega )}}\exp \left[ {i\int\limits_0^\tau {{{\left( {\frac{\omega }{{{\omega _h}}}} \right)}^{\frac{1}{{\pi \alpha (\tau ')}}}}\omega d\tau '} } \right]$

$\Lambda (\tau ,\omega ) = \frac{{\beta (\tau ,\omega ) + {\sigma ^2}}}{{{\beta ^2}(\tau ,\omega ) + {\sigma ^2}}}$

$\beta (\tau ,\omega ) = \exp \left[ { - \int\limits_0^\tau {\frac{\omega }{{2\alpha (\tau ')}}{{\left( {\frac{\omega }{{{\omega _h}}}} \right)}^{\frac{{ - 1}}{{\pi \alpha (\tau ')}}}}d\tau '} } \right]$

In the above, $\omega, \omega_h, \sigma, \tau$ are all known, and for simplicity I have set the attenuation $\alpha(\tau) = 55$ across the entire signal.

I would like to find the attenuation $\alpha(\tau)$ as a function of time $\tau$, but $\alpha(\tau)$ does not have to be constant, and can change over $\tau$.

I think that the filter kernel is "smooth," whereas the original signal is not.

Is there a way to determine attenuation $\alpha(\tau)$, even in a non-exact way?

Here I repeat the same experiment for an $\alpha(\tau)$ that changes over time. This is a model of what I would expect $\alpha(\tau, \omega)$ to be (but the curve could also be linear with a negative slope, or something else entirely):

For sake of exposition, here is the original (non-filtered) trace again. This is a signal with no attenuation:

This is a signal with attenuation, where $\alpha(\tau)$ changes over time:

Here is the absolute value of the filter kernel where $\alpha(\tau)$ changes over time. Note that the exponential decay is still present here:

Another perspective

Now I realize that the forward filter in the Gabor transform domain is given by:

$A(\tau, \omega) = A_0(\tau, \omega)k(\tau, \omega)$

So the attenuated trace is $A(\tau, \omega)$, and $A_0(\tau, \omega)$ is the non-attenuated trace, and $k(\tau, \omega)$ is the filter kernel. Given $A(\tau, \omega)$, but not $A_0(\tau, \omega)$, I would like to estimate $\alpha(\tau)$, the attenuation function over time. In this case, I know the numerical form of the filter kernel $k(\tau, \omega)$, but I do not know $\alpha(\tau)$. This is why I wonder if Kalman filtering would be beneficial to use in this type of problem. Perhaps $A_0(\tau, \omega)$ could be treated as noise uncorrelated with the kernel $k(\tau, \omega)$.

Looking at the attenuated spectrograms, I am reminded of image "de-blurring" algorithms. Since the kernel is "smooth" and the original signal $A_0(\tau, \omega)$ is not, it might be possible to somehow separate the $A_0(\tau, \omega)$ from the kernel $k(\tau,\omega)$ using some sort of algorithm.

If I can separate the $A_0(\tau, \omega)$ from the kernel $k(\tau,\omega)$, then I think that can estimate $\alpha(\tau)$.

UPDATE

Here is a spectrogram of actual data. The datasets above were synthetic, whereas this spectrogram was collected from an actual experiment.

• Attenuation relative to what? Bulk attenuation over the entire sliding window period, or how the attenuation varies over the time of the window? What's the motivation for using a DFT? Do you need to simultaneously analyze multiple signals separated in frequency, or is $s[t]$ assumed to contain a single signal of interest? How would you mathematically define the attenuation coefficient that you seek? – Jason R Aug 15 '12 at 12:58
• Jason R: Thank you; I've now updated the question to add additional information. – Nicholas Kinar Aug 15 '12 at 15:12
• I'll again ask why you plan to use a DFT. Based on the information in your question, it seems like all you want to do is estimate the average power level of the signal over time (and then normalize that value with respect to some reference). This would be a common operation for something like an automatic gain-control loop for a communication receiver. It's not clear why you would need a DFT to do this. Another question: is the signal of interest expected to be constant-envelope, or does its envelope naturally vary over time? – Jason R Aug 15 '12 at 17:47
• @JasonR: Maybe a sliding DFT is not really required in this problem. The average power level of the signal is an interesting idea, and I think this would work well. How would I do this in the time domain? Could you describe an algorithm or point me to a reference? The envelope of the signal varies naturally over time, and it does not have a constant envelope. – Nicholas Kinar Aug 15 '12 at 18:06
• I've now explicitly added the angular frequency to the equation. Maybe this helps to rationalize why frequency-domain methods are required? – Nicholas Kinar Aug 15 '12 at 18:13

From your question and comments, it looks like what you want to extract is the envelope of a signal.

A few things are still not clear:

• Do you have any prior knowledge about the shape of this envelope (looks like it might be an exponential in your case)?
• What is the signal "attenuated" by this envelope. Something complex like music? A pure sine-wave?
• What are the relative "scale" of the signals. Is the carrier period several orders of magnitude lower than the constant time of the envelope? Or just one order of magnitude lower?

• Parametric techniques. If your signal takes the form $\Re (\alpha z^n)$ (exponential damped sine wave) or $\Re(\sum_p \alpha_p z_p^n)$ (sum of exponentially damped sine waves) plus some white noise, where $\alpha$ is a complex number carrying the phase/amplitude information and $z$ a complex number carrying the sine wave period/exponential decay constant information, there are parametric techniques (ESPRIT, MUSIC) to get least square estimates of $z$. These techniques are particularly efficient when it comes to discriminating components in sums of signals. If you have a 100 Hz tone with a 1s exponential decay, and a 101 Hz tone with a 1.5s exponential decay added together, you'll recover these parameters provided noise is low-enough (while a naive DFT would have a hard time discriminating the two nearby sine waves). The downside is that your signal must conform to the chosen model for this to work.