shithub: aubio

Download patch

ref: 3ff62e9ee5c73e45c2c95677b38202ab18820e4d
parent: 65003672b96559fe28370d4f6480f12b87ab8281
author: Paul Brossier <piem@piem.org>
date: Mon Jul 16 12:55:14 EDT 2012

demo_sink.py: add simple demo

--- /dev/null
+++ b/interfaces/python/demo_sink.py
@@ -1,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