Monday, December 9, 2013

DSP snippets

PITCH DETECTION
kevin_thibedeau writes
There is a good way to make the harmonic product spectrum more robust to the effects of noise. You generate a synthetic spectrum starting from a histogram of zero crossing intervals that has been "smeared" back into a continuous signal with Gaussian peaks by applying a kernel density estimate. The result can then be passed through the HPS to find the fundamental. The decorrelated zero crossings caused by noise are much less problematic than working with the HPS of the original signal.

Also, an overview here: http://obogason.com/fundamental-frequency-estimation-and-machine-learning/

Original link:https://news.ycombinator.com/item?id=10757879


PEAK DETECTION
John on comp.dsp writes (https://groups.google.com/forum/#!topic/comp.dsp/MqSJjoaq8Hg)
It is entirely inappropriate for some problems, but one peak-picker that I use sometimes is a three segment sliding window:

LLLLLLLLLLCCCCCRRRRRRRRRR

When the maximum of window C is in the middle of C, and that maximum exceeds max(f(L),f(R)), then a peak at the middle of C is declared. The function f can be mean(L) or max(L) or something else. The window lengths are tuned to your requirements

Lito on comp.dsp writes
For a series with well behaved peaks the following
has worked for me.  What it lacks in efficiency it
it makes up for with reliability.

function peaks(x,region,thresh)
  value,index = max(x)
  while value > thresh
    add value, index to list
    zero out region about index
    value,index = max(x)
  endwhile
return list