def test_chromafb():

    def __test(infile):
        DATA = load(infile)

        octwidth = DATA['octwidth'][0, 0]
        if octwidth == 0:
            octwidth = None

        wts = librosa.filters.chroma(DATA['sr'][0, 0],
                                     DATA['nfft'][0, 0],
                                     DATA['nchroma'][0, 0],
                                     A440=DATA['a440'][0, 0],
                                     ctroct=DATA['ctroct'][0, 0],
                                     octwidth=octwidth,
                                     norm=2,
                                     base_c=False)

        # Our version only returns the real-valued part.
        # Pad out.
        wts = np.pad(wts, [(0, 0),
                           (0, int(DATA['nfft'][0, 0]//2 - 1))],
                     mode='constant')

        eq_(wts.shape, DATA['wts'].shape)
        assert np.allclose(wts, DATA['wts'])

    for infile in files('data/feature-chromafb-*.mat'):
        yield (__test, infile)
dataset/ETHPy150Open bmcfee/librosa/tests/test_filters.py/test_chromafb/original