Exemple #1
0
def test_multi_frequency_weighting(kinds):
    freq = np.linspace(2e1, 2e4)
    assert np.allclose(librosa.multi_frequency_weighting(freq, kinds),
                       np.stack([
                           librosa.A_weighting(freq),
                           librosa.Z_weighting(freq),
                           librosa.C_weighting(freq),
                       ]),
                       0,
                       atol=1e-3)
Exemple #2
0
def test_C_weighting(min_db):

    # Check that 1KHz is around 0dB
    c_khz = librosa.C_weighting(1000.0, min_db=min_db)
    assert np.allclose(c_khz, 0, atol=1e-3)

    c_range = librosa.B_weighting(np.linspace(2e1, 2e4), min_db=min_db)
    # Check that the db cap works
    if min_db is not None:
        assert not np.any(c_range < min_db)