Permalink
Browse files

denormalize the chords

  • Loading branch information...
1 parent 13cebcc commit d88abe6be9573111b97726d746899d64422a5436 Raphael Sofaer committed Jan 6, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 scripts/graph.py
View
@@ -174,7 +174,7 @@ def chords_to_midi(chords):
#first need to put it in json format (4 voices)
json_dict = [[],[],[],[]]
for st, chord in enumerate(chords):
- c = chord.chord
+ c = denormalize_chord(chord.chord)
print c
for i in range(4):
cpitch = c[i]
@@ -213,6 +213,16 @@ def tableify(l):
l_out.append([v[i] for v in l])
return l_out
+def denormalize_chord(chord):
+ """ Takes a tuple representing a chord, returns a new tuple"""
+ newChord = list(chord)
+ newChord[0] = newChord[0] + 60
+ newChord[1] = newChord[1] + 48
+ newChord[2] = newChord[2] + 48
+ newChord[3] = newChord[3] + 36
+ return tuple(newChord)
+
+
if __name__ == '__main__':
time1 = dt.now()

0 comments on commit d88abe6

Please sign in to comment.