# Findtune.com Technical Notes

A brief example of how the input looks involves trying to identify "Happy Birthday to You" using the first six notes:
s- u+ d= u= d+
The first note doesn't get mentioned, but the second note has the same pitch and shorter duration than the first one; the third note has higher pitch and longer duration than the second one, fourth has lower pitch but same duration, the up with same duration, and down with a longer duration. All indications (pitch and duration) are with respect to the previous note. Note that this example also matches other melodies quite closely; adding more notes helps tell them apart.

You can also enter pitch or duration without the other. For example, the following matches the end of "Twinkle, Twinkle, Little Star":
u s d s d s d - = = = = = + d s d s d s d
As this example shows, you can match any part of a tune, not just the beginning.

My random thought, based on no science whatsoever, is that this will start to be useful when there are about 10,000 tunes in the database. Since it has taken me months to get to 470, this could take a while. However, you can contribute by going here.

The concept of random correlations in the database is an interesting one. Consider the following table, which gives the percent of melodies in the database that are unique for the given length of input strings:

 0 %ile 190 10 %ile 79 20 %ile 66 30 %ile 58 40 %ile 53 50 %ile 48 60 %ile 42 70 %ile 35 80 %ile 29 90 %ile 22

12 melodies were not unique for any string

In theory, this says you need at least 48 notes in your input to guarantee a 50% chance of finding your melody - if it is in the database! Experience shows it is not really that bad.

The following chart is probably better. This is used by trying a large number (200) of strings of given lengths from the database, and measuring how frequently they gave the unique right answer:

Notwithstanding the strange lumps in the curve, I find this very interesting. Basically, if you can input 11 or more notes (really intervals) you can get the correct identification most of the time, with the caveat that the melody is in my database. I will track the 95% confidence level as the database grows to see how it moves with size.

 DB Size Lengthfor 95% 466 14 692 14 800 14

There are also some challenges with the algorithm. It is very robust to small errors of rythm and pitch, but the wrong number of notes throws it off completely. So what do you do if there is a trill, and you really can't even count the notes? I actually have an idea about implementing wild-cards in the input, but there are more things to do than time to do them in. I will get to it "soon".

Just for the record, I thought of this technique years ago (probably before I even got to college - lot's of years ago). I have just never had the time to check it out until now.

Contact me by email