- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/demos/demo_source_simple.py
r78561f7 re6ce204 1 1 #! /usr/bin/env python 2 import sys 3 import aubio 2 import sys, aubio 4 3 5 samplerate = 0 # use original source samplerate4 samplerate = 0 # use original source samplerate 6 5 hop_size = 256 # number of frames to read in one block 7 s rc= aubio.source(sys.argv[1], samplerate, hop_size)6 s = aubio.source(sys.argv[1], samplerate, hop_size) 8 7 total_frames = 0 9 8 10 while True: 11 samples, read = s rc() # read hop_size new samples from source12 total_frames += read # increment total number of frames9 while True: # reading loop 10 samples, read = s() 11 total_frames += read 13 12 if read < hop_size: break # end of file reached 14 13 15 14 fmt_string = "read {:d} frames at {:d}Hz from {:s}" 16 print (fmt_string.format(total_frames, src.samplerate, src.uri)) 15 print (fmt_string.format(total_frames, s.samplerate, sys.argv[1])) 16
Note: See TracChangeset
for help on using the changeset viewer.