Пример #1
0
def test_vibrato(mix_and_sources, check_against_regression_data):
    f = 5
    d = .5
    reg_path = path.join(REGRESSION_PATH, "vibrato.json")
    signal, _ = mix_and_sources

    filters = [effects.vibrato(f, d)]
    augmented_signal = effects.apply_effects_ffmpeg(signal, filters)
Пример #2
0
def test_compressor(mix_and_sources, check_against_regression_data):
    signal, _ = mix_and_sources
    level_in = 1

    reg_path = path.join(REGRESSION_PATH, f"compression.json")
    filters = [effects.compressor(level_in)]
    augmented_signal = effects.apply_effects_ffmpeg(signal, filters)
    fx_regression(augmented_signal.audio_data, reg_path, check_against_regression_data)
Пример #3
0
def test_tremolo(mix_and_sources, check_against_regression_data):
    f = 15
    d = .5
    signal, _ = mix_and_sources
    reg_path = path.join(REGRESSION_PATH, "tremolo.json")

    filters = [effects.tremolo(f, d)]
    augmented_signal = effects.apply_effects_ffmpeg(signal, filters)

    fx_regression(augmented_signal.audio_data, reg_path,
                  check_against_regression_data)
Пример #4
0
def test_emphasis(mix_and_sources, check_against_regression_data):
    signal, _ = mix_and_sources
    level_in = 1
    level_out = 2
    types = ['col', 'riaa', 'cd']
    mode = 'production'

    for _type in types:
        reg_path = path.join(REGRESSION_PATH, f"emphasis_{_type}.json")
        filters = [effects.emphasis(level_in, level_out, _type, mode=mode)]
        augmented_signal = effects.apply_effects_ffmpeg(signal, filters)
        fx_regression(augmented_signal.audio_data, reg_path, check_against_regression_data)
Пример #5
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)
Пример #6
0
def test_low_high_pass(mix_and_sources, check_against_regression_data):
    signal, _ = mix_and_sources
    f = 512
    filters = [effects.low_pass(f)]
    low_signal = effects.apply_effects_ffmpeg(signal, filters)
    low_path = path.join(REGRESSION_PATH, "low_pass.json")
    fx_regression(low_signal.audio_data, low_path,
                  check_against_regression_data)

    filters = [effects.high_pass(f)]
    high_signal = effects.apply_effects_ffmpeg(signal, filters)
    high_path = path.join(REGRESSION_PATH, "high_pass.json")
    fx_regression(high_signal.audio_data, high_path,
                  check_against_regression_data)

    with pytest.raises(ValueError):
        effects.low_pass(-1)
    with pytest.raises(ValueError):
        effects.low_pass("fail")
    with pytest.raises(ValueError):
        effects.low_pass(1, poles=0)
    with pytest.raises(ValueError):
        effects.low_pass(1, width_type=0)
    with pytest.raises(ValueError):
        effects.low_pass(1, width=-1)

    with pytest.raises(ValueError):
        effects.high_pass(-1)
    with pytest.raises(ValueError):
        effects.high_pass("fail")
    with pytest.raises(ValueError):
        effects.high_pass(1, poles=0)
    with pytest.raises(ValueError):
        effects.high_pass(1, width_type=0)
    with pytest.raises(ValueError):
        effects.high_pass(1, width=-1)
Пример #7
0
def test_equalizer(mix_and_sources, check_against_regression_data):
    bands = [{
        "chn": [0, 1],
        "f": i,
        "w": (5 * np.log2(i)),
        "g": 5,
        "t": 0
    } for i in [110, 440, 10000]]

    signal, _ = mix_and_sources
    filters = [effects.equalizer(bands)]
    augmented_signal = effects.apply_effects_ffmpeg(signal, filters)

    reg_path = path.join(REGRESSION_PATH, "equalizer.json")
    fx_regression(augmented_signal.audio_data, reg_path,
                  check_against_regression_data)
Пример #8
0
def test_flanger(mix_and_sources, check_against_regression_data):
    signal, _ = mix_and_sources

    delay = 10
    depth = 2
    regen = 10
    width = 70
    speed = .5
    phase = 25

    filters = [effects.flanger(delay=delay, depth=depth, regen=regen,
                               width=width, speed=speed, phase=phase)]
    augmented_signal = effects.apply_effects_ffmpeg(signal, filters)
    reg_path = path.join(REGRESSION_PATH, "flanger.json")
    fx_regression(augmented_signal.audio_data, reg_path,
                  check_against_regression_data)
Пример #9
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)
Пример #10
0
def test_silent_mode(mix_and_sources):
    signal, _ = mix_and_sources
    effects.apply_effects_ffmpeg(signal, [], silent=True)