History

python/aubiomodule.c: add midi/bin/freq conversion

Paul Brossier committed 13 years ago

Commit 6a50b9e1 parent 68d04922 files · +140 −2Browse files

Showing the changes to python/tests (1 of 2 files). Show all

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t