Changeset 78561f7 for python/demos/demo_source_simple.py
- Timestamp:
- Oct 31, 2018, 5:16:30 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
- Children:
- 07382d8
- Parents:
- dc3f68d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/demos/demo_source_simple.py
rdc3f68d r78561f7 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.