Sequences in list

temp at mclift.fsnet.co.uk temp at mclift.fsnet.co.uk
Wed May 4 15:37:38 EDT 2005


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




More information about the Python-list mailing list