Changeset 088760e for python/demos/demo_source_simple.py
- Timestamp:
- Oct 31, 2018, 10:26:52 PM (5 years ago)
- Branches:
- feature/constantq
- Children:
- c03d191
- Parents:
- 45c2c5c (diff), 7a54b37 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/demos/demo_source_simple.py
r45c2c5c r088760e 1 1 #! /usr/bin/env python 2 import sys, aubio 2 import sys 3 import aubio 3 4 4 samplerate = 0 5 samplerate = 0 # use original source samplerate 5 6 hop_size = 256 # number of frames to read in one block 6 s = aubio.source(sys.argv[1], samplerate, hop_size)7 src = aubio.source(sys.argv[1], samplerate, hop_size) 7 8 total_frames = 0 8 9 9 while True: # reading loop10 samples, read = s ()11 total_frames += read 10 while True: 11 samples, read = src() # read hop_size new samples from source 12 total_frames += read # increment total number of frames 12 13 if read < hop_size: break # end of file reached 13 14 14 15 fmt_string = "read {:d} frames at {:d}Hz from {:s}" 15 print (fmt_string.format(total_frames, s.samplerate, sys.argv[1])) 16 16 print (fmt_string.format(total_frames, src.samplerate, src.uri))
Note: See TracChangeset
for help on using the changeset viewer.