Пример #1
0
def test_phaser(mix_and_sources, check_against_regression_data):
    signal, _ = mix_and_sources

    in_gain = .4
    out_gain = .74
    delay = 3
    speed = .8

    filters = [effects.phaser(in_gain, out_gain, delay, speed)]
    augmented_signal = effects.apply_effects_ffmpeg(signal, filters)
    reg_path = path.join(REGRESSION_PATH, "phaser.json")
    fx_regression(augmented_signal.audio_data, reg_path,
                  check_against_regression_data)
Пример #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')