Skip to content

Commit

Permalink
bug in instruments.get_chord_minmax
Browse files Browse the repository at this point in the history
  • Loading branch information
benhackbarth committed Jan 11, 2022
1 parent 2789def commit ffff389
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions audioguide/fileoutput/musicalwriting.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,23 @@ def get_invalid_techniques(self, instrumentsobj, time):
def get_chord_minmax(self, instr, time, vc):
if len(self.instrdata[instr]['selected_notes_v2'][time]) == 0: return None
pitches = [p for p, db, vcidx in self.instrdata[instr]['selected_notes_v2'][time] if vcidx == vc]
if len(pitches) == 0: return None # in case there is nothing for this particular vcidx
dbs = [db for p, db, vcidx in self.instrdata[instr]['selected_notes_v2'][time] if vcidx == vc]
d = {'pitches': pitches, 'pitchmin': min(pitches), 'pitchmax': max(pitches), 'dbmin': min(dbs), 'dbmax': max(dbs)}
d['pitchrange'] = d['pitchmax']-d['pitchmin']
d['dbrange'] = d['dbmax']-d['dbmin']
return d
sys.exit()

if time not in self.instrdata[instr]['selected_notes']:
#print(self.instrdata[instr]['overlaps'][time])
return None
pitches = [p for d, p, db, vcidx in self.instrdata[instr]['selected_notes'][time] if vcidx == vc]
dbs = [db for d, p, db, vcidx in self.instrdata[instr]['selected_notes'][time] if vcidx == vc]
if len(pitches) == 0: return None
d = {'pitches': pitches, 'pitchmin': min(pitches), 'pitchmax': max(pitches), 'dbmin': min(dbs), 'dbmax': max(dbs)}
d['pitchrange'] = d['pitchmax']-d['pitchmin']
d['dbrange'] = d['dbmax']-d['dbmin']
return d
# if time not in self.instrdata[instr]['selected_notes']:
# #print(self.instrdata[instr]['overlaps'][time])
# return None
# pitches = [p for d, p, db, vcidx in self.instrdata[instr]['selected_notes'][time] if vcidx == vc]
# dbs = [db for d, p, db, vcidx in self.instrdata[instr]['selected_notes'][time] if vcidx == vc]
# if len(pitches) == 0: return None
# d = {'pitches': pitches, 'pitchmin': min(pitches), 'pitchmax': max(pitches), 'dbmin': min(dbs), 'dbmax': max(dbs)}
# d['pitchrange'] = d['pitchmax']-d['pitchmin']
# d['dbrange'] = d['dbmax']-d['dbmin']
# return d
########################################
def get_interval_restrictions(self, instrumentsobj, instr, vc, time):
tests = []
Expand Down

0 comments on commit ffff389

Please sign in to comment.