[Pychord-commits] r69 - in trunk: pgui pychord2

danilo at garage.maemo.org danilo at garage.maemo.org
Tue Mar 25 18:50:13 EET 2008


Author: danilo
Date: 2008-03-25 18:50:10 +0200 (Tue, 25 Mar 2008)
New Revision: 69

Added:
   trunk/pychord2/chords.py
Modified:
   trunk/pgui/list.py
Log:
- Chord heuristic function
- Some alteration into list... But I don't remember what I did. =(

Modified: trunk/pgui/list.py
===================================================================
--- trunk/pgui/list.py	2008-03-23 15:38:15 UTC (rev 68)
+++ trunk/pgui/list.py	2008-03-25 16:50:10 UTC (rev 69)
@@ -50,7 +50,7 @@
         self.lastMove = 0    
         
     def addLine(self, text):
-        lbl = label(self, [2,len(self.objects)*self.ptsize+5], text, (255,255,255), fontFile = self.fontFile, ptsize = self.ptsize)
+        lbl = label(self, [2,len(self.objects)*self.ptsize+10], text, (255,255,255), fontFile = self.fontFile, ptsize = self.ptsize)
         container.addElement(self, lbl)
         return lbl
        

Added: trunk/pychord2/chords.py
===================================================================
--- trunk/pychord2/chords.py	                        (rev 0)
+++ trunk/pychord2/chords.py	2008-03-25 16:50:10 UTC (rev 69)
@@ -0,0 +1,19 @@
+def changeTone(chords, semiTons,toneUp = True):
+    chordlist = ['H', 'G#', 'G', 'F#', 'F', 'E', 'D#', 'D', 'C#', 'C', 'B', 'A#', 'A']
+
+    semiTons = semiTons % 12
+    if not toneUp:
+        semiTons = (12 - semiTons)%13
+    for i in range (semiTons):
+        for i in chordlist:
+            chords = chords.replace(i,chordlist[(chordlist.index(i) - 1 )%13])
+        chords = chords.replace('H',"A")
+        
+    return chords
+
+song = "A A# B C C# D D# E F F# G G#"
+print changeTone(song, 1, False)
+
+
+
+re.compile("([a,b,c,d,e,f,g,h,i,j,l,n,o,p,q,r,s,t,u,v,x,z,H,I,J,L,N,O,P,Q,R,S,T,U,V,X,Z]|Dam)")
\ No newline at end of file



More information about the Pychord-commits mailing list