Пример #1
0
def test_blocks_to_time(blocks, block_length, hop_length, sr):
    times = librosa.blocks_to_time(blocks, block_length,
                                   hop_length, sr)

    # Check shape
    assert times.ndim == np.asarray(blocks).ndim
    assert times.size == np.asarray(blocks).size

    # Check values
    assert np.allclose(times,
                       np.asanyarray(blocks) * hop_length * block_length / float(sr))

    # Check dtype
    assert np.issubdtype(times.dtype, np.float)
Пример #2
0
def test_blocks_to_time(blocks, block_length, hop_length, sr):
    times = librosa.blocks_to_time(blocks, block_length,
                                   hop_length, sr)

    # Check shape
    assert times.ndim == np.asarray(blocks).ndim
    assert times.size == np.asarray(blocks).size

    # Check values
    assert np.allclose(times,
                       np.asanyarray(blocks) * hop_length * block_length / float(sr))

    # Check dtype
    assert np.issubdtype(times.dtype, np.float)