History

[py] improve style for demo_filter.py

Paul Brossier committed 8 years ago

Commit 8ebcd3d1 parent 9374e571 file · +6 −4Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/demos/demo_filter.py+6−4
@@ -4,6 +4,7 @@ import sys · 3 unmodified lines
44 import os.path
55 import aubio
66
7+
78 def apply_filter(path, target):
89 # open input file, get its samplerate
910 s = aubio.source(path)
@@ -27,19 +28,20 @@ def apply_filter(path, target): · 17 unmodified lines
2728 # count frames read
2829 total_frames += read
2930 # end of file reached
30− if read < s.hop_size: break
31+ if read < s.hop_size:
32+ break
3133
3234 # print some info
3335 duration = total_frames / float(samplerate)
3436 input_str = "input: {:s} ({:.2f} s, {:d} Hz)"
3537 output_str = "output: {:s}, A-weighting filtered ({:d} frames total)"
36− print (input_str.format(s.uri, duration, samplerate))
37− print (output_str.format(o.uri, total_frames))
38+ print(input_str.format(s.uri, duration, samplerate))
39+ print(output_str.format(o.uri, total_frames))
3840
3941 if __name__ == '__main__':
4042 usage = "{:s} <input_file> [output_file]".format(sys.argv[0])
4143 if not 1 < len(sys.argv) < 4:
42− print (usage)
44+ print(usage)
4345 sys.exit(1)
4446 if len(sys.argv) < 3:
4547 input_path = sys.argv[1]

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t