History

[py] improve style for demo_source_simple.py

Paul Brossier committed 8 years ago

Commit 254acce1 parent 8ebcd3d1 file · +10 −6Browse files

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

Unified · Split

python/demos/demo_source_simple.py+10−6
@@ -1,16 +1,20 @@
11 #! /usr/bin/env python
2+
3+"""A simple example using aubio.source."""
4+
25 import sys
36 import aubio
47
5−samplerate = 0 # use original source samplerate
6−hop_size = 256 # number of frames to read in one block
8+samplerate = 0 # use original source samplerate
9+hop_size = 256 # number of frames to read in one block
710 src = aubio.source(sys.argv[1], samplerate, hop_size)
811 total_frames = 0
912
1013 while True:
11− samples, read = src() # read hop_size new samples from source
12− total_frames += read # increment total number of frames
13− if read < hop_size: break # end of file reached
14+ samples, read = src() # read hop_size new samples from source
15+ total_frames += read # increment total number of frames
16+ if read < hop_size: # end of file reached
17+ break
1418
1519 fmt_string = "read {:d} frames at {:d}Hz from {:s}"
16−print (fmt_string.format(total_frames, src.samplerate, src.uri))
20+print(fmt_string.format(total_frames, src.samplerate, src.uri))

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