From: Paul Brossier Date: Sun, 4 Nov 2018 19:57:33 +0000 (+0100) Subject: [py] improve style for demo_filter.py X-Git-Tag: 0.4.8~78 X-Git-Url: https://git.aubio.org/?p=aubio.git;a=commitdiff_plain;h=8ebcd3db81ae5c0a8580997c137c0c8dd54adcff [py] improve style for demo_filter.py --- diff --git a/python/demos/demo_filter.py b/python/demos/demo_filter.py index 1eb57730..ab3df6dc 100755 --- a/python/demos/demo_filter.py +++ b/python/demos/demo_filter.py @@ -4,6 +4,7 @@ import sys import os.path import aubio + def apply_filter(path, target): # open input file, get its samplerate s = aubio.source(path) @@ -27,19 +28,20 @@ def apply_filter(path, target): # count frames read total_frames += read # end of file reached - if read < s.hop_size: break + if read < s.hop_size: + break # print some info duration = total_frames / float(samplerate) input_str = "input: {:s} ({:.2f} s, {:d} Hz)" output_str = "output: {:s}, A-weighting filtered ({:d} frames total)" - print (input_str.format(s.uri, duration, samplerate)) - print (output_str.format(o.uri, total_frames)) + print(input_str.format(s.uri, duration, samplerate)) + print(output_str.format(o.uri, total_frames)) if __name__ == '__main__': usage = "{:s} [output_file]".format(sys.argv[0]) if not 1 < len(sys.argv) < 4: - print (usage) + print(usage) sys.exit(1) if len(sys.argv) < 3: input_path = sys.argv[1]