Example #1
0
def test_scale_add_semitone():
    test = scale_12edo.Scale12EDO()
    assert test.tones == [0]
    retval = test.add_tone(SEMI)
    assert retval == 2
    assert test.degrees == [1, 2]
    assert test.tones == [0, SEMI]
Example #2
0
def test_scale_add_nontet():
    test = scale_12edo.Scale12EDO()
    assert test.degrees == [1]
    assert test.tones == [0]
    retval = test.add_tone(101)
    assert retval is None
    assert test.degrees == [1]
    assert test.tones == [0]
Example #3
0
def test_scale_add_wholetone():
    test = scale_12edo.Scale12EDO()
    assert test.degrees == [1]
    assert test.tones == [0]
    retval = test.add_tone(WHOLE)
    assert retval == 2
    assert test.degrees == [1, 2]
    assert test.tones == [0, WHOLE]
Example #4
0
def test_scale_insert_tone_nonet():
    test = scale_12edo.Scale12EDO(tones=list(range(100, 1200, 100)))
    retval = test.add_tone_rel_degree(degree=3, cents=111)
    assert retval is None
    assert test.degree_tones == {
        1: 0,
        2: 100,
        3: 200,
        4: 300,
        5: 400,
        6: 500,
        7: 600,
        8: 700,
        9: 800,
        10: 900,
        11: 1000,
        12: 1100
    }
Example #5
0
def test_scale_move_tone_down_nonet():
    test = scale_12edo.Scale12EDO(tones=list(range(100, 1200, 100)))
    retval = test.move_degree(degree=3, cents=-1)
    assert retval == -1
    assert test.degree_tones == {
        1: 0,
        2: 100,
        3: 200,
        4: 300,
        5: 400,
        6: 500,
        7: 600,
        8: 700,
        9: 800,
        10: 900,
        11: 1000,
        12: 1100
    }
Example #6
0
def test_scale_nontet():
    test = scale_12edo.Scale12EDO(tones=[101])
    assert test.degrees == [1]
    assert test.tones == [0]
Example #7
0
def test_scale_wholetone():
    test = scale_12edo.Scale12EDO(tones=[WHOLE])
    assert test.degrees == [1, 2]
    assert test.tones == [0, WHOLE]
Example #8
0
def test_scale_semitone():
    test = scale_12edo.Scale12EDO(tones=[SEMI])
    assert test.degrees == [1, 2]
    assert test.tones == [0, SEMI]