# Calculating hertz / kHz

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?

Thanks

• 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. – ClaudeShannonWasCool Feb 14 '14 at 23:51
• @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 :) – Phorce Feb 14 '14 at 23:53
• 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. – ClaudeShannonWasCool Feb 14 '14 at 23:56