Hello guys, I'm using Ubuntu 12.10 and Python 2.7 right now. I'm working on code using the Mingus module but this question isn't specific to this module, per se.
What I'm trying to do is to generate the fibonacci numbers up to a given N and then do modulo 12 on each number in order to create a list of numbers for the Mingus module to convert to notes. What I would like to do is store each note created in a different element in a list so that I can later manipulate it, say by removing certain note letters from the list at will. That way the scales created by the program can become more useful, for example I could remove all notes that aren't present in say a Harmonic Minor scale, and only keep the list items that do exist in that scale in a given key. That way it becomes, in a way, like the computer is writing your guitar solos! Pretty neat I think. Anyways, the problem I'm having is I'm not really sure how to search a list for multiple elements and remove just those elements. Below is my code so far, and information y'all could provide would be appreciated. Thanks. import mingus.core.notes as notes #fibonacci def fib(num1,num2): a, b = 0, 1 for i in xrange(num1,num2): c = b % 12 #modulo 12 on each generated fibonacci number a_list= [notes.int_to_note(c)] #using Mingus to translate the Fib mod12 numbers into notes and then (I think) storing each one as an element in a list? a, b = b, a+b #this is just the algorithm for the fibonacci numbers
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor