Example #1
0
 def test_solfege2et_f_to_g_same_c_to_d(self):
     """Tests that step relationships work."""
     for div in range(5, 53):
         self.assertTrue(
             solfege2et("g", div) -
             solfege2et("f", div) == solfege2et("d", div) -
             solfege2et("c", div))
Example #2
0
def handle_symbolic_notation(event):
    """Handle a symbolic note event."""
    mylist = re.search(r"(?P<articul>[.\(]?)"
                       r"(?P<pitch>(?:\^/2|_/2|[_^=/\\<>!?]|"
                       r"\xc2\xa1|\xc2\xbf)*"
                       r"[a-g](?:\*)*[',]*)"
                       r"(?P<len>[0-9]{0,2})(?P<tie>[-]?)"
                       r"(?P<legato_end>[)]?)",
                       event)
    articul = mylist.group('articul')
    pitch = mylist.group('pitch')
    length_factor = mylist.group('len')
    tie_dash = mylist.group('tie')
    legato_end = mylist.group('legato_end')

    if articul and articul == '(':
        state_obj.articulation = 'legato'
    elif articul and articul == '.':
        state_obj.articulation = 'staccato'
    elif legato_end:
        state_obj.articulation = 'non-legato'

    articulation = state_obj.articulation

    if pitch:
        degree = helpers.solfege2et(pitch, state_obj.div)
        pitch = helpers.degree2hz(degree, state_obj.div)
    if length_factor:
        length_factor = int(length_factor)
    else:
        length_factor = 1

    if tie_dash:
        tie = 1
    else:
        tie = 0
    state_obj.length_factor = length_factor

    return pitch, length_factor, articulation, tie
Example #3
0
 def test_solfege2et_22edo_11_8_ratio_multiple_accidentals(self):
     """Test !_b is an 11/8 from f in 22edo."""
     self.assertTrue(solfege2et("!_b", 22) == 19)
     self.assertTrue(solfege2et("_b", 22) == 18)
Example #4
0
 def test_solfege2et_53edo_11_8_ratio(self):
     """Test the 11/8 ratio in 53edo is the right value."""
     self.assertTrue(solfege2et("!f", 53) == 24)
Example #5
0
 def test_solfege2et_31edo_7_4_ratio(self):
     """Test the 7/4 ratio in 31edo is the right value."""
     self.assertTrue(solfege2et("^a", 31) == 25)
Example #6
0
 def test_solfege2et_octave_down(self):
     """Tests that octave relationships work."""
     for div in range(5, 53):
         self.assertTrue(
             solfege2et("g,", div) == solfege2et("g", div) - div)
Example #7
0
 def test_solfege2et_Csharp_Dflat_meantone(self):
     """Tests the normal meantone case where C# LOWER than Db."""
     self.assertTrue(solfege2et("^c", 19) < solfege2et("_d", 19))
Example #8
0
 def test_solfege2et_Csharp_Dflat_superpyth(self):
     """certain tunings (e.g. 17edo) have the property that C# is HIGHER
     than Db; check that here."""
     self.assertTrue(solfege2et("^c", 17) > solfege2et("_d", 17))
Example #9
0
 def test_solfege2et_double_division(self):
     """octave relation by doubling division."""
     self.assertTrue(solfege2et("d", 34) == solfege2et("d", 17) * 2)
Example #10
0
 def test_solfege2et_middle_c_same(self):
     """middle c same in any division."""
     self.assertTrue(solfege2et("c", 17) == solfege2et("c", 19))