feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change
on this file since 8147e03 was
8b884ef,
checked in by Paul Brossier <piem@piem.org>, 12 years ago
|
src/onset/: rename get_last_onset to get_last
|
-
Property mode set to
100755
|
File size:
742 bytes
|
Line | |
---|
1 | #! /usr/bin/env python |
---|
2 | |
---|
3 | import sys |
---|
4 | from aubio import source, onset |
---|
5 | |
---|
6 | win_s = 512 # fft size |
---|
7 | hop_s = win_s / 2 # hop size |
---|
8 | |
---|
9 | if len(sys.argv) < 2: |
---|
10 | print "Usage: %s <filename> [samplerate]" % sys.argv[0] |
---|
11 | sys.exit(1) |
---|
12 | |
---|
13 | filename = sys.argv[1] |
---|
14 | |
---|
15 | samplerate = 0 |
---|
16 | if len( sys.argv ) > 2: samplerate = int(sys.argv[2]) |
---|
17 | |
---|
18 | s = source(filename, samplerate, hop_s) |
---|
19 | samplerate = s.samplerate |
---|
20 | |
---|
21 | o = onset("default", win_s, hop_s, samplerate) |
---|
22 | |
---|
23 | # list of onsets, in samples |
---|
24 | onsets = [] |
---|
25 | |
---|
26 | # total number of frames read |
---|
27 | total_frames = 0 |
---|
28 | while True: |
---|
29 | samples, read = s() |
---|
30 | if o(samples): |
---|
31 | print "%f" % o.get_last_s() |
---|
32 | onsets.append(o.get_last()) |
---|
33 | total_frames += read |
---|
34 | if read < hop_s: break |
---|
35 | #print len(onsets) |
---|
Note: See
TracBrowser
for help on using the repository browser.