Showing the changes to python/tests/test_source.py (1 of 21 files). Show all
Unified · Split
| @@ -0,0 +1,27 @@ | ||
| 1 | +#! /usr/bin/env python | |
| 2 | + | |
| 3 | +from numpy.testing import TestCase, assert_equal, assert_almost_equal | |
| 4 | +from aubio import fvec, source | |
| 5 | +from numpy import array | |
| 6 | + | |
| 7 | +path = "/Users/piem/archives/sounds/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav" | |
| 8 | + | |
| 9 | +class aubio_filter_test_case(TestCase): | |
| 10 | + | |
| 11 | + def test_members(self): | |
| 12 | + f = source(path) | |
| 13 | + print dir(f) | |
| 14 | + | |
| 15 | + def test_read(self): | |
| 16 | + f = source(path) | |
| 17 | + total_frames = 0 | |
| 18 | + while True: | |
| 19 | + vec, read = f() | |
| 20 | + total_frames += read | |
| 21 | + if read < f.hop_size: break | |
| 22 | + print "read", total_frames / float(f.samplerate), " seconds from", path | |
| 23 | + | |
| 24 | +if __name__ == '__main__': | |
| 25 | + from unittest import main | |
| 26 | + main() | |
| 27 | + | |