[PD] noise floor: median in audio signals, for peak extraction

Charles Henry czhenry at gmail.com
Thu Dec 22 17:48:14 CET 2011

On Wed, Dec 21, 2011 at 11:15 AM, Charles Henry <czhenry at gmail.com> wrote:
> 1.  How to handle the endpoints of the signal blocks?

I've thought this over, and concluded that it really doesn't matter,
for the case of the magnitude of power spectral density.

Any high or low values of the spectrum at DC and at the Nyquist
frequency will be rejected, because of the symmetry of the Fourier
transform about these points.

You'd probably treat the blocks as circular buffers for the purpose of
median filtering your spectrum.  It stays a little neater that way
anyhow, with no samples held over from the previous block.

> 2.  The statistical properties of median and weighted median filters
> are tough to describe analytically.  If you've got to justify your
> choice of this one component... it may take some research.  Estimating
> threshold values with mean/variance calculations are much easier
> analytically.

I've also thought this over, and the median filter is the black magic
of non-linear filtering.  It rejects some bad points in the data no
matter how bad they are which makes it robust and really practical,
but quantifying the effects is some kind of arcane secret.

Another way to look at it is what it does for your spectrum's
continuity--it might be good to rid of some of the variability in the
noise floor estimation, just making the spectrum smoother, which the
median filter certainly does.  I wonder if there could be something
analogous for smoothing out phase in a spectrum?

> On Tue, Dec 20, 2011 at 5:29 PM, Alexandre Torres Porres
> <porres at gmail.com> wrote:
>> Hi there, this is a technique for calculating the noise floor of a spectrum,
>> and extracting the peaks.
>> It'd be used pretty much like I04.Noie Gate Miller's example, that has the
>> "mask" table with a constant multiplier. We'd have instead this
>> "noise-floor" block of audio, also multiplied by a constant.
>> To get the noise floor, we take the magnitude (or power) spectrum and get
>> the median of small bits of it, like every 32 samples. So the values of
>> every 32 samples would be the median of that section...
>> this is where I got this from, check page 4 and
>> this would be kinda like using the [median] or [median_n] objects, but over
>> audio blocks and not number lists.
>> Since there's the need of calculating this in and using the result back in
>> the same block round into the audio chain, I can't put the spectrum into a
>> table, and then calculate the median over bits of it.
>> But then, how to do it? Should I be able to pull this out only if I write a
>> "median~" or [noise_floor~] external?
>> Or somehow there's another way to do this with some existing external, or a
>> similar technique, or even some audio math trick using [fexpr~] or
>> something?
>> This has to do with the other post I did about a project that attempts to
>> isolate notes into a chord in a spectrum, something like melodyne is does.
>> thanks
>> Alex
>> _______________________________________________
>> Pd-list at iem.at mailing list
>> UNSUBSCRIBE and account-management ->
>> http://lists.puredata.info/listinfo/pd-list

More information about the Pd-list mailing list