Showing the changes to python/tests (1 of 1 file). Show all
Unified · Split
| @@ -105,6 +105,41 @@ class Test_aubio_mfcc_all_parameters(object): · 104 unmodified lines | |||
| 105 | o(spec) | 105 | o(spec) |
| 106 | #print coeffs | 106 | #print coeffs |
| 107 | 107 | ||
| 108 | |||
| 109 | class aubio_mfcc_fb_params(TestCase): | ||
| 110 | |||
| 111 | def test_set_scale(self): | ||
| 112 | buf_size, n_filters, n_coeffs, samplerate = 512, 20, 10, 16000 | ||
| 113 | m = mfcc(buf_size, n_filters, n_coeffs, samplerate) | ||
| 114 | m.set_scale(10.) | ||
| 115 | m(cvec(buf_size)) | ||
| 116 | |||
| 117 | def test_set_power(self): | ||
| 118 | buf_size, n_filters, n_coeffs, samplerate = 512, 20, 10, 16000 | ||
| 119 | m = mfcc(buf_size, n_filters, n_coeffs, samplerate) | ||
| 120 | m.set_power(2.) | ||
| 121 | m(cvec(buf_size)) | ||
| 122 | |||
| 123 | def test_set_mel_coeffs(self): | ||
| 124 | buf_size, n_filters, n_coeffs, samplerate = 512, 20, 10, 16000 | ||
| 125 | m = mfcc(buf_size, n_filters, n_coeffs, samplerate) | ||
| 126 | m.set_mel_coeffs(0., samplerate/2.) | ||
| 127 | m(cvec(buf_size)) | ||
| 128 | |||
| 129 | def test_set_mel_coeffs_htk(self): | ||
| 130 | buf_size, n_filters, n_coeffs, samplerate = 512, 20, 10, 16000 | ||
| 131 | m = mfcc(buf_size, n_filters, n_coeffs, samplerate) | ||
| 132 | m.set_mel_coeffs_htk(0., samplerate/2.) | ||
| 133 | m(cvec(buf_size)) | ||
| 134 | |||
| 135 | def test_set_mel_coeffs_slaney(self): | ||
| 136 | buf_size, n_filters, n_coeffs, samplerate = 512, 40, 10, 16000 | ||
| 137 | m = mfcc(buf_size, n_filters, n_coeffs, samplerate) | ||
| 138 | m.set_mel_coeffs_slaney(samplerate) | ||
| 139 | m(cvec(buf_size)) | ||
| 140 | assert m.get_power() == 1 | ||
| 141 | assert m.get_scale() == 1 | ||
| 142 | |||
| 108 | if __name__ == '__main__': | 143 | if __name__ == '__main__': |
| 109 | from _tools import run_module_suite | 144 | from _tools import run_module_suite |
| 110 | run_module_suite() | 145 | run_module_suite() |