Thursday, September 29, 2005

Music search engine

Many times I have had a fragment of a tune run through my mind, and wondered what it came from. Sometimes I've found the same fragment appear in two different melodies--with a slight change in a note.

Suppose you could type in (with sound, so you can hear what you've put in and make sure it is what you want) a string of notes, and then ask the search engine to find all works where this was part of the melody (or part of the viola part, and so on). You could use this to find the tune that you wanted to use but couldn't remember the name of, or to find out if the song you composed was invented or remembered, or look for similar motifs to research influences among composers.

Suppose one were to scan or otherwise incorporate the various musical lines for a given work into a searchable database, so that you could look for works that matched a given fragment. A work might consist of one musical line (a simple tune) or many (the voices for each instrument in a symphony), together with any lyrics involved. It would not be hard to define a search for a string of notes. (A rest is a note for this purpose.)

What would be hard is optimizing the search. The text search engines search for word matches. Words are nicely separated (by spaces, commas, end-of-line, etc), and there are only a finite set of them. Unfortunately there aren't always neat divisions, and the blocks of notes are quite long. You could try arbitrarily partitioning a musical line into chunks all the same size, and using a pre-indexing that lists all the different such chunks that were used. This might get rather big, but I don't have a good feel for how big Google's indexing system is, so I've no way to guess how feasible it is.

After getting the base search engine running, the obvious next step is implementing fuzzy searches, where one or two of the notes aren't exact; and shaped searches, where the key is arbitrary. This would make is useful to the rest of us who aren't musical pros or academics.

Of course you need to have some standard descriptions of notes and formats for downloading musical directions and standards for associating musical lines into a single work, but I'd think these would be fairly straightforward to devise.