Changeset c03d191 for python/demos/demo_source_simple.py
- Timestamp:
- Nov 17, 2018, 10:19:27 PM (5 years ago)
- Branches:
- feature/constantq
- Children:
- d1d4ad4
- Parents:
- 088760e (diff), a114fe0 (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
r088760e rc03d191 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 samplerate6 hop_size = 256 # number of frames to read in one block8 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 20 print(fmt_string.format(total_frames, src.samplerate, src.uri))
Note: See TracChangeset
for help on using the changeset viewer.