The answer to the question is that it's a complete waste of time writing a program of such complexity, as evidenced by the other answers, when all you have to do is listen to the song. Most popular songs have a small number of chords, usually at least 3, usually fewer than 10, that you could pick out by ear once you studied the sheet music. You would learn far more about the structure of a good song, and good music in general, by taking this approach, rather than have some program do it for you.
TL;DR Jump to End of TL;DR
Warning! Blatant music math geekiness ahead. The TL;DR is there for a reason.
The frequency of a given pitch in Hertz $(Hz)$ can be found by the following formula:
$$f(n)=440\cdot2^{(n/12)}$$
Where $n$ is the number of semitones that a pitch is away from the standard reference pitch of A4 (440Hz). If $n>0$, the pitch is higher than A4. If $n<0$, the pitch is lower than A4. If $n=0$, the pitch is A4 itself.
$$f(0)=440\cdot2^{(0/12)}=440\cdot2^0=440\cdot1=440Hz$$
The three main points of the formula are:
- A4 is the reference pitch by which all other pitches are determined.
- When you double the frequency, you go up an octave.
When you halve the frequency, you go down an octave.
- All twelve pitches of the chromatic scale are evenly spaced from each other,
unlike in the past.
A complicating factor arises if you play a transposing instrument, like I do.
I play the saxophone (alto sax mostly these days). The four most common saxophones in use today are the soprano, alto, tenor, and baritone (bari for short). The soprano and tenor are in the key of B$\flat$, meaning if you play a C written in sheet music, you get B$\flat$ as the tone you produce. A similar situation exists for the alto and bari saxes, which are in the key of E$\flat$. The transpositions are not only of pitch, but of octaves as well. All music for the saxophone family is written with a treble clef, from the smallest to the hugest. It's just something that the composer or arranger of the song has to deal with. The following table will show you what I mean.
B$\flat$ Soprano Sax -2 semitones
E$\flat$ Alto Sax -9 semitones
B$\flat$ Tenor Sax -14 semitones
E$\flat$ Bari Sax -21 semitones
Here are a couple of examples to illustrate the point. The highest key on the soprano sax I have is the high F key (not F$\sharp$). The high F is 20 semitones above A4. Subtracting 2 semitones from the table above you have 18 semitones higher.
Plugging +18 into the formula, you get:
$$f(18)=440\cdot2^{(18/12)}=440\cdot2^{(3/2)}=440\cdot2^{1.5}\approx1,244.5Hz$$
The bari sax has a low A key. No other saxophone has one, even the much larger and much lower saxophones. The low A (2 ledger lines below the treble clef) is written an octave (12 semitones) below A4, making it A3. Adding -12 and -21, you get -33. Using the formula again:
$$f(-33)=440\cdot2^{(-33/12)}=440\cdot{(-11/4)}=440\cdot2^{-2.75}\approx65.4Hz$$
Before I go, I want to tell you about the tubax (mash up of tuba and sax). It is a wondrous creation of musical technology. For it allows a very low pitched sax to realized in the relatively compact form of a tuba, rather than a saxophone that is as taller or taller than the person playing it. There are two kind of tubaxes: a contrabass tubax in E$\flat$ and a subcontrabass tubax in B$\flat$. Why don't we calculate the lowest frequency of each? Should be fun.
The E$\flat$ contrabass tubax is pitched an octave below the bari sax. We can build off what we have done before.
$${f(-33)}\cdot{1/2}=440\cdot2^{(-33/12)}\cdot2^{-1}=440\cdot2^{-11/4}\cdot2^{-1}=440\cdot2^{(-11/4)-(4/4)}=440\cdot2^{-15/4}=440\cdot2^{-3.75}\approx32.7Hz$$
The B$\flat$ subcontrabass tubax is pitched an octave lower than the B$\flat$ bass saxophone, which itself is pitched an octave lower than the B$\flat$ tenor sax. So the subcontrabass tubax is pitched two octaves lower than the tenor sax.
Start by calculating the frequency of the lowest pitch of the tenor sax. The low B$\flat$ is written 11 semitones below A4. Adding -11 and -14 you get -25. Once again with the formula.
$$f(-25)=440\cdot2^{(-25/12)}\approx103.8Hz$$
Then we have
$$f(-25)\cdot{1/4}=440\cdot2^{(-25/12)}\cdot2^{-2}=440\cdot2^{(-25/12)-(24/12)}=440\cdot2^{-49/12}\approx26.0Hz$$
End of TL;DR
That's all, folks! No more braggadocious boasting and blustering, until I can create and physically instantiate an idea in both embedded hardware and firmware. (DSP hardware and firmware in this case).