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

Method add_notes

mingus/containers/note_container.py:78–106  ·  view source on GitHub ↗

Feed notes to self.add_note. The notes can either be an other NoteContainer, a list of Note objects or strings or a list of lists formatted like this: >>> notes = [['C', 5], ['E', 5], ['G', 6]] or even: >>> notes = [['C', 5, {'velocity': 20}], ['E', 6, {'vel

(self, notes)

Source from the content-addressed store, hash-verified

76 return self.notes
77
78 def add_notes(self, notes):
79 """Feed notes to self.add_note.
80
81 The notes can either be an other NoteContainer, a list of Note
82 objects or strings or a list of lists formatted like this:
83 >>> notes = [['C', 5], ['E', 5], ['G', 6]]
84
85 or even:
86 >>> notes = [['C', 5, {'velocity': 20}], ['E', 6, {'velocity': 20}]]
87 """
88 if hasattr(notes, "notes"):
89 for x in notes.notes:
90 self.add_note(x)
91 return self.notes
92 elif hasattr(notes, "name"):
93 self.add_note(notes)
94 return self.notes
95 elif isinstance(notes, six.string_types):
96 self.add_note(notes)
97 return self.notes
98 for x in notes:
99 if isinstance(x, list) and len(x) != 1:
100 if len(x) == 2:
101 self.add_note(x[0], x[1])
102 else:
103 self.add_note(x[0], x[1], x[2])
104 else:
105 self.add_note(x)
106 return self.notes
107
108 def from_chord(self, shorthand):
109 """Shortcut to from_chord_shorthand."""

Callers 5

__init__Method · 0.95
from_chord_shorthandMethod · 0.95
__add__Method · 0.95

Calls 1

add_noteMethod · 0.95

Tested by

no test coverage detected