Esempio n. 1
0
    def generate_harmony(self, param):
        melody_notation = self.melody_notation
        if melody_notation in [1, 3, 5]:
            notation = 1
        elif melody_notation in [4, 6]:
            notation = 4
        else:
            notation = 5

        self.annotated_important_notes = []
        self.annotated_important_notes.append({
            'notation': 0,
            'note': Note(start=0)
        })
        self.annotated_important_notes.append({
            'notation':
            0,
            'note':
            Note(start=self.harmony_length)
        })

        self.adjusted_progressions = [notation, 1]
        (annotated_notes, tonality) = Generator.add_bass(
            self.annotated_important_notes, self.tonality,
            self.adjusted_progressions, self.harmony_length, param)
        (annotated_notes,
         tonality) = Generator.add_effects(annotated_notes, tonality, param)

        annotated_notes_refined = []
        for annotated_note in annotated_notes:
            if annotated_note['note'].start < self.harmony_length:
                annotated_notes_refined.append(annotated_note)
        return annotated_notes_refined