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

Method place_notes

mingus/containers/bar.py:80–106  ·  view source on GitHub ↗

Place the notes on the current_beat. Notes can be strings, Notes, list of strings, list of Notes or a NoteContainer. Raise a MeterFormatError if the duration is not valid. Return True if succesful, False otherwise (ie. the Bar hasn't got enough room for a n

(self, notes, duration)

Source from the content-addressed store, hash-verified

78 )
79
80 def place_notes(self, notes, duration):
81 """Place the notes on the current_beat.
82
83 Notes can be strings, Notes, list of strings, list of Notes or a
84 NoteContainer.
85
86 Raise a MeterFormatError if the duration is not valid.
87
88 Return True if succesful, False otherwise (ie. the Bar hasn't got
89 enough room for a note of that duration).
90 """
91 # note should be able to be one of strings, lists, Notes or
92 # NoteContainers
93 if hasattr(notes, "notes"):
94 pass
95 elif hasattr(notes, "name"):
96 notes = NoteContainer(notes)
97 elif isinstance(notes, six.string_types):
98 notes = NoteContainer(notes)
99 elif isinstance(notes, list):
100 notes = NoteContainer(notes)
101 if self.current_beat + 1.0 / duration <= self.length or self.length == 0.0:
102 self.bar.append([self.current_beat, duration, notes])
103 self.current_beat += 1.0 / duration
104 return True
105 else:
106 return False
107
108 def place_notes_at(self, notes, at):
109 """Place notes at the given index."""

Callers 5

MIDI_to_CompositionMethod · 0.95
place_restMethod · 0.95
__add__Method · 0.95
add_notesMethod · 0.80
setUpMethod · 0.80

Calls 1

NoteContainerClass · 0.90

Tested by 1

setUpMethod · 0.64