1 | #! /usr/bin/env python |
---|
2 | |
---|
3 | from numpy.testing import TestCase, run_module_suite |
---|
4 | from numpy.testing import assert_equal, assert_almost_equal |
---|
5 | from aubio import bintomidi, miditobin, freqtobin, bintofreq, freqtomidi, miditofreq |
---|
6 | from aubio import unwrap2pi |
---|
7 | |
---|
8 | class aubio_mathutils(TestCase): |
---|
9 | |
---|
10 | def test_unwrap2pi(self): |
---|
11 | a = [ x/100. for x in range(-600,600,100) ] |
---|
12 | b = [ unwrap2pi(x) for x in a ] |
---|
13 | #print b |
---|
14 | |
---|
15 | def test_miditobin(self): |
---|
16 | a = [ miditobin(a, 44100, 512) for a in range(128) ] |
---|
17 | |
---|
18 | def test_bintomidi(self): |
---|
19 | a = [ bintomidi(a, 44100, 512) for a in range(128) ] |
---|
20 | |
---|
21 | def test_freqtobin(self): |
---|
22 | a = [ freqtobin(a, 44100, 512) for a in range(128) ] |
---|
23 | |
---|
24 | def test_bintofreq(self): |
---|
25 | a = [ bintofreq(a, 44100, 512) for a in range(128) ] |
---|
26 | |
---|
27 | def test_freqtomidi(self): |
---|
28 | a = [ freqtomidi(a) for a in range(128) ] |
---|
29 | |
---|
30 | def test_miditofreq(self): |
---|
31 | freqs = [ miditofreq(a) for a in range(128) ] |
---|
32 | midis = [ freqtomidi(a) for a in freqs ] |
---|
33 | |
---|
34 | if __name__ == '__main__': |
---|
35 | from unittest import main |
---|
36 | main() |
---|