8
$\begingroup$

In my never-ending quest to identify snores, I've found that "spectral flatness" seems to be a fair measure of signal "quality".

I'm computing spectral flatness as the geometric mean of the FFT power $(R*2 + I*2)$ data points divided by the arithmetic mean of the same points.

I then (a little twist here) am computing the running (over 50 frames) arithmetic mean and standard deviation of the spectral flatness and computing a "normalized" standard deviation as the running standard deviation divided by the running mean.

For my samples I find that this metric is greater than about $0.2$ (ranging up to $0.5$ or so) when audio is "good" (ie, I have reliable tracking of the breathing/snoring sounds of a sleeping subject) and it generally slips down below $0.2$ when audio is "in the mud". (I can improve on this discrimination somewhat by using a threshold that moves with other factors, but that's presumably a different topic.) I also observe that the measure goes over $1.0$ when there's substantial background noise (eg, someone enters the room and rustles about).

So, my basic question is: Is there a name (beyond "normalized standard deviation of spectral flatness") for what I'm measuring, and can anyone offer a conceptual explanation of what the metric "means"?

(I've tried a dozen other metrics for signal "quality", and this one seems to be the best to date.)

Added: I probably should admit that I don't have a particularly good conceptual handle on what simple spectral flatness is measuring (just the Wikipedia article), so any further explanation of that would be appreciated.

$\endgroup$
2
  • 2
    $\begingroup$ So you make up a calculation and are asking whether someone else came up with the same idea and named it, and if not, can someone come up with a conceptual explanation for what you have devised? Surely you must have had some rationale for putting in your "little twist", or were you, like Indiana Jones, just making it up as you went along? $\endgroup$ Jun 25, 2012 at 19:39
  • 3
    $\begingroup$ I'm basically just making things up as I go along. I find a technique, apply it to the data, observe the result, and decide if it seems to be useful. If so, I attempt refinements. It's a tedious process, but the audio analysis "expert" working on this project broke his pick and went home. $\endgroup$ Jun 25, 2012 at 20:19

2 Answers 2

4
$\begingroup$

Since you are interested in the "flatness" of your spectrum, in fact, you are interested in how close your signal is to a white noise (that by definition has a flat spectrum + random phases). If you step back, one measure would be the "distance" of your observation to the white noise reference.

The obvious measure in terms of information theory is Kullback-Leibler divergence. You do not need to understand every part of it, but it measures in bits (if you use log base 2) the distance between both distributions.

The good thing in your case is that your reference is flat, so that what remains is the entropy of your spectrum. There are many existing implementation (for instance in scipy).

Note that you are still on the safe side: if your distribution is approximately gaussian, both measures (entropy and std) will be proportional. The entropy is however more general and more principled. As an extension, you will be able to generalize to other types of noises (1/f for instance).

$\endgroup$
1
  • $\begingroup$ The odd thing is that "regular" entropy -- sum of p log p -- doesn't seem to convey much information for my problem. (Although I suppose I didn't try taking it's standard deviation.) $\endgroup$ Jun 30, 2012 at 1:59
3
$\begingroup$

Any reliable consistent difference in the statistics of your signal (or some function of your signal, such as its spectrum) and the noise in which it your signal is embedded can be used to estimate a probability of one versus the other.

You seem to have randomly found (stumbled upon) one of a likely infinite number of ways to characterize signal spectrum shape which differentiate your desired signal from stuff more like white noise or impulse spikes. Stumbling upon a random possible solution dies not invalidate it (that's one basis of evolutionary/genetic programming). But how robust a measure you've found is left as an experimental exercise.

$\endgroup$
4
  • $\begingroup$ The thing is, other measures, such as regular entropy, have not shown as much promise as this measure. If I could understand why this one seems better I could perhaps improve on it. $\endgroup$ Jun 26, 2012 at 19:41
  • $\begingroup$ hotpaw2, You mention some other ways that exist whereby one can differentiate between a signal and noise - or some 'measure' of the shape of an FFT magnitude spectrum - what ways are there exactly that come to mind? $\endgroup$
    – Spacey
    Jun 27, 2012 at 0:20
  • $\begingroup$ Exactly come to mind??? Evolutionary/genetic/Hadoop type search algorithms are sometimes said to mine stuff, from enough data, of "shapes" that neither come to mind nor are usually described as exact, until maybe after the fact. $\endgroup$
    – hotpaw2
    Jun 27, 2012 at 0:50
  • $\begingroup$ @hotpaw2 Sorry, perhaps my question was not clear - I was just wondering what simple ways of measuring, say, 'peakiness' might exist, (as an example of how a spectrum might look). Wasnt asking about anything too fancy, although those unsupervised learning methods you mentioned certainly are powerful. $\endgroup$
    – Spacey
    Jun 27, 2012 at 2:47

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.