From: Paul Brossier Date: Wed, 6 Mar 2013 20:49:50 +0000 (-0500) Subject: demos/demo_sink.py: indent X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=eadc00b77c79a40d9dc64eaa7fe55a6d4d8e4fa5;p=aubio.git demos/demo_sink.py: indent --- diff --git a/python/demos/demo_sink.py b/python/demos/demo_sink.py index 8a5b587c..93139ae8 100755 --- a/python/demos/demo_sink.py +++ b/python/demos/demo_sink.py @@ -4,25 +4,26 @@ import sys from aubio import source, sink if __name__ == '__main__': - if len(sys.argv) < 3: - print 'usage: %s [samplerate] [hop_size]' % sys.argv[0] - sys.exit(1) + if len(sys.argv) < 3: + print 'usage: %s [samplerate] [hop_size]' % sys.argv[0] + sys.exit(1) - if len(sys.argv) > 3: samplerate = int(sys.argv[3]) - else: samplerate = 0 - if len(sys.argv) > 4: hop_size = int(sys.argv[4]) - else: hop_size = 256 + if len(sys.argv) > 3: samplerate = int(sys.argv[3]) + else: samplerate = 0 + if len(sys.argv) > 4: hop_size = int(sys.argv[4]) + else: hop_size = 256 - f = source(sys.argv[1], samplerate, hop_size) - if samplerate == 0: samplerate = f.samplerate - g = sink(sys.argv[2], samplerate) + f = source(sys.argv[1], samplerate, hop_size) + if samplerate == 0: samplerate = f.samplerate + g = sink(sys.argv[2], samplerate) - total_frames, read = 0, hop_size - while read: - vec, read = f() - g(vec, read) - total_frames += read - print "wrote", "%.2fs" % (total_frames / float(samplerate) ), - print "(", total_frames, "frames", "in", total_frames % hop_size, "blocks", "at", "%dHz" % samplerate, ")", - print "from", f.uri, - print "to", g.uri + total_frames, read = 0, hop_size + while read: + vec, read = f() + g(vec, read) + total_frames += read + print "wrote", "%.2fs" % (total_frames / float(samplerate) ), + print "(", total_frames, "frames", "in", + print total_frames / f.hop_size, "blocks", "at", "%dHz" % f.samplerate, ")", + print "from", f.uri, + print "to", g.uri