# STFT Time Variance - Threshold

This is a follow up question to: Segment/Idenfication of signal from a spectrogram

My main goal is to identify (segment) all of the calls from a given signal. The signal looks like the following (Spectrogram):

Notice how there are 4 calls within this signal, I would like to identify there are 4 calls and just capture these calls so I can then use this for later analysis.

So far I have carried out the following:

• Computed an STFT (Spectrogram on the time-signal) of a series of bat calls.

The spectrogram shows where each of the calls are, by the high energy levels.

What I am now calculating is the time variance between all of the different calls using the following formula:

$$T = \sum_a^b x \sqrt{re*re+im*im}$$

This is calculated for each of the bins, the result is as follows:

Where I belive the x axis relates to the time, and the y axis is the total variance

From this, it is clear where the most significant parts of the signal are, the 4 spikes indicate the parts that I need to extract, it's just how... I suppose I could use a threshold value, and state that:

if variance > THRESHOLD:
keep the block
else:
place "0" in each of the elements


But, how would I calculate the threshold in order to the above? What if the next set of calls are different to the threshold set for this?

Any help would be appreciated.

EDIT:

By doing the following (above) and, using a threshold value, I get the following result:

Therefore, can I calculate each of the frequencies (of the bird calls) based upon this? I.e. $$(binnumber * Fs) / NFFT$$

Where Fs is the frequency sample rate and NFFT is the size of each of the bins?

• @down-voter - Why has this question been downvoted? :s Commented Jan 30, 2014 at 0:38

You could use a factor $0<c<1$ of the average of the variances
$\mathrm{THRESHOLD}=c\cdot{\operatorname{avg}(\operatorname{var}(X))}$
• Sorry, what do you mean by lower c what would the c value be in this case? Either way, the values seem pretty clear. On every signal I have tested with; the algorithm is working fine.. Just need to calculate the correct threshold value now Commented Jan 29, 2014 at 20:02
• I just noticed I was talking about $\mathrm{THRESHOLD}=(1-c)\cdot\mathrm{min}(\mathrm{var}(X))+c\cdot \mathrm{max}(\mathrm{var}(X))$. Either way, $c$ is just a weight. Bin index is proportional to frequency, yes. Commented Jan 29, 2014 at 20:10