Iâve had chance to look at your code. I had an idea that I the answer to my problem some how involved breaking down the list into groups and that the notes would be easier to work with as numbers. However, I think your âmake_diffsâ function is really a very cunning way to go about things ï I would have never have thought of that!
As to the latest update, that is very welcome and will allow me to analyse the results given in more detail. In answer to your questions â Are your search sequences really limited to 4 notes? â No, just used that as an example How long are the pieces you are searching? â Anything from the length of a phrase to perhaps 32 bars, though maybe longer at some later date. Do you not need to care about note lengths, only pitches. â While Iâve been trying to figure out a way to do this Iâve just concentrated on pitches, but it would be great to be able to look at the note lengths as well. Are you really (as I inferred from your examples) looking only at a 7-tone scale â Yes, for the time being Your code will identify sequences in a list, but how to index them? I have an idea, which seems ridiculously long-winded, but should work. First, put the groups from the âmake_diffsâ function into a list and do a search for the sequence identified from the âcompare_formsâ function using the âKnuth-Morris-Prattâ function in the python cookbook. Then the positions in that list will obviously be the same as those in the original. Next is the problem of the interval between the individual groups of the sequence. Using something along the lines of your âmake_diffsâ it should be a simple matter to see by what interval the groups in the sequence are transposed. Hmmâ those last two paragraphs come across as the ranting of a mad man. Iâm off home to see if something like that worksâ All the best and thanks again for the help, Malcolm -- http://mail.python.org/mailman/listinfo/python-list