Over the past few weeks, I have been working on a problem of segmenting an audio file containing some bat samples. I have now successfully come up with a moderate algorithm to do this.

I am trying to calculate the herts, or, the Htz of each of blocks that I have deemed to contain interest.

Currently, for the signal I am calculating the frequency using the following:

$$ freq = i * Fs / NFFT $$

Where i is the bin_index of the currently block.

This produces a vector containing 128 values which holds the frequencies. This, looks correct when I am plotting the spectrogram.

For each of the blocks that are of significance, I calculate the following:

1) Take the max magnitude of each of the blocks, capture the index
2) Match the index (calculated above) against the frequency vector

This, for one of the blocks produces the following:

hertz = 3375

To which I convert to Htz using the following:

Htz = hertz / 1000 = 3.375

Now, from my estimation, 33.3Htz does seem reasonable since this is in audible hearing, however, why am I getting such a small number, compared to what I should be getting?


  • $\begingroup$ What are Htz? Do you mean kHz? Your conversion from Hz to kHz is fine, but I have no idea what this "Htz" stuff is. $\endgroup$ – ClaudeShannonWasCool Feb 14 '14 at 23:51
  • $\begingroup$ @ClaudeShannonWasCool My bad. It seems that it's kHz and not Htz, I don't know where that has come from!! Everything looks fine now though, if the kHz by 10 I get the correct answer :) $\endgroup$ – Phorce Feb 14 '14 at 23:53
  • $\begingroup$ In that case, everything looks fine. You say "compared to what I should be getting", but you don't mention what you think you should be getting and why. $\endgroup$ – ClaudeShannonWasCool Feb 14 '14 at 23:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.