ref: b0ac9cd2166e0e12a792e104bac591bf433265f8
parent: 551c6c3a014ba1e7c77964bf8f524ef97e16a2ef
author: Paul Brossier <piem@piem.org>
date: Sun Jul 15 12:29:37 EDT 2012
demo_source.py: added simple example
--- /dev/null
+++ b/interfaces/python/demo_source.py
@@ -1,0 +1,15 @@
+#! /usr/bin/python
+
+import sys
+from aubio import source
+
+if __name__ == '__main__':
+ if len(sys.argv) < 2:
+ print 'usage: %s <inputfile>' % sys.argv[0]
+ sys.exit(1)
+ f = source(sys.argv[1], 8000, 256)
+ total_frames, read = 0, 256
+ while read:
+ vec, read = f()
+ total_frames += read
+ print "read", total_frames / float(f.samplerate), "seconds from", f.uri