Ignore:
Timestamp:
Jul 10, 2015, 2:08:22 AM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
665b711
Parents:
5a7e2c3
Message:

ext/py-musicutils.c: add db_spl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/tests/test_musicutils.py

    r5a7e2c3 r4615886a  
    66from math import pi
    77
    8 from aubio import window, level_lin
     8from aubio import window, level_lin, db_spl
    99
    1010from aubio import fvec
     
    5656        assert_equal(level_lin(-ones(1024, dtype="float32")), 1.)
    5757
     58class aubio_db_spl(TestCase):
     59    def test_accept_fvec(self):
     60        db_spl(fvec(1024))
     61
     62    def test_fail_not_fvec(self):
     63        try:
     64            db_spl("default")
     65        except ValueError, e:
     66            pass
     67        else:
     68            self.fail('non-number input phase does not raise a TypeError')
     69
     70    def test_zeros_is_inf(self):
     71        from math import isinf
     72        assert isinf(db_spl(fvec(1024)))
     73
     74    def test_minus_ones_is_zero(self):
     75        from numpy import ones
     76        assert_equal(db_spl(-ones(1024, dtype="float32")), 0.)
     77
    5878if __name__ == '__main__':
    5979    from unittest import main
Note: See TracChangeset for help on using the changeset viewer.