Beispiel #1
0
def test_mix_small():
    s1 = {
        'rate': 30,
        'left': [1,2,3,4,5,6],
        'right': [7,6,5,4,3,2],
    }
    s2 = {
        'rate': 20,
        'left': [1,2,3,4,5,6],
        'right': [7,6,5,4,3,2],
    }
    s3 = {
        'rate': 30,
        'left': [7, 8, 9, 10],
        'right': [12, 13, 14, 15],
    }

    s4 = {
        'rate': 30,
        'left': [0.7+2.1, 1.4+2.4, 2.1+2.7, 2.8+3.0],
        'right': [4.9+3.6, 4.2+3.9, 3.5+4.2, 2.8+4.5]
    }

    assert lab.mix(s1, s2, 0.5) is None
    compare_sounds(lab.mix(s1, s3, 0.7), s4)
Beispiel #2
0
def test_mix_real():
    inp1 = lab.load_wav(os.path.join(TEST_DIRECTORY, 'sounds', 'chord.wav'))
    inp2 = lab.load_wav(os.path.join(TEST_DIRECTORY, 'sounds', 'crash.wav'))
    inp3 = copy.deepcopy(inp1)
    inp4 = copy.deepcopy(inp2)

    res = lab.mix(inp1, inp2, 0.35)
    outfile = os.path.join(TEST_DIRECTORY, 'test_outputs', 'chord_crash.wav')
    compare_against_file(res, outfile)

    assert inp1 == inp3, 'be careful not to modify the input!'
    assert inp2 == inp4, 'be careful not to modify the input!'
Beispiel #3
0
def test_mix_random_2():
    inps, exp = load_pickle_pair('mix_02.pickle')
    inps2 = copy.deepcopy(inps)
    compare_sounds(lab.mix(*inps), exp)
    assert inps == inps2, 'be careful not to modify the inputs!'