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)
| 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.""" |
no test coverage detected