Skip to content

Commit

Permalink
printChords now takes chords as input
Browse files Browse the repository at this point in the history
  • Loading branch information
pvankranenburg committed May 1, 2023
1 parent fa0b65e commit f36ad2a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/pitchcontext/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,15 +681,15 @@ def getChordsForNote(self, pitchcontextvector, normalize=True, scalemask=np.ones

return scores, strengths

def printChordsForNote(self, scores, strengths):
def printChordsForNote(self, chords):
epsilon = 10e-4
chordixs = np.where(scores > epsilon)
chordixs = np.where(chords > epsilon)
chords_pre = []
chords_post = []
chords_all = []

for ix in zip(chordixs[0], chordixs[1]):
info = (base40[ix[0] % 40], self.chordquality[ix[1]], scores[ix], strengths[ix], scores[ix] * strengths[ix])
info = (base40[ix[0] % 40], self.chordquality[ix[1]], chords[ix])
if ix[0] < 40:
chords_pre.append(info)
else:
Expand All @@ -699,15 +699,15 @@ def printChordsForNote(self, scores, strengths):
chords_all.append(info)

print('pre:')
for info in sorted(chords_pre, key=lambda x: x[4], reverse=True):
for info in sorted(chords_pre, key=lambda x: x[2], reverse=True):
print(info)

print('post:')
for info in sorted(chords_pre, key=lambda x: x[4], reverse=True):
for info in sorted(chords_pre, key=lambda x: x[2], reverse=True):
print(info)

print('all:')
for info in sorted(chords_pre, key=lambda x: x[4], reverse=True):
for info in sorted(chords_pre, key=lambda x: x[2], reverse=True):
print(info)

def printChord(self, chord_in):
Expand Down

0 comments on commit f36ad2a

Please sign in to comment.