Question

I am trying to develop an algorithm separates instrumental notes in music files. C#, C++ DLL's used. I've spent pretty long time to achieve it. So what I've done so far is:

  1. Perform a specialized FFT on PCM(it gives high resolutions both in time and frequency domain)
  2. Filterbank calculation on FFT bins to simulate human hearing system(psychoacoustic model)
  3. Pattern recognition with peak detection to feed input data for some machine learning stuff(currently planning level)

In current progress, I detected peaks with simple method "picking local maximam value". Roughly, detect as peak if f(x-1) < f(x) > f(x+1) where f(x)'s frequency reponse and x is frequency index.

But I got some problems here. If two or more signals present close in frequency domain, this method just detect one peak and all the others are hidden. I searched the web for few days. There were something called 'peak purity', 'peak separation'. To do peak separation, there were several methods. They are actually separating peaks well. Here are few picture I've googled.

separation1
(source: chromatography-online.org)

separation2

I think method using 'deconvolution' would be the best for this situation. But I have no idea how to deconvolute my spectrum, separate peaks with deconvolution. As far as I know, deconvolution won't give me multiple components of peaks as seen in above pictures directly. And what filter functions should I use? Since I am lack of math skills, I need pseudo code level help. Glad to see any other advices :)

Was it helpful?

Solution

In order to detect peaks, you can rely on a bayesian approach.

Each peak P_i can be modeled with a gaussian function characterized by its mean m_i and its deviation sigma_i.

F(x) ~ Sum_i {  1 / sigma_i / sqrt(2Pi) * exp(-(x - m_i)^2 / sigma_i^2) }

What you have is F(x_j) for some x_j. What you want are the (x_i, m_i) for each i, that minimize the least square distance :

(x_i, m_i) = argMin(Sum_j {(F(x_j) - Sum_i { 1 / sigma_i / sqrt(2Pi) * exp(-(x - m_i)^2 / sigma_i^2) })^2 })

This kind of equation can be solved with a non linear least squares solver.

Cheers

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top