I have a spectrum from the Fourier transform. It looks like this:

The police just walked by
Color represents intensity.
X axis - time.
Y axis - frequency - where 0 is on top.
As long as the whistle or police siren leaves only one trace, many other tones seem to contain many harmonic frequencies.
An electric guitar connects directly to the microphone (standard setting)
The very bad thing is that, as you see, there is not much intensity - there are almost 2-3 frequencies that are almost equal. I wrote a peak detection algorithm to highlight the strongest peak:
function findPeaks(data, look_range, minimal_val) {
if(look_range==null)
look_range = 10;
if(minimal_val == null)
minimal_val = 20;
var peaks = [];
var max_value = 0;
var max_value_pos = 0;
var smaller_values = 0;
var val;
var lastval=Math.round(data.averageValues(0,4));
for(var i=0, l=data.length; i<l; i++) {
val = data[i];
if(max_value>val) {
smaller_values++;
if(smaller_values > look_range) {
peaks.push(max_value_pos);
max_value = 0;
max_value_pos = 0;
smaller_values = 0;
}
}
else if(val>lastval && val>minimal_val) {
max_value = val;
max_value_pos = i;
smaller_values = 0;
}
lastval = val;
}
peaks.sort(function(a, b) {return -data[a]+data[b];});
return peaks;
}
, , , thresold minimal_val. look_range , . , .
, , :

jsFiddle, , (, , ).