interfaces/python/demo_source.py: use source samplerate
authorPaul Brossier <piem@piem.org>
Fri, 27 Jul 2012 17:34:40 +0000 (11:34 -0600)
committerPaul Brossier <piem@piem.org>
Fri, 27 Jul 2012 17:34:40 +0000 (11:34 -0600)
interfaces/python/demo_source.py

index 5c91236ef6a47f53960e207ec08e8a578282d9a2..d4f9de10fe616b165ce5dcd270953f1e6bb3ac08 100755 (executable)
@@ -7,9 +7,10 @@ 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)
+  f = source(sys.argv[1], 1, 256)
+  samplerate = f.get_samplerate()
   total_frames, read = 0, 256
   while read:
     vec, read = f()
     total_frames += read
-  print "read", total_frames / float(f.samplerate), "seconds from", f.uri
+  print "read", total_frames / float(samplerate), "seconds from", f.uri