Esempio n. 1
0
def test_chorus(mix_and_sources, check_against_regression_data):
    signal, _ = mix_and_sources

    in_gain = .4
    out_gain = .7
    delays = [45, 55]
    decays = [.6, .2]
    speeds = [.9, .8]
    depths = [2, 1.5]

    filters = [effects.chorus(delays, decays,
                              speeds, depths, in_gain=in_gain, out_gain=out_gain)]
    augmented_signal = effects.apply_effects_ffmpeg(signal, filters)
    reg_path = path.join(REGRESSION_PATH, "chorus.json")
    fx_regression(augmented_signal.audio_data, reg_path,
                  check_against_regression_data)
Esempio n. 2
0
def test_misc_param_check():
    with pytest.raises(ValueError):
        effects.vibrato(-1, 1)
    with pytest.raises(ValueError):
        effects.vibrato(1, -1)

    with pytest.raises(ValueError):
        effects.tremolo(-1, 1)
    with pytest.raises(ValueError):
        effects.tremolo(1, -1)

    with pytest.raises(ValueError):
        effects.chorus([1], [2, 3], [45, 6], [4])
    with pytest.warns(UserWarning):
        effects.chorus([2000], [.5], [.7], [.4])
    with pytest.raises(ValueError):
        effects.chorus([1], [30], [.7], [.4], in_gain=-1)

    with pytest.raises(ValueError):
        effects.phaser(in_gain=-1)
    with pytest.raises(ValueError):
        effects.phaser(out_gain=-1)
    with pytest.raises(ValueError):
        effects.phaser(decay=-1)
    with pytest.raises(ValueError):
        effects.phaser(type_="fail")

    with pytest.raises(ValueError):
        effects.flanger(delay=-1)
    with pytest.raises(ValueError):
        effects.flanger(depth=-1)
    with pytest.raises(ValueError):
        effects.flanger(regen=-100)
    with pytest.raises(ValueError):
        effects.flanger(width=-1)
    with pytest.raises(ValueError):
        effects.flanger(speed=-1)
    with pytest.raises(ValueError):
        effects.flanger(shape="fail")
    with pytest.raises(ValueError):
        effects.flanger(interp="fail")
    with pytest.raises(ValueError):
        effects.flanger(phase=-1)

    with pytest.raises(ValueError):
        effects.emphasis(1, 1, type_="fail")
    with pytest.raises(ValueError):
        effects.emphasis(1, 1, mode="fail")
    with pytest.raises(ValueError):
        effects.emphasis(1, -1)

    band = {'chn': [0], 'f': 300, 'w': 10, 'g': 10, 't': 5}
    with pytest.raises(ValueError):
        effects.equalizer([band])
    band["g"] = -1
    with pytest.raises(ValueError):
        effects.equalizer([band])
    band["w"] = -1
    with pytest.raises(ValueError):
        effects.equalizer([band])
    band["f"] = -1
    with pytest.raises(ValueError):
        effects.equalizer([band])
    band["chn"].append(-1)
    with pytest.raises(ValueError):
        effects.equalizer([band])

    with pytest.raises(ValueError):
        effects.SoXFilter('fail')