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

Charles Henry czhenry at gmail.com
Wed Dec 21 18:15:22 CET 2011

Hi Alex

look forward to your new phase vocorder stuff, when I get free time
and enough rest.

Have you considered weighted median filtering?  It's a non-linear
filter structure that takes non-negative integers as arguments.  At
each sample, you create a list of samples, the adjacent values taken
according to the filter arguments.  Then, count through the list
finding the lowest value each time, and add up the filter weights
until you cross the median.

The purpose of weighting is to allow some more flexibility to shape
the spectrum and prefer values that are closer to the original signal.
It still has the same ability to reject outliers if you select good
weights.

(with fexpr~ and a fixed number of weights) a while back.  I'd be
happy to dig up the code and algorithm after work today.

There's just two things that sound difficult in this application:

1.  How to handle the endpoints of the signal blocks?

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.

Chuck

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
> "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
>http://homepages.cae.wisc.edu/~sethares/software/SpectralTools.pdf
>
> 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
>