Showing the changes to python (1 of 2 files). Show all
Unified · Split
| @@ -0,0 +1,16 @@ | ||
| 1 | +#! /usr/bin/env python | |
| 2 | +import sys, aubio | |
| 3 | + | |
| 4 | +samplerate = 0 # use original source samplerate | |
| 5 | +hop_size = 256 # number of frames to read in one block | |
| 6 | +s = aubio.source(sys.argv[1], samplerate, hop_size) | |
| 7 | +total_frames = 0 | |
| 8 | + | |
| 9 | +while True: # reading loop | |
| 10 | + samples, read = s() | |
| 11 | + total_frames += read | |
| 12 | + if read < hop_size: break # end of file reached | |
| 13 | + | |
| 14 | +fmt_string = "read {:d} frames at {:d}Hz from {:s}" | |
| 15 | +print (fmt_string.format(total_frames, s.samplerate, sys.argv[1])) | |
| 16 | + | |