feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since 870ad70 was
1cc78e7,
checked in by Paul Brossier <piem@piem.org>, 11 years ago
|
python/demos/demo_source_auto_samplerate.py: define hop_size
|
-
Property mode set to
100755
|
File size:
472 bytes
|
Line | |
---|
1 | #! /usr/bin/env python |
---|
2 | |
---|
3 | import sys |
---|
4 | from aubio import source |
---|
5 | |
---|
6 | if __name__ == '__main__': |
---|
7 | if len(sys.argv) < 2: |
---|
8 | print 'usage: %s <inputfile>' % sys.argv[0] |
---|
9 | sys.exit(1) |
---|
10 | hop_size = 512 |
---|
11 | f = source(sys.argv[1], 0, hop_size) |
---|
12 | samplerate = f.samplerate |
---|
13 | total_frames, read = 0, hop_size |
---|
14 | while read: |
---|
15 | vec, read = f() |
---|
16 | total_frames += read |
---|
17 | print f.uri, "is", |
---|
18 | print "%.2f seconds long at %.1fkHz" % (total_frames / float(samplerate), samplerate / 1000. ) |
---|
Note: See
TracBrowser
for help on using the repository browser.