Changeset 62c2d00 for python


Ignore:
Timestamp:
Nov 17, 2018, 7:07:46 PM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
f7af440, ff28d81
Parents:
2eb52bd
Message:

[tests] add tests for mfcc filterbank settings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_mfcc.py

    r2eb52bd r62c2d00  
    111111        #print coeffs
    112112
     113
     114class aubio_mfcc_fb_params(TestCase):
     115
     116    def test_set_scale(self):
     117        buf_size, n_filters, n_coeffs, samplerate = 512, 20, 10, 16000
     118        m = mfcc(buf_size, n_filters, n_coeffs, samplerate)
     119        m.set_scale(10.)
     120        m(cvec(buf_size))
     121
     122    def test_set_power(self):
     123        buf_size, n_filters, n_coeffs, samplerate = 512, 20, 10, 16000
     124        m = mfcc(buf_size, n_filters, n_coeffs, samplerate)
     125        m.set_power(2.)
     126        m(cvec(buf_size))
     127
     128    def test_set_mel_coeffs(self):
     129        buf_size, n_filters, n_coeffs, samplerate = 512, 20, 10, 16000
     130        m = mfcc(buf_size, n_filters, n_coeffs, samplerate)
     131        m.set_mel_coeffs(0., samplerate/2.)
     132        m(cvec(buf_size))
     133
     134    def test_set_mel_coeffs_htk(self):
     135        buf_size, n_filters, n_coeffs, samplerate = 512, 20, 10, 16000
     136        m = mfcc(buf_size, n_filters, n_coeffs, samplerate)
     137        m.set_mel_coeffs_htk(0., samplerate/2.)
     138        m(cvec(buf_size))
     139
     140    def test_set_mel_coeffs_slaney(self):
     141        buf_size, n_filters, n_coeffs, samplerate = 512, 40, 10, 16000
     142        m = mfcc(buf_size, n_filters, n_coeffs, samplerate)
     143        m.set_mel_coeffs_slaney(samplerate)
     144        m(cvec(buf_size))
     145        assert m.get_power() == 1
     146        assert m.get_scale() == 1
     147
    113148if __name__ == '__main__':
    114149    main()
Note: See TracChangeset for help on using the changeset viewer.