3
$\begingroup$

In an audio application, I found it very useful to measure the total variation of a signal $y[n]$

$$\sum_{n=n_0}^{n_0+N} |y[n]-y[n-1]|$$

over a window of time length $N$ (discrete analogous to total variation of a function).

I've noticed that:

  • during "background noise only" parts of the signal, this total variation is low

  • during "background noise + musical sound" parts of the signal, the total variation is strictly higher.

Thus, it worked well in my application for envelope detection, etc. After doing my application, I heard about total variation denoising, and it seems to confirm why it works:

It is based on the principle that signals with excessive and possibly spurious detail have high total variation, that is, the integral of the absolute gradient of the signal is high.

This noise removal technique has advantages [...] total variation denoising is remarkably effective at simultaneously preserving edges whilst smoothing away noise in flat regions, even at low signal-to-noise ratios

The total variation of the signal over a time-window is in fact the distance traveled on the y-axis by the 1D-curve $n \mapsto y[n]$, so we understand why it works:

  • when the signal is noise only, the waveform of the signal "travels" at a nearly-constant rate (see left of the following image)

  • when the signal is noise + musical sound, the waveform of the signal "travels" more! (see right of the image)

enter image description here

Now the question:

Question: It seems that the total variation of the signal over a time-window is more or less proportional to the energy present in the signal during this window. Is this true? At least for signals with a zero mean?

$\endgroup$
6
  • $\begingroup$ More like bandwidth than energy $\endgroup$
    – user28715
    May 10, 2018 at 15:03
  • $\begingroup$ Suppose that we take $y[n]$ to be Gaussian. Then $y[n]-y[n-1]$ is simply a colored Gaussian - through a $1-z^{-1}$ filter, and $|y[n]-y[n-1]|$ is a "folded normal" RV. Your two conditions of "noise only" versus "signal+noise" is a comparison of two folded-normal-distributed RVs, coming from spectrally-shaped Gaussian random processes. The averaging over N samples provides a "sample mean" (well N times the sample mean) of the folded normal variables. $\endgroup$
    – user35336
    May 11, 2018 at 4:29
  • $\begingroup$ @msm the noise can be modelled by a gaussian, but the melodic signal is not: we can model it by a superposition of a few sinusoidal components for example $\endgroup$
    – Basj
    May 11, 2018 at 10:11
  • $\begingroup$ True, if the "signal" is only a few sinusoidal components, then its distribution isn't so close to Gaussian. Often, the audio components are richer than this, though, and once you get past several main components, it heads towards (highly colored) Gaussian. $\endgroup$
    – user35336
    May 11, 2018 at 23:32
  • $\begingroup$ Could you please review my answer? If something missing let me know. Else, could you please mark it? $\endgroup$
    – Royi
    Apr 24, 2021 at 9:44

1 Answer 1

3
$\begingroup$

No it is not.
Total Variation is like the amount of changes in the signal.
Though changes require energy it doesn't mean they are proportional.

For instance, imagine that during a Window we see a constant signal of high value.
Clearly this high energy signal (Unless energy for you is the Variance, usually it is the 2nd moment) yet its Total Variation is zero.

For instance:

enter image description here

While the green signal has low TV but high energy the red signal has higher TV yet smaller energy.

$\endgroup$
10
  • $\begingroup$ What do you mean exactly by constant signal of high value? do you mean a flat curve with a non-zero DC offset $f(t)=C$? If so, the total varation is zero, but also is the energy (the DC offset adds no energy in this context). $\endgroup$
    – Basj
    Apr 25, 2021 at 19:06
  • $\begingroup$ Would you maybe have another more meaningful example @Royi? (Yes variance more than 2nd moment) $\endgroup$
    – Basj
    Apr 25, 2021 at 19:07
  • $\begingroup$ @Basj, A DC Signal which has a DC value of 5 has energy (Think of your battery). But has no TV. I am not sure about the example you're after. $\endgroup$
    – Royi
    Apr 26, 2021 at 3:02
  • $\begingroup$ Thank you for your update. But as my application is audio, it's always zero mean i.e. DC = 0 on the long term. If not, it's only a measurment bias and not "real energy". Would you have an example with both signals zero-mean? I added "At least for signals with a zero mean?" in the question, your helpful answer (upvoted) made me realise this zero-mean criteria is important for this question. $\endgroup$
    – Basj
    Apr 26, 2021 at 8:07
  • $\begingroup$ Take the green signal, remove its DC and multiply is by 10. The the red signal and remove its DC. Still the green will have much higher energy yet TV which really low. The red will have small energy compared yet much higher TV. $\endgroup$
    – Royi
    Apr 26, 2021 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.