ref: d06c9a45dc272ee6ca10000c54d02b2abdfaa031
parent: ff28d812f0e088fb431feffd1377805afbe8e4a9
parent: a114fe078f7c37702a887469609fe467ee3d6dae
author: Paul Brossier <piem@piem.org>
date: Sat Nov 17 17:21:30 EST 2018
Merge branch 'master' into feature/pytest
--- a/python/tests/test_filter.py
+++ b/python/tests/test_filter.py
@@ -76,6 +76,16 @@
with self.assertRaises(ValueError):
f.set_biquad(0., 0., 0, 0., 0.)
+ def test_all_available_presets(self):
+ f = digital_filter(7)
+ for sr in [8000, 11025, 16000, 22050, 24000, 32000,
+ 44100, 48000, 88200, 96000, 192000]:
+ f.set_a_weighting(sr)
+ f = digital_filter(5)
+ for sr in [8000, 11025, 16000, 22050, 24000, 32000,
+ 44100, 48000, 88200, 96000, 192000]:
+ f.set_c_weighting(sr)
+
class aubio_filter_wrong_params(TestCase):
def test_negative_order(self):
--- a/python/tests/test_onset.py
+++ b/python/tests/test_onset.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python
from numpy.testing import TestCase, assert_equal, assert_almost_equal
-from aubio import onset
+from aubio import onset, fvec
class aubio_onset_default(TestCase):
@@ -81,6 +81,38 @@
class aubio_onset_8000(aubio_onset_params):
samplerate = 8000
+
+class aubio_onset_coverate(TestCase):
+ # extra tests to execute the C routines and improve coverage
+
+ def test_all_methods(self):
+ for method in ['default', 'energy', 'hfc', 'complexdomain', 'complex',
+ 'phase', 'wphase', 'mkl', 'kl', 'specflux', 'specdiff',
+ 'old_default']:
+ o = onset(method=method, buf_size=512, hop_size=256)
+ o(fvec(256))
+
+ def test_get_methods(self):
+ o = onset(method='default', buf_size=512, hop_size=256)
+
+ assert o.get_silence() == -70
+ o.set_silence(-20)
+ assert_almost_equal(o.get_silence(), -20)
+
+ assert o.get_compression() == 1
+ o.set_compression(.99)
+ assert_almost_equal(o.get_compression(), .99)
+
+ assert o.get_awhitening() == 0
+ o.set_awhitening(1)
+ assert o.get_awhitening() == 1
+
+ o.get_last()
+ o.get_last_ms()
+ o.get_last_s()
+ o.get_descriptor()
+ o.get_thresholded_descriptor()
+
if __name__ == '__main__':
from unittest import main
--- a/tests/src/temporal/test-filter.c
+++ b/tests/src/temporal/test-filter.c
@@ -8,6 +8,19 @@
fvec_t *out = new_fvec (win_s); // input buffer
aubio_filter_t *o = new_aubio_filter_c_weighting (44100);
+
+ if (new_aubio_filter(0))
+ return 1;
+
+ if (aubio_filter_get_samplerate(o) != 44100)
+ return 1;
+
+ if (aubio_filter_set_c_weighting (o, -1) == 0)
+ return 1;
+
+ if (aubio_filter_set_c_weighting (0, 32000) == 0)
+ return 1;
+
in->data[impulse_at] = 0.5;
fvec_print (in);
aubio_filter_do (o, in);
@@ -15,6 +28,12 @@
del_aubio_filter (o);
o = new_aubio_filter_a_weighting (32000);
+
+ if (aubio_filter_set_a_weighting (o, -1) == 0)
+ return 1;
+ if (aubio_filter_set_a_weighting (0, 32000) == 0)
+ return 1;
+
in->data[impulse_at] = 0.5;
fvec_print (in);
aubio_filter_do_outplace (o, in, out);