ynop / audiomate

Python library for handling audio datasets.
https://audiomate.readthedocs.io/
MIT License
131 stars 26 forks source link

Unit test failure with `TestMelSpectrogram.test_compute` #93

Closed toddrme2178 closed 4 years ago

toddrme2178 commented 4 years ago

I am getting the following unit test failure:

_______________________ TestMelSpectrogram.test_compute ________________________

self = <tests.processing.pipeline.test_spectral.TestMelSpectrogram object at 0x7f800d842630>

    def test_compute(self):
        samples = np.arange(8096).astype(np.float32)
        D = np.abs(librosa.core.stft(samples, n_fft=2048, hop_length=512, center=False)) ** 2
        expected = librosa.feature.melspectrogram(S=D, sr=16000, n_mels=128).T

        frames = librosa.util.frame(samples, frame_length=2048, hop_length=512).T
        mel = pipeline.MelSpectrogram(n_mels=128)
        res = mel.process_frames(frames, sampling_rate=16000)

>       assert np.array_equal(expected, res)
E       assert False
E        +  where False = <function array_equal at 0x7f803bdbe598>(array([[4.9207828e+09, 8.2807012e+05, 4.0641367e+04, ..., 2.3389910e-09,\n        1.0672034e-09, 3.0037420e-10],\n      ...1.6693844e+11, 8.2807012e+05, 4.0641367e+04, ..., 2.3389910e-09,\n        1.0672037e-09, 3.0037423e-10]], dtype=float32), array([[4.9207828e+09, 8.2807012e+05, 4.0641367e+04, ..., 2.3389910e-09,\n        1.0672034e-09, 3.0037420e-10],\n      ...1.6693844e+11, 8.2807012e+05, 4.0641367e+04, ..., 2.3389910e-09,\n        1.0672037e-09, 3.0037420e-10]], dtype=float32))
E        +    where <function array_equal at 0x7f803bdbe598> = np.array_equal

tests/processing/pipeline/test_spectral.py:18: AssertionError
ynop commented 4 years ago

Same as in #92. If I had to guess, I would say you have an old version of librosa.

ynop commented 4 years ago

I assume this is solved, otherwise please reopen.