Is there a program that can determine the highest pitch within an audio file?

R is cross-platform and free / open source.

Load it, and load the tuneR and seewave libraries (install them from the package manager if not installed yet).

library(tuneR)
library(seewave)

Then, load your MP3 or WAV file:

w = readMP3("dog-whistle-0.mp3")
w = readWave("dog-whistle-0.wav")

Now, let's plot the spectrum and its peaks:

fpeaks(meanspec(w), nmax=1)

Result:

Numerical result:

fpeaks(meanspec(w), nmax=1, plot=FALSE)
12.05859

The above only works with non-musical data. When you analyze frequencies of music, you'll find that the highest frequencies will always be around 12-20 kHz, depending on the instrument(s) involved. However, this highest frequency will not give you an estimate of the note that's being played, since a musical note, when played by an instrument, will be composed of multiple frequencies.

This is the so-called "timbre" of an instrument, and you'll find that that an A at 440 Hz by a flute will include different frequency components as compared to an A played by an electric guitar.

Your best bet is to run a dominant frequency analysis by looking at the frequency peaks over sliding time windows, and check where the highest one occurs.

There's no such thing as "frequency over time" though. You can only plot the average (or dominant) frequency over certain sliding time windows. Seewave offers quite a few functions regarding selecting windows of time, but it gets rather complicated.

You could use

s = specprop(meanspec(w, from=10, to=11)) 

to get the spectrum properties from 10 to 11 seconds and then call s$centroid or s$mean to get the centroid or mean frequencies of that particular time window (although 1 second is quite large for audio analysis).

If your Wave file uses 44.1 kHz sampling, you could downsample it to reduce the computation effort, e.g. to 16 kHz.

w = downsample(w, 16000)

But remember that according to the Nyquist Theorem, the maximum frequency that can be represented now is 8 kHz.

You could also look for a pitch detection software. Like this one, which requires MATLAB though.


Have you tried Audacity? It is a freeware tool that has some fairly sophisticated analysis tools, including a Plot Spectrum command accessed from Analyse -> Plot Spectrum....

Screenshot

Note that you get different results with the MP3 version of the file compared to the WAV version because the MP3 compression has altered the waveform and introduced artifacts/aliasing.

Edit: Those sound files you link to are not good examples for this. The higher frequency files are only sampled at 44.1KHz which is tailored to human hearing (around 20KHz max). You can't represent ultrasound frequencies without increasing the sample rate.