MCPcopy Create free account
hub / github.com/bspaans/python-mingus / note_in_range

Method note_in_range

mingus/containers/instrument.py:62–76  ·  view source on GitHub ↗

Test whether note is in the range of this Instrument. Return True if so, False otherwise.

(self, note)

Source from the content-addressed store, hash-verified

60 self.range = range
61
62 def note_in_range(self, note):
63 """Test whether note is in the range of this Instrument.
64
65 Return True if so, False otherwise.
66 """
67 if isinstance(note, six.string_types):
68 note = Note(note)
69 if not hasattr(note, "name"):
70 raise UnexpectedObjectError(
71 "Unexpected object '%s'. "
72 "Expecting a mingus.containers.Note object" % note
73 )
74 if note >= self.range[0] and note <= self.range[1]:
75 return True
76 return False
77
78 def notes_in_range(self, notes):
79 """An alias for can_play_notes."""

Callers 2

can_play_notesMethod · 0.95
test_note_in_rangeMethod · 0.80

Calls 2

NoteClass · 0.90

Tested by 1

test_note_in_rangeMethod · 0.64