projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6500367
)
demo_sink.py: add simple demo
author
Paul Brossier
<piem@piem.org>
Mon, 16 Jul 2012 22:55:14 +0000
(16:55 -0600)
committer
Paul Brossier
<piem@piem.org>
Mon, 16 Jul 2012 22:55:14 +0000
(16:55 -0600)
interfaces/python/demo_sink.py
[new file with mode: 0755]
patch
|
blob
diff --git a/interfaces/python/demo_sink.py
b/interfaces/python/demo_sink.py
new file mode 100755
(executable)
index 0000000..
230a28d
--- /dev/null
+++ b/
interfaces/python/demo_sink.py
@@ -0,0
+1,17
@@
+#! /usr/bin/python
+
+import sys
+from aubio import source, sink
+
+if __name__ == '__main__':
+ if len(sys.argv) < 2:
+ print 'usage: %s <inputfile> <outputfile>' % sys.argv[0]
+ sys.exit(1)
+ f = source(sys.argv[1], 8000, 256)
+ g = sink(sys.argv[2], 8000)
+ total_frames, read = 0, 256
+ while read:
+ vec, read = f()
+ g(vec, read)
+ total_frames += read
+ print "read", total_frames / float(f.samplerate), "seconds from", f.uri