Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -1,16 +1,20 @@ | ||
| 1 | 1 | #! /usr/bin/env python |
| 2 | + | |
| 3 | +"""A simple example using aubio.source.""" | |
| 4 | + | |
| 2 | 5 | import sys |
| 3 | 6 | import aubio |
| 4 | 7 | |
| 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 | |
| 7 | 10 | src = aubio.source(sys.argv[1], samplerate, hop_size) |
| 8 | 11 | total_frames = 0 |
| 9 | 12 | |
| 10 | 13 | 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 | |
| 14 | 18 | |
| 15 | 19 | 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)) | |