source: python/demos/demo_source_simple.py @ 20c8769

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5
Last change on this file since 20c8769 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
Line 
1#! /usr/bin/env python
2import sys, aubio
3
4samplerate = 0  # use original source samplerate
5hop_size = 256 # number of frames to read in one block
6s = aubio.source(sys.argv[1], samplerate, hop_size)
7total_frames = 0
8
9while True: # reading loop
10    samples, read = s()
11    total_frames += read
12    if read < hop_size: break # end of file reached
13
14fmt_string = "read {:d} frames at {:d}Hz from {:s}"
15print (fmt_string.format(total_frames, s.samplerate, sys.argv[1]))
16
Note: See TracBrowser for help on using the repository browser.