feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5sampler
Last change
on this file since c23e591 was
e6ce204,
checked in by Paul Brossier <piem@piem.org>, 8 years ago
|
python/demos/demo_source_simple.py: make executable
|
-
Property mode set to
100755
|
File size:
465 bytes
|
Rev | Line | |
---|
[d44763f] | 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 |
---|
[30e080c] | 10 | samples, read = s() |
---|
| 11 | total_frames += read |
---|
| 12 | if read < hop_size: break # end of file reached |
---|
[d44763f] | 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 | |
---|
Note: See
TracBrowser
for help on using the repository browser.