示例#1
0
    def find_note(self, note, octaves=True):
        note = Note(note)
        instances = []
        if octaves:
            halfsteps = int(
                np.round(
                    Note.get_forward_distance(self.root,
                                              note,
                                              metric='halfsteps')))

            while halfsteps <= self.max_fret:
                instances.append(self.get_fret(halfsteps))
                halfsteps += Octave

        else:
            halfsteps = int(
                np.round(Note.get_distance(self.root, note,
                                           metric='halfsteps')))
            if halfsteps >= 0 and halfsteps <= self.max_fret:
                instances.append(self.get_fret(halfsteps))

        return instances
示例#2
0
 def unique_color(self):
   cents = Note.get_forward_distance(C4, self)
   h = cents / 1200
   s = 1
   v = 1 - 1.0 / np.exp(self.octave / 2)
   return hsv_to_rgb((h,s,v))