# Detecting a curve with certain characteristics in a spectrogram

I have a spectrogram built by breaking a signal into chunks and taking the FFT of these chunks. An example spectrogram is:

In this spectrogram I am looking for a curve (aka pitch contour) that:

• Starts at zero
• Increases to an unknown value
• Stays at that unknown value for at least one minute
• Decreases back to zero

It's fairly easy to program this curve detection in the spectrogram above since the curve of interest is brighter than other potential curves. However, this brightness difference won't exist in a noisier data set.

How can I use the constraints I know about the curve (starts at zero, increases, ...) to reliably find the curve without relying on the brightness?

This answer might sound hard initially, but once understood it is intuitive and certainly deals well with the noise.

One smart way to model such constraints is either through HMM's or through MRFs. The design is similar, but for HMM I would give you some hint:

Prepare your transition matrix in such a way that Viterbi decoding would provide you the resulting curve. For example, the first state will be at 0 with certain variance, since it starts there. Then it is only allowed to increase, within a given tolerance. This tolerance would be obtained from a Gaussian prior. Say, the slope of the line (thus the variance of the Gaussian) would range from 1 to 5. Finally, you should only allow for a decrease or keeping constant. Similarly, for every other constraint you could do this. Here allowance means that the probability of transition from the constant state to an increasing state is 0. Otherwise you have a probability (might be due to any distribution, prior etc.)

You could also make use of Hierarchical HMMs to elaborate your model with such tracking parameters:

• Is a particle filter equivalent to your suggestion? If not, what are the disadvantages? Mar 17 '14 at 5:11
• Well, with a broad connection, I guess one could view it that way. But, the particle filter approaches are far from being optimal, and is only meaningful when the space is too large (as they are based on some kind of Monte Carlo sampling). Here Viterbi solution would give you the global optimality of the model. Mar 17 '14 at 13:02