Ejemplo n.º 1
0
def test_serialize_deserialize_transform_speed(audio):
    speed_orig = Speed(factor=1.1)
    data_speed = speed_orig.to_dict()
    speed = AudioTransform.from_dict(data_speed)
    perturbed_speed = speed(audio, SAMPLING_RATE)

    assert perturbed_speed.shape == (1, 14545)
Ejemplo n.º 2
0
def test_serialize_deserialize_transform_volume(audio):
    volume_orig = Volume(factor=0.5)
    data_volume = volume_orig.to_dict()
    volume = AudioTransform.from_dict(data_volume)
    perturbed_volume = volume(audio, SAMPLING_RATE)

    assert perturbed_volume.shape == audio.shape
    assert_array_almost_equal(perturbed_volume, audio * 0.5)
Ejemplo n.º 3
0
def test_deserialize_transform(audio):
    speed = AudioTransform.from_dict({
        'name': 'Speed',
        'kwargs': {
            'factor': 1.1
        }
    })
    perturbed = speed(audio, SAMPLING_RATE)
    assert perturbed.shape == (1, 14545)
Ejemplo n.º 4
0
def test_deserialize_transform_speed(audio):
    speed = AudioTransform.from_dict({
        "name": "Speed",
        "kwargs": {
            "factor": 1.1
        }
    })
    perturbed_speed = speed(audio, SAMPLING_RATE)

    assert perturbed_speed.shape == (1, 14545)
Ejemplo n.º 5
0
def test_deserialize_transform_volume(audio):
    volume = AudioTransform.from_dict({
        "name": "Volume",
        "kwargs": {
            "factor": 0.5
        }
    })
    perturbed_volume = volume(audio, SAMPLING_RATE)

    assert perturbed_volume.shape == audio.shape
    assert_array_almost_equal(perturbed_volume, audio * 0.5)