feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since b517cb3 was
37eb9ce,
checked in by Paul Brossier <piem@piem.org>, 15 years ago
|
merge from master, print beats once in demo_beat.py
|
-
Property mode set to
100644
|
File size:
688 bytes
|
Line | |
---|
1 | #! /usr/bin/python |
---|
2 | |
---|
3 | import sys |
---|
4 | from os.path import splitext, basename |
---|
5 | from aubio import tempo |
---|
6 | from aubioinput import aubioinput |
---|
7 | |
---|
8 | win_s = 512 # fft size |
---|
9 | hop_s = win_s / 2 # hop size |
---|
10 | beat = tempo("default", win_s, hop_s) |
---|
11 | |
---|
12 | beats = [] |
---|
13 | |
---|
14 | def process(samples, pos): |
---|
15 | isbeat = beat(samples) |
---|
16 | if isbeat: |
---|
17 | thisbeat = (float(isbeat[0]) + pos * hop_s) / 44100. |
---|
18 | print thisbeat |
---|
19 | beats.append (thisbeat) |
---|
20 | |
---|
21 | if len(sys.argv) < 2: |
---|
22 | print "Usage: %s <filename>" % sys.argv[0] |
---|
23 | else: |
---|
24 | filename = sys.argv[1] |
---|
25 | a = aubioinput(filename, process = process, hopsize = hop_s, |
---|
26 | caps = 'audio/x-raw-float, rate=44100, channels=1') |
---|
27 | a.run() |
---|
Note: See
TracBrowser
for help on using the repository browser.