def test_harmonize(self): c_major = NoteSeq("C D E F G A B") c_major_harmonized = [ NoteSeq("C E G"), NoteSeq("D F A"), NoteSeq("E G B"), NoteSeq("F A C''"), NoteSeq("G B D''"), NoteSeq("A C'' E"), NoteSeq("B D'' F''") ] self.assertEqual(c_major.harmonize(), c_major_harmonized)
def test_harmonize(self): c_major = NoteSeq("C D E F G A B") c_major_harmonized = [NoteSeq("C E G"), NoteSeq("D F A"), NoteSeq("E G B"), NoteSeq("F A C''"), NoteSeq("G B D''"), NoteSeq("A C'' E"), NoteSeq("B D'' F''")] self.assertEqual(c_major.harmonize(), c_major_harmonized)
c_major_scale = NoteSeq("C D E F G A B") assert str(c_major_scale) == '<Seq: [<C>, <D>, <E>, <F>, <G>, <A>, <B>]>' assert str(c.harmonize(c_major_scale)) == '[<C>, <E>, <G>]' assert str(c.harmonize_template(c_major_scale, [1, 3, 5])) == '[<C>, <E>, <G>]' assert str(c.harmonize_template(c_major_scale, [1, 2, 3])) == '[<C>, <D>, <E>]' assert str(c.harmonize_template(c_major_scale, [1, 4, 2])) == '[<C>, <F>, <D>]' assert str(c.harmonize_template(c_major_scale, [5, 7, 9])) == '[<G>, <B>, <D>]' assert str(c.harmonize_template(c_major_scale, [1, 2, 3, 4])) == \ '[<C>, <D>, <E>, <F>]' assert str(c.harmonize_template(c_major_scale, [1, 3, 5, 6, 8])) == \ '[<C>, <E>, <G>, <A>, <C>]' assert str(c_major_scale.harmonize()) == '[' \ '<Seq: [<C>, <E>, <G>]>, ' \ '<Seq: [<D>, <F>, <A>]>, ' \ '<Seq: [<E>, <G>, <B>]>, ' \ '<Seq: [<F>, <A>, <C>]>, ' \ '<Seq: [<G>, <B>, <D>]>, ' \ '<Seq: [<A>, <C>, <E>]>, ' \ '<Seq: [<B>, <D>, <F>]>' \ ']' assert str(c_major_scale.harmonize_template([1, 3, 5])) == '[' \ '<Seq: [<C>, <E>, <G>]>, ' \ '<Seq: [<D>, <F>, <A>]>, ' \ '<Seq: [<E>, <G>, <B>]>, ' \ '<Seq: [<F>, <A>, <C>]>, ' \ '<Seq: [<G>, <B>, <D>]>, ' \ '<Seq: [<A>, <C>, <E>]>, ' \
def harmonize_all_scales(): for forte, pc_set in pcset.PC_SETS.items(): scale = NoteSeq([Note(n) for n in pc_set]) scale.harmonize()