shithub: aubio

ref: 577cb497de471e95b162a32d03d62472563ba1a0
dir: /interfaces/python/demo_source.py/

View raw version
#! /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