Thanks everyone for your ideas. I have been real busy recently, but I worked a lot on this project during this past weekend.
As I said in my last post, I had made a lot of samples of my trumpet's notes. On Saturday, I recorded 29 different trumpet notes ranging from 233 to 984 Hz. I had converted and stored as spreadsheet files the prevous samples, and didn't store the harmonics of these new trumpet notes. I used these new .WAV files to test to see if my program could recognise these new notes as being a trumpet. I was able to correctly match all but one recording with the previously stored trumpet harmonics. The one that wasn't successful ended up matching up with a Bass Trombone. When I stored another trumpet harmonic set that was closer to this trumpet, I was able to get it to match with a trumpet.
This showed that by storing multiple sets of harmonics of a type of instrument over a wider range than just using one or two recordings, it allows the program to recognize the instrument at different frequency ranges where its harmonics are different.
I made a wider set of stored harmonics for the Alto Saxophone, Flute, Clarinet, and Trombone, so that now I am able to play an unstored recording of one of those instruments (plus Trumpet) larger range and recognize the instrument that was played. I can recognize a range of around 12 notes for Alto Sax, Flute, Clarinet, and Trombone, and around 22 notes for Trumpet. The frequency range is determined by the range of harmonic samples that I have stored for that instrument, which explains why I have a wider range for the Trumpet which I recorded myself.
I also got access to a French horn, and made a bunch of recordings (around 128 notes over a 20 note range) of different notes. I don't know how to play the Horn, so I just played many different octaves (by just changing my lip tightness) of each fingering position. Apparently, the French Horn can play some notes using different fingerings, because by the time I was done converting the recordings so I know their frequencies, I had anywhere from 2 to 4 of each note.
tbob, thanks again for showing me how to access the files in a folder. I don't even want to think of how large the program would be now if I was still using the same way to access the 82 spreadsheet files I have now, plus the french horn and any other instruments I add in the future. Thanks for the recordings. I'll have to take a look at them the next time I work on the project.
As mentioned previously, I have seen that an instrument's harmonics change over their playing range. In order to recognize the instruments over a wider range, I have stored sets of harmonics for the instrument's notes over a wider range. If I play a trumpet recording that is around 290 Hz, even though it will be different than the 634 Hz trumpet harmonics, it will probably match up with the 293 Hz trumpet harmonics, or ones in that range.
For now, I am just concentrating on getting the program to recognize different types of instruments, so I am only using a single kind of each instrument. I suspect that if you were to store the harmonics characteristic of two different types of violins, you could recognize which one was played (if they were different enough).
I found that the fundamental was not always the highest harmonic fairly early on because I was constantly looking at the frequency spectrum of the instruments. When I store a set of harmonics as a spreadsheet file, I first normalize them to be relative to the amplitide of the greatest harmonic. The greatest harmonic then has the value of 1, and the others are relative to that.
Since my program is currently working sucessfully, I am going to keep adding instrument samples to improve its range and accuracy. If I have everything finished, and have free time, (or hit some other problems) I may take a look at chemometrics. I just think my time would be wiser spent now on continuing to work on a working program than concentrating on something that I know nothing about.