def sort( self ): #override sorting to preserve structure order over pitch class ordinality ret = sorted([pitch.pc(x - self.root) for x in self.pitches]) ret = [pitch.pc(x + self.root) for x in ret] self.pitches = ret return self
def tone_to_pitch(self, tone): intervals = pitch.tone_to_intervals(tone) pitches = [pitch.pc(i+self.root) for i in intervals] for p in self.pitches: if p in pitches: return p return None
def clean(self): self.root = pitch.pc(self.root) PitchClassSet.clean(self)
def sort(self): #override sorting to preserve structure order over pitch class ordinality ret = sorted([pitch.pc(x - self.root) for x in self.pitches]) ret = [pitch.pc(x + self.root) for x in ret] self.pitches = ret return self