Beispiel #1
0
 def setUp(self):
     self.a = PcSet('9047B2')
     self.b = PcSet('047B25')
     self.c = self.b.TnI(9)
     self.d = PcSet('9048AB')
     self.forte42 = PcSet([0, 1, 2, 4])
     self.forte413 = PcSet([0, 1, 3, 6])
     self.forte43 = PcSet([0, 1, 3, 4])
     self.forte510 = PcSet([0, 1, 3, 4, 6])
     self.forte5Z12 = PcSet([0, 1, 3, 5, 6])
     self.forte5Z36 = PcSet([0, 1, 2, 4, 7])
Beispiel #2
0
 def test_minconf_inescapable3(self):
     # 1 conflict no matter what.
     pcs = PcSet('78AB')
     answer = 'G Ab Bb B'
     # Similar to test above.
     # Screening against double accidental 'Ab A#'
     self.assertEqual(notes(pcs), answer)
Beispiel #3
0
 def test_minconf_inescapable2(self):
     # 1 conflict no matter what.
     pcs = PcSet('5689')
     answer = 'F F# G# A'
     # Similar to test above.
     # Screening against double accidental 'Gb G#'
     self.assertEqual(notes(pcs), answer)
Beispiel #4
0
 def test_minconf_neighbor1(self):
     # Tests neighbor conflict in an ordered set, part 1.
     pcs = PcSet('AB9')
     answer = 'A# B A'  # 1 conflict.
     # 'Bb B A' also has 1 conflict, but A is not neighboring.
     # Therefore B pushes Bb to A#, a less popular note.
     self.assertEqual(notes(pcs), answer)
Beispiel #5
0
 def test_minconf_inescapable1(self):
     # 1 conflict no matter what.
     pcs = PcSet('0134')
     answer = 'C Db Eb E'
     # 'C C# D# E' also valid, but not as popular.
     # 'C Db D# E' also technically valid, but double accidental ugly.
     # Worst answer = 'C C# Eb E' (2 conflicts)
     self.assertEqual(notes(pcs), answer)
Beispiel #6
0
 def test_complement(self):
     """
     Tests the principle that the union of the original set and its
     complement should be the chromatic set.
     """
     fsm5 = self.amaj.complement()
     self.assertEqual(len(fsm5) + len(self.amaj), 12)
     chromatic = PcSet(list(self.amaj) + list(fsm5))
     self.assertEqual(len(chromatic), 12)
Beispiel #7
0
 def test_union(self):
     """
     Tests union by constructing the chromatic scale from 8 transposed
     major chords. (Cmaj -> Fmaj -> ... -> Bmaj)
     """
     maj = PcSet('047')
     circle = [maj.T(n * 5) for n in range(8)]
     chromo = reduce(union, circle)
     self.assertEqual(set(chromo), set(range(12)))
Beispiel #8
0
 def setUp(self):
     self.cscale = PcSet("024579B")
     self.ionian = PcSet("024579B")
     self.phrygian = PcSet("4579B02")
     self.jazzminor = PcSet("023579B")
     self.majortriad = PcSet("047")
     self.minortriad = PcSet("037")
     self.diminished = PcSet("0235689B")
Beispiel #9
0
 def setUp(self):
     self.cmaj = PcSet('047')
     self.amaj = PcSet('914')
     self.cmin = PcSet('037')
     self.caug = PcSet('048')  # symmetry 3
     self.cscale = PcSet('024579B')  # symmetry 1
     self.c7b5 = PcSet('046A')  # symmetry 2
     self.dim = PcSet('0369')  # symmetry 4
Beispiel #10
0
 def test_common(self):
     """
     Very similar to the test applied to cvec in test_pcset.py: finds the
     common tone vector, then makes sure the common tones are actually
     there for each value of TnI.
     """
     c = PcSet('024579B')
     cvec = c.cvec()
     for n in range(12):
         self.assertEqual(len(common(c, c.TnI(n))), cvec[n])
Beispiel #11
0
 def setUp(self):
     # Obvious:
     # The linear ascending chromatic scale.
     self.obvious = ToneRow(range(12))
     # Obscure:
     # An example of using a simple pcset as a generator
     # for a tonerow . . . one day there will be a function
     # like this, but for now, we hack . . . .
     a = PcSet('015')
     self.obscure = ToneRow(
         str(a) + str(a.TnI(7)) + str(a.T(10)) + str(a.TnI(9)))
Beispiel #12
0
 def test_transpose_empty(self):
     es = PcSet([])
     self.assertEqual(list(es.transpose(3)), [])
Beispiel #13
0
 def setUp(self):
     self.cmaj = PcSet('047')
     self.caug = PcSet('048')
     self.cscale = PcSet('024579B')
     self.blackkeys = self.cscale.complement()
     self.c7 = PcSet('047A')
Beispiel #14
0
 def test_empty_list(self):
     pcs = PcSet([])
     self.assertEqual(str(pcs), '')
Beispiel #15
0
 def setUp(self):
     self.amaj = PcSet('9B12468')
     self.empty = PcSet([])
     self.chromatic = PcSet(range(12))
     self.g7 = PcSet('7B25')
Beispiel #16
0
 def test_ivec_ait1(self):
     ait1 = PcSet('0146')
     self.assertEqual(ait1.ivec(), [1] * 6)
Beispiel #17
0
 def test_empty_string(self):
     pcs = PcSet('')
     self.assertEqual(list(pcs), [])
Beispiel #18
0
 def test_from_list_get_len(self):
     pcs = PcSet(self.i)
     self.assertEqual(len(pcs), 7)
Beispiel #19
0
 def test_major_scale_reproduction(self):
     majorscale = PcSet('024579B')
     for n in range(12):
         answer = PROPER_SCALE_FORMS[n].strip()
         self.assertEqual(notes(majorscale.T(n)), answer)
Beispiel #20
0
 def test_from_list_to_list(self):
     pcs = PcSet(self.i)
     self.assertEqual(list(pcs), self.i)
Beispiel #21
0
 def test_from_string_get_len(self):
     pcs = PcSet(self.s)
     self.assertEqual(len(pcs), 7)
Beispiel #22
0
 def test_reduced(self):
     amajchord = PcSet([9, 1, 4])
     self.assertEqual(list(amajchord.reduced()), [0, 4, 7])
Beispiel #23
0
 def setUp(self):
     self.pcs = PcSet('0146')
Beispiel #24
0
 def test_ivec_ait2(self):
     ait2 = PcSet('0137')
     self.assertEqual(ait2.ivec(), [1] * 6)
Beispiel #25
0
 def test_empty_pcs(self):
     pcs = PcSet([])
     self.assertEqual(notes(pcs), '')
Beispiel #26
0
 def test_remove_duplicates(self):
     pcs = PcSet('01AAAA')
     self.assertEqual(list(pcs), [0, 1, 10])
Beispiel #27
0
 def setUp(self):
     self.a = PcSet([])
     self.b = PcSet([])
     self.chromo = PcSet(range(12))
Beispiel #28
0
 def test_convert_floats(self):
     pcs = PcSet([0, 1, 2.2, 3.1415])
     self.assertEqual(list(pcs), [0, 1, 2, 3])
Beispiel #29
0
 def test_from_list_to_string(self):
     pcs = PcSet(self.i)
     self.assertEqual(str(pcs), self.s)
Beispiel #30
0
 def setUp(self):
     self.amaj = PcSet('9B12468')
     self.empty = PcSet([])